I'm having an incredibly hard time creating a basic router on Debian which has connections to two ISPs where the ip addresses are dynamic. I don't need bonding, I really just need some way to detect when WAN1 goes down and automatically failover to WAN2 (or reverse)
I have seen a lot of documentation on how to do this when you have static IPs/Gateways but not if IPs/Gateways are set via DHCP.
I don't really have any code to show, but in general it would start with something like this, I'm assuming:
/etc/network/interface
#loopback,etc
#LAN
auto eth0
iface eth0 inet static
address 192.168.1.1
netmast 255.255.255.0
network 192.168.1.255
#WAN1 / ISP1
auto eth3
iface eth3 inet dhcp
up #add iptables/nat/routing?
down #??
#WAN2 / ISP2
auto eth4
iface eth4 inet dhcp
up #add iptables/nat/routing?
down #???
Thank you for any help, or pointers!
Best Answer
One solution would be to make a script that does the following:
The above can be accomplished with a simple shell script.