On Wed, 11 May 2005, John Lange wrote:
What do you base this on? Google turns up plenty of references to the gc_timeout method of failover but none are specific on what they mean by "when a route dies".
Poke around net/ipv4/route.c. The gc_timeout parameter is a garbage collection timer for clearing out the routing table. The only place the routing table timers seem to be played with are in that file... Every so often the value is decremented, and if it goes down to zero it's wiped out.
http://mailman.ds9a.nl/pipermail/lartc/2002q4/005296.html
seems to be a good explanation of the various garbage collection parameters.
I can't think of any reason why the kernel would care if the route timed out because the link was down or because the route was down for some other reason.
It's not if the kernel cares, it's how the kernel knows. The only thing specified in a route is the prefix and the next hop.
route add default gw 1.1.1.1 route add default gw 2.2.2.2 metric 10
Given no exchange of routing information between the peers, the only thing the kernel has to go in is the link status of the next hop interfaces, which is also in the routing table.
For instance, unplug your cable modem from the coax side. Check your routing table, the 0.0.0.0 route should still have the "U" flag, meaning the route is active.
A more concrete example (edited slightly for brevity)
Here look at 172.16.20/24, out interface vmnet8.
[root@bob root]# netstat -rn Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 172.16.20.0 0.0.0.0 255.255.255.0 U 0 0 0 vmnet8 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
The U flag means the route is up and viable. I'll shut down int vmnet8, and watch the route go away.
[root@bob root]# ifconfig vmnet8 down; route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.1.0 * 255.255.255.0 U 0 0 0 eth0 default poochie.ertw0.0.0.0 UG 0 0 0 eth0
Route's gone, because the next hop is gone. Bring back up the interface.
[root@bob root]# ifconfig vmnet8 up; route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 172.16.20.0 * 255.255.255.0 U 0 0 0 vmnet8 192.168.1.0 * 255.255.255.0 U 0 0 0 eth0 default poochie.ertw0.0.0.0 UG 0 0 0 eth0
Route's back.
It all comes down to "How CAN the kernel know a route is down". The only information it has is the outgoing interface status.
That said, Bill brought up the idea of ARP tables. This has two problems:
1 - If the link is idle for a while, the arp cache will clear, and be seen as a failure 2 - There are lots of layer 2 networks that don't use ARP. The ethernet code is separate from the ipv4 code.
In addition, this is a common problems on hardware routers. Even a box that's specifically designed to be a router can't do it without resorting to ICMP tests and policy routing.
Sean