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 strange problem and i cannot find a solution. So first, here is my config; i have got an ESXI with public IP :, i host a virtual Ubuntu server with one NIC (configured in my esxi) eth0 with public IP, and i have plugged a virutal nic eth0:0 with public IP Here is my /etc/network/interfaces:

auto eth0
allow-hotplug eth0
iface eth0 inet static
        post-up route add dev eth0
        post-up route add default gw
        post-down route del dev eth0
        post-down route del default gw

auto eth0:0
allow-hotplug eth0:0
iface eth0:0 inet static

So far so good, its work. I can both ping and Now i want to be redirect to

So i have made a PAT with iptables like this:

iptables -t nat -A PREROUTING -i eth0:0 -p tcp --dport 443 -j DNAT --to-destination :8777

but when i do telnet it failed. So i have tried

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 7778 -j DNAT --to-destination :22

And telnet works fine. So my guess is that it come from the "add route" in my interfaces files but i am not sure.

Any ideas? thanks

share|improve this question
up vote 0 down vote accepted

Solution had been found here: iptables: IP alias and port forwarding So i must not use DNAT like:

iptables -t nat -A PREROUTING -i eth0:0 -p tcp --dport 443 -j DNAT --to-destination :8777


iptables -t nat -A PREROUTING -i eth0 -d -p tcp --dport 443 -j REDIRECT --to 8777

That's it!

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.