Table of Contents
Redundant Routers
The virtual router is implented using the keepalived(8) package from the Keepalive project. Keepalived can do a lot of thingd but I only use the VRRP (Virtual Redundant Router Protocal) part of the package.
Nounours is the chosen master router since it has the best connection to the Internet. Gate-rpi is then the backup router. Configuration is done following the guidelines on the ArchLinux Wiki.
The switch between master and backup is only done when the backup has a higher priority than the (previous) master. If Nounours goes down this happens automatically, but mishaps further 'up' in the system,e.g fiber break, cable break etc, are not detected ny Nounours. The dilemma is solved by using the monitoring capablilties of keepalived. In this case I use the 'Track script' facility where I let a script ping the upstream router every so often and when/if the upstream router doesn't reply the router enters the fault state. See the configuration file for details.
Here are the configurations files. On both routers they may be found at /etc/keepalive/keepelive.conf.
Master Router (Nounours)
global_defs { notification_email { bent@oz6bl.dk } notification_email_from keepalived@nounours.oz6bl.dk smtp_server localhost smtp_connect_timeout 30 router_id ROUTER1 script_user bent enable_script_security
} vrrp_script keepalived_check { script "/usr/local/bin/keepalived_check.sh" interval 1 timeout 5 rise 3 fall 3 } vrrp_instance NET19 { state MASTER interface br0 virtual_router_id 19 priority 10 advert_int 1 authentication { auth_type PASS auth_pass verysec } virtual_ipaddress { 192.168.19.254 } } track_script { keepalived_check } notify "/usr/local/bin/keepalived_notify.sh"
Backup Router (Gate-rpi)
global_defs { notification_email { bent@oz6bl.dk } notification_email_from keepalived@gate-rpi.oz6bl.dk smtp_server localhost smtp_connect_timeout 30 router_id ROUTER44 } vrrp_instance NET19 { state BACKUP interface eth0 virtual_router_id 19 priority 5 advert_int 1 authentication { auth_type PASS auth_pass verysec } virtual_ipaddress { 192.168.19.254 } }