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

centos 5.x

I'm wondering how I can forward "all" ports incoming to a eth0:alias IP to a specific internal IP address.

I have found ways to-do this for particular ports, but I wish to forward every port.

Can someone point me in the right direction please!


share|improve this question

Hi I believe this step by step how to should be what you need.

You want to go with NAT instead of PAT.

share|improve this answer

Pablo is absolutely right, but I might as well provide a sample line here, which assumes your eth0:alias address is and your internal IP of choice is

iptables -t nat -A PREROUTING  -p tcp -i eth0 -d -j DNAT --to-destination

If you want UDP as well, either have a second line for udp or just remove -p tcp.

This answer is no substitute for reading and understanding a good HOWTO, but it gives you some idea of where to start looking.

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.