eth0 and eth1
Martin A. Brown
mabrown-dell at securepipe.com
Wed Jun 23 12:12:00 CDT 2004
: ifcfg-eth0 file contents:
: ifcfg-eth1 file contents:
: Right now, I have one network cable connecting eth1 to a switch. But I
: can ping EITHER IP address or ssh to either IP address and I get
: connected through eth1 (I know this since it's the only one plugged
It looks like RH config files....but the ideas should be the same
regardless of your distro. If you look at your routing table, you'll
probably see that the route to 192.168.1.0/24 is via eth1.
The reason you can hit both IPs is because the kernel will send an ARP
reply for any locally hosted IP on any interface (by default) with kernel
2.4 unless you are using the arp_filter and/or hidden sysctls. 
: If I pull the cable out, the console displays:
: E100: eth1 NIC Link is Down
: Then if I plug it into eth0, nothing happens. I get no console message,
: can't ping the machine (on either IP), etc. If I plug it back in to
: eth1, I get:
Interesting....I'd expect you to see the driver report link. What happens
when you ask the card if it has link with mii-tool (or mii-diag)?
: E100: eth1 NIC Link is Up 100 Mbps Full duplex
: And everything works again - at least for THAT adapter.
: Is this just routing related since they are both on the local
: 192.168.1.* network? Or is my config off?
If you want to get the "intuitive" behaviour where an IP is only reachable
when that particular NIC is plugged in, you'll need to solve two problems.
- the ARP reply problem (Linux replies for all locally hosted IPs)
- the route problem (select an outbound interface based on the source IP)
The latter problem can be solved using "ip rule" and multiple routing
tables.  I know I have written up how to do this before for the LARTC
mailing list, so you might search for "ip rule" in that archive. 
While I can't be sure that this will solve all of your problems, it should
give you a start on making the box do what you want.
Martin A. Brown --- SecurePipe, Inc. --- mabrown at securepipe.com
More information about the Linux-PowerEdge