Is it possible to reconfigure one of the LAN ports on a WRT54GL (running Tomato firmware) to act as a second WAN port?

I have the following networks:

  • PPOE connection to ADSL modem (works fine on the normal WAN port)
  • WiFi neighbourhood network (in 178.X.X.X range), via a Mikrotik routerboard

which I'd like to put on the WAN side of the router. I'd then like to set up routing so than some traffic (172.X.X.X) is routed to the Mikrotik and the rest to the ADSL modem.

p.s. for practical reasons, I can't use the Mikrotik as the firewall/router.

Edit: It seems this can be done by editing iptables, can someone tell me exactly how?

  • Isn't that a 2 port router with a switch on the LAN side? – Matt Simmons Feb 2 '10 at 4:46

You would need to re-flash the firmware with something like DD-WRT which can get you full access to the underlying Linux OS. From there you can configure the iptables, etc. to do whatever you wish on the different interfaces.

You will need a firm understanding of Linux routing, this is not for the casual end-user.

The main page for the DD-WRT project is http://www.dd-wrt.com

| improve this answer | |
  • I'm already running Tomato, added that detail to my question. So it's just a matter of iptables? Could you expand your answer? – pufferfish Oct 1 '09 at 11:35
  • 1
    The only difference between a WAN port and a local port are the firewall rules. Generally speaking the WAN port has all inbound traffic denied unless it is associated with an action initiated from inside your network. You then open up individual ports for forarding, etc. You could do the same with one of the other ports and then it is in essence a WAN port. I am not familiar with Tomato, but you could just list out the rules from iptables and configure another port the same as the current WAN port and then add the static routes. – Kevin K Oct 1 '09 at 13:45
  • "The only difference between a WAN port and a local port are the firewall rules." Not true. The WAN port and the Lan ports are on different vlans. – Justin Feb 2 '10 at 3:50

Designating one of your "Lan" ports to be connected to the neighborhood wifi network shouldn't be too difficult if you use a firmware that gives you access to the underlying IP stack, such as DD-WRT. However...

I'd then like to set up routing so than some traffic is routed to ADSL, and the rest to the Mikrotik.

This is the tricky part—What you want to set up is called multirouting. It can distribute your traffic onto both upstream connections, but with about a bazillion caveats. I wrote a blog post about this in 2004, but it's mostly still relevant today. An excerpt:

Since it’s fundamentally impossible to route each packet individually when NAT is involved, the best that we can do is to route each session individually. This way, we ensure that all packets from a given session use the same connection.

If you have a lot of different sessions originating from your local network, then you'll achieve a good balance over both Internet connections. If round-robin allocation isn't what you want, you could also define which types of traffic go out which Internet connection based on the TCP/UDP port.

| improve this answer | |
  • Thanks Luke... added details about the range I want to route to Mikrotik – pufferfish Oct 10 '09 at 13:42

Instructions for setting up load balancing under dd-wrt are at: http://www.dd-wrt.com/wiki/index.php/Dual-WAN_for_simple_round-robin_load_equalization

However load balancing is usually profoundly dissapointing.

| improve this answer | |

If you don't need to apply any firewall rules for the second network, then you don't even need iptables, just a static route like..

ip route add via

where is the address assigned to the lan interface on the Mikrotik device.

according to http://en.wikibooks.org/wiki/Tomato_(firmware)/Menu_Reference#Advanced there is some Advanced -> Routing menu that lets you add static routes.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.