Tag Archives: VM

Running Proxmox with NAT

The default proxmox installation only supports basic NAT function with limited capabilities.

In order to create a working internal network you need to define a new network manually

Add the following entry to /etc/network/interfaces

vmbr0 is the WAN interface, if you use a different interface change it accordingly.


auto vmbr1
iface vmbr1 inet static
address  10.0.0.1
netmask  255.255.255.0
bridge_ports none
bridge_stp off
bridge_fd 0


post-up echo 1 > /proc/sys/net/ipv4/ip_forward


post-up iptables -t nat -A POSTROUTING -s '10.0.0.0/24' -o vmbr0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '10.0.0.0/24' -o vmbr0 -j MASQUERADE

 

And add port forwarding rules like this:

post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 222 -j DNAT --to 10.0.0.100:22
post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 222 -j DNAT --to 10.0.0.100:22

 

Apply the settings with:
/etc/init.d/networking restart