[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Second Net interface on Qube1

[I'm not subscribed, CC me if you want me to read it]

On Thu, 24 Mar 2005, Jim Cheetham wrote:

> >No, it's a configuration error.  I'm not a network expert, but I did
> >the same once and I was told you cannot have two devices on a machine
> >which are in the same sub-net (or have the same broadcast address or
> >whatever).
> I hope you've confused this with something else - having multiple NICs 
> with same-subnet (e.g. adjacent) IP addresses is normal practice in many 
> environments. In fact, having multiple aliased interfaces works too 
> (i.e. eth0, eth0:0, eth0:1 and so on)

Sure, you can have multiple network cards on the same physical lan, but
it doesn't really help much.  Since Linux does arp replies for any of
its addresses on any interface it's more or less random which network
card "wins".

So if you have both eth0 and eth1 on the same lan, configured to be in
the same logical network, then you should be able to get packets to both
addresses with a cable plugged in into only one of the cards (you may
have to wait for the arp cache on the "client" to get updated).  Use
tcpdump on the server to check if you have incoming packets.

Of course nothing guarantees that replies to packets coming in on ethN
get sent out via ethN - check your routing table, it's what linux looks
at to determine where to send out packets.  If you have 2 routes for with the same metric then it's not really well defined
which route wins - probably the one that was added earlier/later, but
don't count on it to stay that way.

That perfectly explains what the OP is seeing.

JFTR, the arp_filter setting (/proc/sys/net.. [1]) does not help you in
this case either, since you have the same logical network on both

> The situation could get more confused in environments where it's easy to 
> rewrite MAC addresses, like with Sun equipment. But otherwise, ARP will 
> resolve the situation happily.

I don't really get what you're saying, but anyway: I'm not aware of any
network cards that won't let you change your mac address.  ifconfig <if>
hw ether <mac> while the interface is down.

1.: $kernelsource/Documentation/networking/ip-sysctl.txt:
| arp_filter - BOOLEAN
|         1 - Allows you to have multiple network interfaces on the same
|         subnet, and have the ARPs for each interface be answered
|         based on whether or not the kernel would route a packet from
|         the ARP'd IP out that interface (therefore you must use source
|         based routing for this to work). In other words it allows control
|         of which cards (usually 1) will respond to an arp request.
|         0 - (default) The kernel can respond to arp requests with addresses
|         from other interfaces. This may seem wrong but it usually makes
|         sense, because it increases the chance of successful communication.
|         IP addresses are owned by the complete host on Linux, not by
|         particular interfaces. Only for more complex setups like load-
|         balancing, does this behaviour cause problems.
|         arp_filter for the interface will be enabled if at least one of
|         conf/{all,interface}/arp_filter is set to TRUE,
|         it will be disabled otherwise

 PGP signed and encrypted  |  .''`.  ** Debian GNU/Linux **
    messages preferred.    | : :' :      The  universal
                           | `. `'      Operating System
 http://www.palfrader.org/ |   `-    http://www.debian.org/

Reply to: