Using 2 NICS?
josip at icase.edu
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 192.168.1.1
> # ifconfig eth1 192.168.1.2
> 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 192.168.1.3 dev eth1
/sbin/route add -host 192.168.1.4 dev eth0
/sbin/route add -host 192.168.1.5 dev eth1
/sbin/route add -host 192.168.1.6 dev eth0
# continue for all subnet hosts...
# Pick broadcast interface (eth0 chosen, eth1 won't broadcast)
/sbin/route add -host 192.168.1.255 dev eth0
/sbin/route del -net 192.168.1.0 netmask 255.255.255.0 dev eth1
# Required by DHCP protocol (eth0 chosen, eth1 won't broadcast)
/sbin/route add -host 255.255.255.255 dev eth0
# Required by NTP broadcast (also see route man page)
/sbin/route add -net 220.127.116.11 netmask 240.0.0.0 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.edu
ICASE, Mail Stop 132C PGP key at http://www.icase.edu./~josip/
NASA Langley Research Center mailto:j.loncaric at larc.nasa.gov
Hampton, VA 23681-2199, USA Tel. +1 757 864-2192 Fax +1 757 864-6134
More information about the Beowulf