Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

hi in gateway base on linux how can redirect all internet accesses to port 80 in gateway. (any internet request redirect to port 80 in gateway).

can do this by iptables? or any other idea?

share|improve this question

Why do you want to do this? It seems like a fundamentally bad idea. It would go against every known standard of expected operation that exists.

That said, you could do this using the PREROUTING chain in iptables. These rules will work for the following assumptions:

  • eth0 is your public interface
  • You only need TCP redirected
  • Your public IP address is
  • You only want to redirect ports 1 through 65535


iptables -t nat -A PREROUTING -i eth0 -p tcp --dst --dport 1:65535 -j REDIRECT --to-port 80
share|improve this answer
He may just mean all http traffic redirected to the gateway. – Steven Feb 15 '11 at 3:44
looks like mikrotik hotspot, i want to redirect all internet request to a local webserver. – hamedsh Feb 16 '11 at 9:58

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.