How do I assign multiple vlans to a VM?

emptness

Member
Aug 19, 2022
100
6
18
Hello everyone!
How can I forward multiple vlans to a VM guest OS?
I could not find this information in the documentation (((
It is easy to configure 1 vids for the network interface in proxmox, in the tag settings for the VM nic.
But I need to be able to register multiple vlans on one network interface in the guest OS.
Help please.
 
You can do this from the command line, with qm, eg
Code:
qm set 100 -net1 "virtio=CA:85:82:35:28:62,bridge=vmbr0,trunks=10-20;30"
Will pass VLAN from 10 to 20, and also 30 on the nic net1 of the guest with ID 100
Thanks for the answer!
This looks like what I need!
And do I need to enable the "vlan aware" option on the bridge interface of the hypervisor?
After the configuration you suggested, should I register these vlans on the network interface of the guest OS in a standard way?
 
Yes, vmbr0 should be vlan aware. And once done, you can configure standard VLAN in the guest OS (I'm using it on PfSense and OPNSense to handle tens of isolated zones, with a single interface)
 
  • Like
Reactions: emptness
1) enable vlan-aware on bridge
2) don't set any vlan tag on the vm nic options on proxmox side

3) tag vlans inside your vm guest os. (eth0.X for example)

here all vlans should be sent to the vm

4) if you want to filter vlans allowed to enter to the vm, use the ",trunks=..." option
 
  • Like
Reactions: flames and emptness
Yes, vmbr0 should be vlan aware. And once done, you can configure standard VLAN in the guest OS (I'm using it on PfSense and OPNSense to handle tens of isolated zones, with a single interface)
Unfortunately, it didn't work. Tell me, should vlan interfaces be registered in proxmox settings?
1689080245638.png
 
Last edited:
Yes, my bridge is visible in proxmox network settings (although I configured it manually in /etc/network/interfaces). There's nothing particular to do. If it doesn't work, you'll have to investigate (tcpdump at various levels to see where the communication is lost)
 
be sure you have the lines

bridge-vlan-aware yes
bridge-vids 2-4094

in your /etc/network/interface on proxmox for the bridge you use

then you can try tu put the vlan tag (one or more) in the network configuratin in your VM and do not use tag on OS of the VM
 
the switch is configured to accept all vlan you need?
bridge-vlan-aware yes
bridge-vid 2-4094
is in the configuration.
Vlans are configured on the switch.
When I turn on the vlan aware on bridge and turn on the firewall, and turn off the firewall on VM settings, then the network on the VM disappears even with the registered tag vlan.
vlans inside the guest OS also don't work(
 
Humm, I do not know, mabe you can configure 2 or more vlan on proxmox and see 2 or more network on your VM?
That's what I'd like to understand. Do I need to register VLAN Linux interfaces in the hypervisor network settings so that the VM guest OS sees the vlan using vlan aware?
1689146038487.png
 
Then it's some kind of Proxmox failure.
When vlan_aware is disabled on the bridge, the tag assignment on the VM interface works.
1689166247352.png

If vlan_aware is enabled, the network is lost. And even if i remove the tag and configure the vlan in the guest OS, nothing works either.

I have a firewall enabled on the cluster in datacenter and the rules for access to the hypervisor and to some VMs are configured. Can this affect the vlan configuration?
 
1. You can select vlan_aware on the vmbr interface on the PVE (no tag on the fisical interface) , then you can create one or more vmbr interface to your vm with the vlan tag you need.(this work for you, right?)
Or

You can also make linux vlan on the pve and then create vmbr bridge with this linux vlan. In this case the vlan_aware must be deselected.
then You can also create e bond with the vmbr with differet vlan and use this bond on your vm

i.e.: Your VM must see all the interfaces you have configured. No vlan comfiguration is needed on the VM OS.
 
1. You can select vlan_aware on the vmbr interface on the PVE (no tag on the fisical interface) , then you can create one or more vmbr interface to your vm with the vlan tag you need.(this work for you, right?)
Or

You can also make linux vlan on the pve and then create vmbr bridge with this linux vlan. In this case the vlan_aware must be deselected.
then You can also create e bond with the vmbr with differet vlan and use this bond on your vm

i.e.: Your VM must see all the interfaces you have configured. No vlan comfiguration is needed on the VM OS.
In the first case, will I be able to configure multiple vlans inside the guest OS?
Or will I also have to create multiple virtual NICs on the VM?
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!