As configured, you can't control which of those gateways is used from the dd-wrt router. That decision has to be made by the upstream router (of course, w/ the dd-wrt router NAT'd over its WAN by default, that's problematic). All the dd-wrt router can do is choose among gateways defined within its own IP network (192.168.3.x) or directly accessible on the router itself (e.g., an OpenVPN client, or even an EoIP tunnel).
It requires JFFS be available and enabled. Go to a shell (telnet/ssh) and copy/paste the script into the window, and it will create the necessary wanup script, then reboot. It will get executed immediately after the WAN is (re)initialized.
It assumes the current default gateway is 192.168.1.1. It works by copying the main routing table to an alternate table, w/o changes. All the source IPs you listed are then routed to that secondary table. The main routing table is modified w/ overrides that change the default gateway to 192.168.1.88 for all other source IPs.
For debugging purposes, it writes to the syslog so you can verify it ran and produced no errors.
Code:
cat /var/log/messages | grep alt-gtwy
Once working, you can disable debug mode.
If you want/need to fine tune it, there should be enough there to at least get you started.
Since the script is messing w/ the routing system, there's always the risk it could mess it up so badly it can't be rebooted, and will require a factory reset. For those reasons, MAKE SURE YOU HAVE A BACKUP OF THE CONFIG! That way you can easily recover using that backup.
I updated the script to support reentrancy. Because the router often calls the WAN up script several times before (re)initialization is complete, and the script runs asynchronously to the WAN up event, you can end up w/ several instances of the script running at the same time, and therefore there's an ever so slight chance one could clobber the other w/o serialization.
Thanks for the script. Much appreciated and will give it a whirl. Just a few questions
1) I see from the script it assume the alt gateway is 192.168.1.88 (And I assume the other gateway is set from the DD-WRT Gateway portion in the setup/WAN Connection Type.
And I am right to assume all will default to 192.168.1.88 and only those 10 ips to 192.168.1.1 (which is set at the router side) or does it need to be flipped
2) you mentioned JFFS2 needs to be enabled. Am I right to assume it administration/management/JFFS2 support and enable JFFS2
1) I see from the script it assume the alt gateway is 192.168.1.88 (And I assume the other gateway is set from the DD-WRT Gateway portion in the setup/WAN Connection Type.
And I am right to assume all will default to 192.168.1.88 and only those 10 ips to 192.168.1.1 (which is set at the router side) or does it need to be flipped
It works as you describe, now and originally. It takes the main routing table (which presumably is pointing to 192.168.1.1, you never said specifically, but seemed highly likely) and copies it, in toto, to the alternate routing table. The main routing table is then modified w/ overrides to change its default gateway to 192.168.1.88. Any source IP in the list uses the alternate routing table as its default gateway (i.e., 192.168.1.1). Everything else uses the main routing table (i.e., 192.168.1.88 ).
Quote:
2) you mentioned JFFS2 needs to be enabled. Am I right to assume it administration/management/JFFS2 support and enable JFFS2
Yes.
icecold546 wrote:
oh btw I only have 30mb on the JFFS2. Do i need to mount a USB drive to increase that?
Just last question. So if DHCP additional adds clients are they not on 192.168.1.88 or is the script setup to dynamically change all routing as it comes in unless its those specified?