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 web server running on my server on port 7000. I want it to be accessible on port 80. I've read that this could be easily done with iptables port forwarding. What would the correct command would be to achieve that?


share|improve this question
It my be easier/better just to change your webserver config. Do you use apache? – Antonius Bloch Feb 4 '11 at 17:40
up vote 3 down vote accepted

Iptables command:

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 7000

Change eth0 to your external interface name.

share|improve this answer
what about POSTROUTING and FORWARD chains ? its not true what You have wrote... – Dlugi Sep 4 '12 at 10:54

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.