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 use ESX4.1 (vmware vsphere4) and I have one Public IP (X.X.X.X) in vswif0 and ( in vswif1 and 2 virtual machines with local IP ( and (

I want to use iptables firewall to redirect all iconming traffic to x.x.x.x:80 to and x.x.x.x:3306 to

Could any body help me!

Thank you

share|improve this question

You need the following iptables commands:

iptables -A PREROUTING -d x.x.x.x -p tcp --dport 80 -j DNAT --to-destination
iptables -A PREROUTING -d x.x.x.x -p tcp --dport 3306 -j DNAT --to-destination

You need to make sure IP forwarding is enabled and the traffic is allowed in filter table.

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.