Please excuse the long description here, but I think it's worth explaining the setup before asking the question:
I have 2 usb Ethernet devices connected to my machine (debian) which configure themselves through avahi with 169.254.x.x addresses.
Connected to the other side of each usb ethernet device is a ssh host (
host2 is connected via its device I can ssh to to host1.local or host2.local fine.
When both are connected I can only connect to
host2.local (I get host unknown/unreachable and similar messages)
If I run
I see that both interfaces are up and have IP addresses
If I run
ip route show
I see that there are two matching routes setup as follows
169.254.0.0/16 dev eth0 scope link src 169.254.3.232 metric 212 169.254.0.0/16 dev eth1 scope link src 169.254.79.120 metric 213
So I think what's happening here is that one of these routes is picking up all traffic in the zeroconf range and sending it to one of the devices, meaning that when both are plugged in only one responds as the traffic is only right for host at the end of that device.
To test this I try deleting the route to the device that is working to allow the other route to take over and send traffic to the other device BUT all variants of the route delete command I've tried seem to do nothing, the route stays in place.
Instead, if I run this the route to
host1 is connected to) does go (get deleted) along with all other settings for the device (such as ip, which is expected).
host1.local stops responding and
host2.local starts responding where it wasn't before proving the theory.
ip addr flush dev eth0
So my solution is then to try and delete these auto-created generic routes that are trumping everything, and to put in more specific routes to the devices (I should add each host does have a fixed IP).
So something like
ip route add 169.254.102.0/24 dev eth0 ip route add 169.254.116.0/24 dev eth1
ip route add 169.254.102.23/32 dev eth0 ip route add 169.254.116.74/32 dev eth1
BUT this doesn't quite work as doing
ip addr flush as a way of forcing the route to be removed is too harsh - the routes go in but the interfaces are very much down due to being flushed.
So my question(s) are:
Why might all variants of
ip route delNOT remove the bad routes?
Is there another way of removing routes other than using the
How else might I solve this problem:
Would bridging the interfaces so they work somewhat like a loadbalancer make more sense as a solution?
Have I totally missed something else I should try in order to make routing more specific (maybe in terms of how zeroconf/avahi sets up these connections)?