FOPENP

Proxmox: make go a VM on Internet

Proxmox™ is an enterprise-level virtualization system. It supports CephFS and live migration. Its own configuration is rather simple, but there are some difficult steps for a newbie.

One of these difficult steps is make the Proxmox virtual machines go to the Internet. In my setup I have a Proxmox with two network cards: enp0s3 for connecting to the web, and vmbr0 that's connected to a LAN switch.

In this case, changing the network is not enough. You also need to insert an iptables rule. Iptables is the Linux™ firewall.

Supposing that the gateway's network (which routes through Internet) is 10.5.0.0/24, local network is 192.168.56.0/24 and the guest system has received 192.168.56.123 as IP address, you need to execute the following commands (as root) inside Proxmox (the host, not the guest):

echo 1 > /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv4/conf/all/proxy_arp
iptables -t nat -A POSTROUTING -s 192.168.56.123 -o enp0s3 -j MASQUERADE

Example

In order to test the configuration, you can execute into the guest:

wget -O /dev/stdout google.com

If no timeout errors are printed, the web page has been downloaded and you can proceed to upgrade the guest system.

2023
Dec, 19