Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a WRT54GL home router and I want requests coming to the router public IP address on port 97 to be redirected to an external IP and port, for example ( and port 80.

The external interface of the router is called vlan1.

I tried iptables -t nat -A PREROUTING -d <router_ip> -i vlan1 -p tcp -m tcp --dport 97 -j DNAT --to-destination, but it doesn't work.

How can I do this? Also, how can I see if this rule is active? iptables -L doesn't seem to list it.

I managed to solve my problem using rinetd on my computer (which is in DMZ) with the following rule in it's config:

# bindaddress bindport connectaddress connectport       97  80

but I would like to do the redirect in the router.

share|improve this question
For iptables, if -t xxx isn't given you will be shown the filter table by default, thus you will need to use iptables -t nat -L to see if it is listed. – DerfK Aug 24 '11 at 22:46

This is a problem by design, supposedly both IPs should use the same gateway IP address which should be the firewall running iptables, I've tried in the past doing exactly the same as you did with the same fail result. You need a reverse rule on that same nat to rewrite the packet again so the origin understands it properly, by sending it to another network this doesn't happen.

The only way to redirect to another external site would be using a bouncer or a proxying engine like squid, varnish or nginx or write your own very short bouncer code in the language of your choice.

share|improve this answer

Your Answer


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.