-1

I have a server with Proxmox OS installed and some virtual machines inside.

Following a guide found on the web i modified my /etc/network/interfaces like shown below to create a virutal interface named vmbr0:0.

Then I connected the virtual to the real adapter through this command

iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o vmbr0 -j MASQUERADE 

Everything works fine until I tryed to forward the port 80 to my apache VM with this command

iptables -t nat -A PREROUTING -i vmbr0 -p tcp -m tcp --dport 80 -j DNAT --to-destination 10.0.0.2:80

The Apache VM has the 10.0.0.2 IP, it pings correctly the web and apache works great from the web, but apt-get is no more working giving all 404 errors on every source unless I disable the PREROUTING rule.

How can I do to solve this issue?? Thank you to all in advance

Here the /etc/network/interfaces file

# This file describes the network interfaces available on your system

# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

iface eth0 inet manual

iface eth1 inet manual

auto vmbr0
iface vmbr0 inet static
    address MY_PUBLIC_IP_ADDRESS
    netmask 255.255.255.0
    gateway MY_GATEWAY
    bridge_ports eth0
    bridge_stp off
    bridge_fd 0

auto vmbr0:0
iface vmbr0:0 inet static
        address 10.0.0.1
        netmask 255.255.255.0
        network 10.0.0.0
        broadcast 10.0.0.255

1 Answers1

1

try to be more precise with your prerouting rule by adding --daddr MY_PUBLIC_IP_ADDRESS option

apt-get uses http and you basicly DNAT all of his requests to your apache VM with this prerouting rule

andrew sp
  • 11
  • 3