Dual NIC Cards

Rick Stevens rstevens at vitalstream.com
Mon Apr 17 17:51:54 UTC 2006


On Fri, 2006-04-14 at 18:47 -0700, Bret Stern wrote:

<major snippage>
> > > > > I've heard you can only have a gateway address
> > > > > on one nic card. Is this correct?
> > > >
> > > > Yes, it's correct.
> > >
> > > Uhm, this must be clarified.  There is only one _default_ gateway, and
> > > that is the "route of last resort".  In other words, if you try to send
> > > traffic to a node that is not on a network directly connected to one of
> > > your NICs (as determined by the IP address/netmask combination) AND you
> > > don't have a route forcing traffic for the remote node's network through
> > > one of your NICs, THEN the traffic goes out the default gateway.  If you
> > > do have a route for the network, it goes out the NIC that has that
> > > route.
> > >
> > > As an example, assume a machine with two NICs.  eth0 has an IP of
> > > 192.168.0.2.  eth1 has an IP of 10.0.0.2.  The default gateway is
> > > 192.168.0.1 (obviously on eth1).
> >
> > DOH!  That should read "(obviously on eth0)."  That's what happens when
> > your boss is talking to you while you compose responses!
> >
> 
> So you only assign a gateway entry to ONE of the nic cards?

Actually, you define a single _default_ gateway for the entire machine.
It will automatically assign itself to one of the NICs, depending on
which NIC is "closest" to the gateway machine.  This is why the
"GATEWAY=" parameter is in /etc/sysconfig/network and not in one of the
/etc/sysconfig/network-scripts/ifcfg-ethX files.

If you have specific routes you want to force through specific
interfaces, then you can create those in
/etc/sysconfig/network-scripts/route-ethX files.
> > >
> > > Now, let's say you try to ping 10.24.1.1.  The traffic will go out eth0,
> > > since the default gateway (actually, the default route) is on eth0.
> > > However, you really want any traffic for 10.0.0.0/8 to go out on eth1.
> > > You set up a static route:
> > >
> > > 	route add -net 10.0.0.0 netmask 255.0.0.0 dev eth1
> > >
> > > Now, any traffic for the 10.0.0.0/8 network will go out eth1.  You
> > > can repeat that for as many networks (or hosts, if the netmask is /32)
> > > as you wish on each NIC (well, up to some practical limit).

----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer     rstevens at vitalstream.com -
- VitalStream, Inc.                       http://www.vitalstream.com -
-                                                                    -
- grasshopotomaus: A creature that can leap to tremendous heights... -
-                                                ...once.            -
----------------------------------------------------------------------




More information about the Redhat-install-list mailing list