Super User is a question and answer site for computer enthusiasts and power users. 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

This quote should explain me how to do this, but I don't get it...

Next, I had added following rules to forward all http requests (coming to port 80) to the Squid server port 3128 :

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


iptables -t nat -A PREROUTING -i venet0 -p tcp --dport 80 -j DNAT --to
iptables -t nat -A PREROUTING -i venet0:0 -p tcp --dport 80 -j REDIRECT --to-port 3128

This should work, but it doesn't. My iptables are empty and the /etc/network/interface is the following:

auto lo
iface lo inet loopback
    up ip route replace dev lo
# Auto generated venet0 interfaces
auto venet0
iface venet0 inet static
    up route add default dev venet0
iface venet0 inet6 static
    address ::2
    netmask 128
    up ip -6 r a default dev venet0
    up ip addr add {...externalIPv6...} dev venet0
auto venet0:0
iface venet0:0 inet static
    address {...externalIP...}
share|improve this question
You sure the interfaces exist at all when you apply the rules? what is the output of ifconfig? – Braiam Dec 7 '13 at 21:07

I'll start this as an answer, event though it is not (yet, hopefully). The reason I do this is that I believe this problem will require several iterations to be ironed out.

You iptables rules look ok to me, but your /etc/network/interfaces file has several issues, in my opinion. Did you copy it from somewhere, or did you adapt it to your needs?

The issues I see:

  1. Why specify the loopback interface? Normally, the first two lines of the stanza are ok.
  2. You are assigning two addresses to the same interface, venet0.
  3. netmask for first venet0 stanza is too restrictive, and is inconsistent with broadcast address.
  4. Your second stanza for venet0 has two addresses assigned to it, your external IPv6 address, and ::2.
  5. In the stanza for venet0, the netmask is way too restrictive.
  6. The very same interface, venet0/venet0:0, has both loopback and external addresses assigned to it, what is the point?

It would be helpful if you told us what you are trying to do with VMWare, right now I am at a loss.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .