Using 2 NICS?

Josip Loncaric josip at
Wed Oct 25 12:42:24 PDT 2000

Robert Ross wrote:
> What do you mean "Linux is assigning both IPs to the first NIC"?
> Something like:
> # ifconfig eth0
> # ifconfig eth1
> doesn't work? 
> On Wed, 25 Oct 2000, Karl Bellve wrote:
> > The question is, is it possible to use two NICs with their own unique IP
> > on the same subnet? I would then allow half of our computers to connect
> > to one IP and the other half to the other IP. I know this isn't load
> > balancing but I think this should be doable.
> > 
> > Right now, Linux is assigning both IPs to the first NICs since they have
> > the same netmask and gateway.

This should work -- except that there will be a few problems because
both cards are on the same subnet (although IP addresses differ).  You
may want to adjust your routing so that only one card handles
broadcasts.  Load balancing with two cards on the same subnet also
requires route adjustments.  Something like this may be needed:

/sbin/route add -host dev eth1
/sbin/route add -host dev eth0
/sbin/route add -host dev eth1
/sbin/route add -host dev eth0
# continue for all subnet hosts...
# Pick broadcast interface (eth0 chosen, eth1 won't broadcast)
/sbin/route add -host dev eth0
/sbin/route del -net netmask dev eth1
# Required by DHCP protocol (eth0 chosen, eth1 won't broadcast)
/sbin/route add -host dev eth0
# Required by NTP broadcast (also see route man page)
/sbin/route add -net netmask dev eth0

Even with all of the above, there may be problems if routing sends
outgoing traffic along eth0 but the remote host responds to eth1. 
Careful matching of hostnames etc. is required, and in the end the whole
construction may still run into problems (e.g. PBS does not like it when
'host' resolves to different IP addresses at different nodes).

Overall, you can get a minor benefit, but there will be a price to pay. 
Your setup will be more complicated and thus more likely to generate


Dr. Josip Loncaric, Senior Staff Scientist        mailto:josip at
ICASE, Mail Stop 132C           PGP key at
NASA Langley Research Center             mailto:j.loncaric at
Hampton, VA 23681-2199, USA    Tel. +1 757 864-2192  Fax +1 757 864-6134

More information about the Beowulf mailing list