How To Create VLANs in Proxmox For a Single NIC

Apr 8, 2022 · 3 mins read
How To Create VLANs in Proxmox For a Single NIC

In the video below, we show you how to configure Proxmox to support VLANs on a single NIC


We show you how to re-configure the management interface created during the installation so that it is in your management VLAN

NOTE: Because we are switching to VLANs, the hypervisor will now no longer be accessible. However, connectivity will be restored in the next step so make sure you have the means to modify the network switch attached to the hypervisor

Then we cover how to configure a network switch to support the VLAN tagging that Proxmox will now be doing

Next, we show you how to add additional VLAN interfaces to Proxmox so it can access shared storage for instance

And then how to configure virtual machines to support VLAN tagging

Useful links: https://pve.proxmox.com/wiki/Network_Configuration#_vlan_802_1q

Steps taken

  1. Configure Proxmox
    The default installation creates a dedicated management interface so we need to reconfigure Proxmox with a management VLAN interface instead and make the Linux bridge VLAN aware
    The quickest way is to edit the /etc/network/interfaces
    For example,

    cp /etc/network/interfaces /etc/network/interfaces.bak
    nano /etc/network/interfaces
    auto lo
    iface lo inet loopback
    
    iface enp0s25 inet manual
    
    auto vmbr0.100
    iface vmbr0.100 inet static
    	address 192.168.100.10/24
    	gateway 192.168.100.254
    
    auto vmbr0
    iface vmbr0 inet manual
    	bridge-ports enp0s25
    	bridge-stp off
    	bridge-fd 0
    	bridge-vlan-aware yes
    	bridge-vids 2-4092
    Then we reboot Proxmox to make sure the changes are applied

  2. Configure Switch
    Because Proxmox is now doing VLAN tagging but the network switch is not, we cannot access Proxmox remotely anymore so we need to reconfigure the switch port
    We need to turn the port into a trunk port i.e. one which supports multiple VLANs and set the default, PVID or native VLAN to something unused
    Once this is done, the switch will send VLAN tagged traffic to Proxmox and our connection will be restored

  3. Add VLAN interfaces to Proxmox
    Proxmox will now have a VLAN aware bridge, which means we can add VLAN interfaces to it to give it direct access to a storage VLAN for instance
    To do this select the computer in the left hand pane, navigate to System | Network and from the Create drop down menu select Linux VLAN
    Change the name to match the bridge and VLAN ID, for example for VLAN 200, we’d use vmbr0.200
    Give the interface an IP address and mask, for example, 192.168.200.10/24
    Then click Create
    On the switch, update the port connected to Proxmox to allow this VLAN
    Proxmox should now have access to other computers on your network in this VLAN

  4. Assign VMs to VLANs
    Because Proxmox and the switch are using VLAN tagging, virtual machines will need to support these as well
    For existing virtual machines, select the VM in the left hand pane then select Hardware
    Click on the Network Device then click Edit
    In the VLAN Tag field, enter the VLAN ID then click OK
    On the switch, update the port connected to Proxmox to allow this VLAN if that hasn’t already been done
    You will need to repeat this for any other interfaces the VM has
    For new virtual machines, you can add the VLAN tag as part of the installation process when you get to the Network tab

Sharing is caring!