[RndTbl] Enabling Linux failover routing

John Lange john.lange at open-it.ca
Tue May 10 23:44:15 CDT 2005

Ok, here is how to enable failover routing in Linux in 3 lines.


Enabling failover routing

After you have configured your network, the next step is to enable
failover routing on your Linux box, so that if the first route dies the
router will automatically switch over to the next route. To do so,
you'll need to add the default gateway routes provided to you by your
ISPs for both your network cards:

# route add default gw dev eth0

# route add default gw dev eth1

Finally, modify the /proc/sys/net/ipv4/route/gc_timeout file. This file
contains a numerical value that denotes the time in seconds after which
the kernel declares a route to be inactive and automatically switches to
the other route if available. Change its default value of 300 to some
smaller value, say 10 or 15. Save the changes and exit. 

# echo "10" > /proc/sys/net/ipv4/route/gc_timeout

Now your Linux machine is ready to serve as a failover router,
automatically and quickly switching to the secondary route every time
the primary route fails. 

John Lange
President OpenIT ltd. www.Open-IT.ca (204) 885 0872
VoIP, Web services, Linux Consulting, Server Co-Location

More information about the Roundtable mailing list