I have a Linux based device with two NICs:
NIC1 eth0: 192.168.1.100/24; Gateway: 192.168.1.1
NIC2 eth1: 192.168.1.101/24; Gateway not set
This device communicates with an Application Server (IP: 10.1.1.1). The application logic associates the device with both its IPs therefore reaching the device with its primary IP or if this fails switching to secondary. This is supposed to provide redundancy at device NIC level. I cannot use bonding here as the server is expecting the device to have 2 IP addresses.
In case of no further configuration, if I unplug NIC1 the device can no longer communicates with the server, this is expected as NIC2 has no gateway associated.
If however I add a static route to the server network via NIC2 and the routing table would be
Destination Gateway Genmask Int 0.0.0.0 192.168.1.1 255.255.255.0 eth0 192.168.1.0 0.0.0.0 255.255.255.0 eth0 10.1.1.0 192.168.1.1 255.255.255.0 eth1
I'm expecting the following behaviour
- when both NICs are connected, server is reached via eth1 due to more specific route
- if only NIC1 is unplugged, server is reached via eth1 due to the static route
- if only NIC2 is unplugged, static route should disappear from routing table and server should be reached via eth0 due to default gateway
1 and 2 happen as expected. Instead, when NIC2 is unplugged, the server cannot be reached.
Why? If I put NIC1 and NIC2 on differnet subnets, point 3 doesn't fail i.e. whatever cable I unplug, the device is always reachable on the other NIC. What's the technical reason preventing this from happening when both NICs are set on the same subnet?
I gave a look at ARP flux issue which seems to be more a problem at application level, but this is not the case here. ARP flux doesn't seem preventing hosts communication, so wouldn't explain why pinging NIC1 fails when NIC2 is unplugged.