Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.networking > #2723

Route caches and multiple default routes

From David Brown <david.brown@hesbynett.no>
Newsgroups comp.os.linux.networking
Subject Route caches and multiple default routes
Date 2014-02-14 21:19 +0100
Organization A noiseless patient Spider
Message-ID <ldltpb$26r$1@dont-email.me> (permalink)

Show all headers | View raw


I am trying to understand a bit about the route caches in a failover 
networking setup.

Roughly speaking, I have two network cards eth0 and eth1, on two 
different networks.  Each has a default route, but with different metrics.

So "route -n" gives something like this:

estination     Gateway         Genmask         Flags Metric Ref  Use Iface
192.168.0.0     0.0.0.0         255.255.255.0   U     1      0   0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     1      0   0 eth1
0.0.0.0         192.168.0.1     0.0.0.0         UG    10     0   0 eth0
0.0.0.0         192.168.2.1     0.0.0.0         UG    20     0   0 eth0


traceroute 8.8.4.4 shows the routing uses eth0 by default, as the metric 
is lower, and "ip route get 8.8.4.4" confirms it:

ip route get 8.8.4.4
8.8.4.4 via 192.168.0.1 dev eth0  src 192.168.0.160
     cache  mtu 1500 advmss 1460 hoplimit 64


If I now unplug eth0, but keep the interface up (alternatively, 
disconnect the router on eth0), then I can no longer access 8.8.4.4. 
"ip route get" and "ip route show cache" confirm that the cached route 
is still via eth0.  "ping 8.8.4.4" gives "Destination Host Unreachable".

If I use "ip route flush cache", and then try "ip route get" again, the 
highest metric (lowest value) route is tried first, and fails, and then 
the next default route - via eth1 - succeeds.  So the route via eth1 
gets put in the cache, and stays there.

If I bring eth0 online again, the cached route via eth1 is still there - 
I need to flush the cache again to make it try eth0 (with the highest 
priority metric).


I am trying to figure some way to make this all work automatically.  If 
the highest priority default route fails, I would like the cached route 
to be dropped and the next default route tried - without having to 
manually issue a flush.  And I would also like cached routes to have a 
timeout, so that after a while the higher priority default route will be 
tried again.


Any ideas or hints would be much appreciated.

David

Back to comp.os.linux.networking | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Route caches and multiple default routes David Brown <david.brown@hesbynett.no> - 2014-02-14 21:19 +0100
  Re: Route caches and multiple default routes Andrew Gideon <c182driver9@gideon.org> - 2014-02-26 14:24 +0000

csiph-web