NAT Interface Configuration
NAT (Network Address Translation) configuration refers to the process of modifying the source or destination IP address of packets as they pass through a router or firewall. This is typically done to manage the mapping of private IP addresses to public IP addresses, allowing devices on a local network (with private IPs) to access the internet using a shared public IP address.
We will now proceed further installing NAT interface on proxmox, By default we just have only one interface vmbr0
which is bridged into the physical NIC.

Creating a new Linux Bridge to act as a NAT in our proxmox server

We will name the new linux bridge as vmnet0
and enter the desired network range into it and create the network interface.

Once the network configuration is applied we will make some config changes in the proxmox shell to enter the forwarding configuration in the network config file.
nano /etc/network/interfaces
We will delete any default config of the newly created interface vmnet0
and add the following configuration and exit saving the file.
auto lo
iface lo inet loopback
iface ens32 inet manual
iface ens34 inet manual
auto vmbr0
iface vmbr0 inet static
address 3.3.3.77/24
gateway 3.3.3.1
bridge-ports ens32
bridge-stp off
bridge-fd 0
auto vmnet0
iface vmnet0 inet static
address 192.168.100.1/24
bridge-ports none
bridge-stp off
bridge-fd 0
## NAT CONFIG
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up iptables -t nat -A POSTROUTING -s '192.168.100.0/24' -o vmbr0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '192.168.100.0/24' -o vmbr0 -j MASQUERADE
source /etc/network/interfaces.d/*
One config is done we will restrat the networking config and try to assign the interface to VM and check the network IP Allocation & Internet Access.
systemctl restart networking
VM Network Testing


If we are planning to install or run any website or web applications servers on the NAT network then we will have to map this port to the local proxmox instance to make it accessible via the bridged virtual machines.
# iptables -t nat -A PREROUTING -p tcp -d 3.3.3.77 --dport 7070 -i vmbr0 -j DNAT --to-destination 192.168.100.50:80
iptables -t nat -A PREROUTING -p tcp -d <proxmox-ip> --dport <port> -i vmbr0 -j DNAT --to-destination <NAT-IP>:<port>
This will enable the access of web server on the local IP address via port NAT.
Last updated