Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

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

4 Answers 4

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

share|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.

share|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.

share|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 172.16.0.0/24 via 192.168.0.3

where 192.168.0.3 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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