How to configure the network on Proxmox VE 6.4-7.4 virtual machines on dedicated servers

These instructions are suitable for Proxmox VE versions 6.4 and 7.4.

When creating a virtual machine, you need to select a bridge interface to which the virtual machine's network port will be connected. If two network ports are required, the second one can be added via the web interface: HardwareAddNetwork device. Then, you can configure IP addresses and the gateway on the respective interfaces within the virtual machine.

For example, configure the alias IP on the interface connected to vmbr1 along with the corresponding default route, while the private IP and routes are configured on the interface connected to vmbr0.

Ubuntu 20.04-22.04

An IP address from the server's additional public network is used for the public network. One of the free IPs from the main private network is used for the private network. The interface ens18 is created during VM deployment; ens19 is added via the web interface.

/etc/netplan/00-installer-config.yaml

network:
  ethernets:
    ens18:
      dhcp4: false
      addresses:
      - $IP/$NETMASK
      routes:
        - to: 0.0.0.0/0
          via: $PUBLIC_GW
          on-link: true
      nameservers:
        addresses:
        - $DNS_SERVERS
    ens19:
      dhcp4: false
      addresses:
      - $PRIVATE_IP/$NETMASK
      routes:
        - to: 10.0.0.0/8
          via: $PRIVATE_GW
        - to: 192.168.0.0/16
          via: $PRIVATE_GW
        - to: 188.42.208.0/21
          via: $PRIVATE_GW
      nameservers:
        addresses:
        - $DNS_SERVERS
  version: 2

Where:

  • $IP – any available IP address in the range assigned to the dedicated server (can also be an alias IP)
  • $NETMASK – the subnet mask (can be /32 if configuring an alias IP)
  • $PRIVATE_IP – the private IP address available to the dedicated server
  • $PUBLIC_GW – the IP address of the gateway in the public network
  • $PRIVATE_GW – the IP address of the gateway in the private network
  • $DNS_SERVERS – DNS servers available to the dedicated server (e.g., 192.168.8.8)

Debian 11-12

The interface ens18 is created during VM deployment; ens19 is added via the web interface.

/etc/network/interfaces

source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback

/etc/network/interfaces.d/ens18

auto ens18
iface ens18 inet static
address $PUBLIC_ADDITIONAL_IP/$NETMASK
gateway $GW_OF_THE_ADDITIONAL_NETWORK

/etc/network/interfaces.d/ens19

auto ens19
iface ens19 inet static
address $PRIVATE_ADDITIONAL_IP/$NETMASK
post-up /sbin/ip route add 10.0.0.0/8 via $GW_OF_THE_ADDITIONAL_NETWORK dev ens19
post-up /sbin/ip route add 192.168.0.0/16 via $GW_OF_THE_ADDITIONAL_NETWORK dev ens19
post-up /sbin/ip route add 188.42.208.0/21 via $GW_OF_THE_ADDITIONAL_NETWORK dev ens19

Where:

  • $PUBLIC_ADDITIONAL_IP – any available public IP address of the additional network
  • $PRIVATE_ADDITIONAL_IP – any available private IP address of the additional network
  • $GW_OF_THE_ADDITIONAL_NETWORK – the IP address of the gateway in the additional network

AlmaLinux / CentOS 8 Stream

The interface ens18 is created during VM deployment; ens19 is added via the web interface.

/etc/sysconfig/network-scripts/ifcfg-ens18

TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
NAME=ens18
DEVICE=ens18
ONBOOT=yes
IPADDR=$PUBLIC_IP
NETMASK=255.255.255.248
GATEWAY=$PUBLIC_GW
ETHTOOL_OPTIONS="-K ens18 tx off tso off"

/etc/sysconfig/network-scripts/ifcfg-ens19

TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=no
NAME=ens19
DEVICE=ens19
ONBOOT=yes
ETHTOOL_OPTIONS="-K ens19 tx off tso off"
IPADDR=$PRIVATE_IP
NETMASK=255.255.255.248

/etc/sysconfig/network-scripts/route-ens19

10.0.0.0/8 via $PRIVATE_GW dev ens19
192.168.0.0/16 via $PRIVATE_GW dev ens19
188.42.208.0/21 via $PRIVATE_GW dev ens19

Where:

  • $PRIVATE_IP – the private IP address available to the dedicated server
  • $PUBLIC_IP – the public IP address available to the dedicated server
  • $PUBLIC_GW – the IP address of the gateway in the public network
  • $PRIVATE_GW – the IP address of the gateway in the private network

On this page