Consider this diagram:
We assume each host is running Debian Linux (except the routers). The real IP of the host is to be substituted where you see A.B.C.D in the examples.
Install Quagga on each host with the commands:
apt-get update
apt-get install quagga iproute
Put the following in /etc/network/interfaces:
auto lo iface lo inet loopback up ip addr add dev lo A.B.C.D/32 scope global # notice that we use `manual' rather than `static', so that we can # over-ride the scope parameter auto eth0 iface eth0 inet manual up ip link set dev eth0 up up ip addr add dev eth0 192.168.1.10/24 scope link auto eth1 iface eth1 inet manual up ip link set dev eth1 up up ip addr add dev eth1 192.168.2.10/24 scope link
Now put the following in /etc/quagga/zebra.conf:
hostname www1
password changeme
enable password changeme
interface lo
ip address 127.0.0.1/8
ip address A.B.C.D/32 (this is your server's real IP)
interface eth0
ip address 192.168.1.10/24
multicast
interface eth1
ip address 192.168.2.10/24
multicast
!log file /var/log/quagga/zebra.log
This is /etc/quagga/ospfd.conf
hostname www1 password changeme enable password changeme interface eth0 no ip ospf authentication-key ip ospf hello-interval 2 ip ospf dead-interval 5 interface eth1 no ip ospf authentication-key ip ospf hello-interval 2 ip ospf dead-interval 5 router ospf ospf router-id A.B.C.D network 192.168.1.0/24 area 0 network 192.168.2.0/24 area 0 !log file /var/log/quagga/ospfd.log
Modify /etc/quagga/daemons.conf: set zebra=yes and ospfd=yes
Once configured, reboot your host.
Type ip route and you should see a list of routes showing multiple default gateways.
Try unplugging one of the routers - then check the routing table on one of the servers. After 5 seconds, the references to the unplugged router should be gone from the routing tables.
iptables --insert INPUT -s 192.168.0.0/16 --protocol ospf -j ACCEPT