Using 2 NICS?

Don Holmgren djholm at fnal.gov
Wed Oct 25 12:32:12 PDT 2000


Take a look at the discussion "ARP Bug Report" on fa.linux.net from
October 1999 (easiest way is to use dejanews).  We had run into the
problem you're describing - if you use tcpdump to watch the traffic,
you'll see ARP requests going into your machine with two NIC's, and
replies coming from _both_ NIC's (that is, both NIC's say they service a
given IP).  The order of the replies isn't fixed, so if you watch the
routing table on a machine talking to your 2-NIC box, you'll see the
48-bit ethernet address changing occassionally, in correspondence with
the most recent ARP reply.

The claim is that this behaviour agrees with the governing RFC.  There
was much discussion over whether an IP belongs to a machine (thus
multiple ARP replies are OK), or belongs to an interface (in which only
one ARP reply should occur). 

We have a local patch we apply to the kernel to "fix" this - i.e, make
an IP belong to an interface.  I've attached it below.

Don Holmgren
Fermilab
djholm at fnal.gov
630-840-2745




*** net/ipv4/arp.c.orig Tue Jan  4 12:12:26 2000
--- net/ipv4/arp.c      Tue Jan 25 16:39:51 2000
***************
*** 67,72 ****
--- 67,76 ----
   *                                    now it is in net/core/neighbour.c.
   *            Julian Anastasov:       "hidden" flag: hide the
   *                                    interface and don't reply for it
+  *            Ron Rechenmacher:       IP address belong to interfaces;
+  *                                      I gained knowledge/insight by looking
+  *                                      at Stephen D. WIlliams patch rollup
+  *                                      posted to linux-ha, etc., Oct '99
   */
  
  /* RFC1122 Status:
***************
*** 439,444 ****
--- 443,449 ----
        struct sk_buff *skb;
        struct arphdr *arp;
        unsigned char *arp_ptr;
+       struct device *dev_real; /* The real device this ARP is for, if not dev */
  
        /*
         *      No arp on this interface.
***************
*** 446,451 ****
--- 451,465 ----
        
        if (dev->flags&IFF_NOARP)
                return;
+ 
+ #define CONFIG_IPS_BELONG_TO_INTERFACES
+ #ifdef CONFIG_IPS_BELONG_TO_INTERFACES
+       dev_real = ip_dev_find(src_ip);
+ 
+       if (type == ARPOP_REPLY && dev_real != NULL && dev_real != dev) {
+           return;  /* return if response from other interface */
+       }
+ #endif
  
        /*
         *      Allocate a buffer








On Wed, 25 Oct 2000, Karl Bellve wrote:

> 
> 
> 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
> > 
> 
> Right, this is the way I set it up.
> 
> However, it appears that one of the NICs seems to be used for both IPs.
> I am not sure why this happens. I can disconnect NIC #2 and still ping
> both IPs. If I disconnect NIC #1 and connect NIC #2, I can no longer
> ping either IP. If I use ifconfig -a, it reports correctly. Each NIC has
> its own IP, MAC address, mask, interupt etc. I was told that Linux
> assigns both IPs to the first working NIC card (eth0) when the networks
> are the same.
> 
> > doesn't work?  It would be a terrible change in the semantics of ifconfig
> > if it didn't.  I have done this more than once, but not under RH7.0 or
> > Linux 2.4.  I would be surprised if it were impossible to do now though.
> > 
> > Perhaps what you mean is "the way I have my RedHat machine configured
> > keeps putting both IP addresses on the same card and I don't know how to
> > fix that"?
> > 
> > Rob
> > ---
> > Rob Ross, Mathematics and Computer Science Division, Argonne National Lab
> > 
> > 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.
> 
> -- 
> Cheers,
> 
> 
> 
> Karl Bellve, Ph.D.                   ICQ # 13956200
> Biomedical Imaging Group             TLCA# 7938 		
> University of Massachusetts
> Email: Karl.Bellve at umassmed.edu
> Phone: (508) 856-6514
> Fax:   (508) 856-1840
> PGP Public key: finger kdb at molmed.umassmed.edu
> 
> _______________________________________________
> Beowulf mailing list
> Beowulf at beowulf.org
> http://www.beowulf.org/mailman/listinfo/beowulf
> 






More information about the Beowulf mailing list