Useful Dual WAN script
I've been struggling for a while on getting a dual WAN config to work for me...
Basically this script is an dhclient-exit-hooks script that will hook into the dhclient-script which then is ran by dhclient. Anyway what it does, is it takes care of all of the routing table and iptable stuff required to have two DMZ, one off each wan IP address, anyway I'm going to present the script below in hopes that someone else out there would have some use for this script also. Code:
#!/bin/sh [edit1]: I just corrected an small oops with the script, sometime it won't setup the iptable upon bootup, and most of upon a bootup the exit script gets a preinit then bound/renew $reason so i fixed it to force the iptable to be updated when it gets an preinit $reason |
Hmmm! Thank you for the input. But how do I use it?
Regards, Glenn |
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...
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 :) |
Thank you AntiMatter.
Very nice. Glenn. |
help required
I am wanting to use this script, but lacking basics to begin with.
I have 2 ISP (1 ASDL Modem and other is a PPPoE) and wanting to make use of them on a load sharing and failover basis. To do this... I am wanting to buy a Atom PC and have an additional NIC. i am wanting to make this system as Dual WAN router. Additionally i have a 5 port switch and a wireless router to have this shared to the rest of the computers at home. i do understand little bit of networking, but need some help... The reason why i want to do this... Load balancing Failover (in case 1 ISP fails depend on the other) and make this as the gateway for the rest of the computer for internet access |
Load balancing
Quote:
Please create a new thread with your question to give it the visibility it deserves. networking forum. suggested title 'Load balancing' My knowledge and memory are limited. Regards Glenn |
All times are GMT -5. The time now is 05:32 PM. |