This setup does not use NAT (or NAPT). It uses true ip forwarding. What this means is that every other router (i.e. wireless access points, adsl modems, DMZ firewalls, etc…) needs to have routes configured to each subnet in your local network.
Let me reiterate. You MUST configure your adsl modems to have routes through the new Linux router to your local network subnet. If you don’t do this your adsl modems will not know where to send packets when responding to data requests. The routes should use the IP of your new router as the next hop / gateway.
Please make sure you understand the above.
In Ubuntu ip forwarding is not turned on by default. You turn it on by editing /etc/sysctl.conf, uncomment the line:
If you are using IPv6 then you can uncomment the line for IPv6 forwarding as well.
As mentioned above Ubuntu does not use iproute2 for its normal networking. This means we need to write custom scripts to use iproute2 when the networking devices are activated and deactivated. These scripts then get placed in /etc/networking/if-up.d and /etc/network/if-down.d (I think it’s pretty obvious which one goes where).
In the next section we examine these two scripts. Breifly though note that different commands are issued for each interface. The $IFACE variable is set to the device name if your devices are different make sure you change the if conditions. I’ve used the table name MyTable (as above) change this to the name you used.