This week I configured a network with two routers and multiple subnets using
DD-WRT. This article explains how I did it. This following graphics represent
the physical topology of the network.
For this setup I bought two router TL-WR941ND.
First step is to replace the stock firmware by a DD-WRT firmware. It took me a while to find the appropriate firmware version of this device. I find DD-WRT's web site a bit chaotic to find the right firmware.. The database present on the main page is most of the time outdated and the forum is a nightmare to search.
At the time of writing this post, a working firmware for this device is available at this link. Download the factory-to-ddwrt.bin file and update both routers with it.
Next step is to configure the routers. I recommend to connect a single computer in the LAN interface to proceed with the configuration.
{% highlight sh %}
iptables -t nat -I POSTROUTING -o get_wanface
-j SNAT --to nvram get wan_ipaddr
Click the the "Run Commands" button. Then click "Save Firewall" to let the router remember about it on the next reboot.
{% highlight sh %} iptables -I FORWARD -j ACCEPT
Click the the "Run Commands" button. Then click "Save Firewall" to let the router remember about it on the next reboot.
Last step is to connect the routers together and test the communication between the two subnets and check if both of them has access to Internet. Notice, you may not have access to router2 web interface from the first subnet if you didn't enable the remote management in Administration > Management > Remote Access.