Technical

Assign Multiple VLANs to a Proxmox VM: Tagged NICs vs a Trunk

Assign Multiple VLANs to a Proxmox VM: Tagged NICs vs a Trunk

Assigning multiple VLANs to a Proxmox VM comes down to two setups: several tagged virtual NICs, one per VLAN, or one untagged NIC on a VLAN-aware bridge with 802.1q tagging inside the guest. Both work, but which one you pick depends on the guest OS and your switch.

Close-up photo of coiled orange and black electrical wires on a wooden utility pole against a gray sky.

Option 1: Multiple tagged virtual NICs

Add a separate virtual NIC for each VLAN. In the VM’s hardware tab, set the bridge to vmbr0 (or whatever your VLAN-aware bridge is) and put the VLAN tag in the VLAN field. Do this for each VLAN the VM needs.

# Example: VM with NICs on VLAN 10 and VLAN 20
qm set 100 --net0 virtio,bridge=vmbr0,tag=10
qm set 100 --net1 virtio,bridge=vmbr0,tag=20

The guest sees two separate interfaces, each already untagged. No VLAN config needed inside the guest. This is the simplest setup for most Linux and Windows VMs, and it keeps the guest’s network config dead simple. The downside: you burn a virtual NIC per VLAN, and some guests have a limit on how many NICs they can handle cleanly.

Close-up image of ethernet cables plugged into a network switch, showcasing IT infrastructure.

Option 2: One trunk NIC, tag inside the guest

Create one virtual NIC on a VLAN-aware bridge and leave the VLAN field empty. Then inside the guest, create VLAN subinterfaces for each VLAN you need.

# Proxmox side: one NIC, no tag
qm set 100 --net0 virtio,bridge=vmbr0

Inside a Linux guest, you’d do something like:

# Guest side: VLAN subinterfaces
ip link add link eth0 name eth0.10 type vlan id 10
ip link add link eth0 name eth0.20 type vlan id 20
ip link set eth0.10 up
ip link set eth0.20 up

This is the way to go if the guest OS handles 802.1q well — most Linux distros do, and so do BSDs. It also scales better if you have a ton of VLANs. But Windows guests are a pain here: VLAN tagging support is spotty depending on the driver, and you’ll often end up fighting the NIC properties instead of just adding a second virtual NIC.

Which one should you pick?

If the guest is Windows or you want zero VLAN config inside the guest, use multiple tagged NICs. If the guest is Linux or BSD and you’re comfortable with VLAN subinterfaces, one trunk NIC is cleaner and uses fewer virtual NICs. For most homelab stuff, I’d just add a tagged NIC per VLAN — it’s less to troubleshoot when something breaks.

One more thing: make sure your bridge is actually VLAN-aware. If you haven’t enabled it, check the bridge settings on the host. And if you’re messing with LXC containers instead of VMs, the setup is different — see this post for a related gotcha.

Leave a comment

Comments are reviewed before they appear. Your email is never published.