Basically this script makes a few assumption: You have dual WAN, Both of the WAN uses DHCP to get their IP address, the DHCP client is "dhclient"
Anyway how to use it, you copy the script and paste it into a file named "dhclient-exit-hooks" which is a file that dhclient-script will call everytime it finishes an step, aka PREINIT, BIND, EXPIRE, TIMEOUT, etc...
Anyway it depends on your distro on where you place the script at, for OpenBSD it would probably go into "/etc" then for gentoo, it would go into "/etc/dhcp" and it just depends.
This script takes care of removing and setting up the routing table and NAT rules for both WAN, and on how to config it below is an list of the various functions that may need to be changed to adapt it to your own needs...
- set_wan0 - This route sets up the routing table for the wan0
- unset_wan0 - This route removes/clear up the routing table for wan0
- set_wan1 - This route sets up the routing table for wan1
- unset_wan1 - This route removes/clear the routing table for wan0
- iptable_wan0 - This route sets up the NAT for iptables for wan0
- iptable_wan1 - This route sets up the NAT for iptables for wan0
Then the two parameters at the top of the scripts would be: wan0="eth0" & wan1="eth1", these are your wan0 and wan1 interface.
I hope this clears it up enough so its useful for someone