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

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

2 Answers 2

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

http://www.howtoforge.com/nat_iptables

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 1.2.3.5 and your internal IP of choice is 10.1.1.2:

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

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

 
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.