Friday 6 May 2011

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 61.16.130.97 dev eth0
 
# route add default gw 200.15.110.90 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 seconds 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.

No comments:

Post a Comment