How do I assign multiple vlans to a VM?

Hi

I have a problem in networking in my Proxmox v8. I use multiple VMBRs for each vlan because I want to easy selection vlan for users. When I bind vmbr450 for VM and configure network all works fine but when I want to bind vmbr0 to another VM and configure VM's network in vlan450 using vmbr0 communication doesn't work. I need use vmbr0 in particular cases and configure inside VM vlans but in this configuration PVE networking don't work fine when I use vmbr0. I want to set this up in a way that the virtual machine can receive tagged frames using vmbr0 (where the VLAN is configured internally) – something like a trunk connection. However, other virtual machines should also be able to use VLANs directly, with incoming frames being untagged by that VLAN. The end users use interfaces vmbr (i.e. vmbr450) which are connected with specified vlans. Disable or enable vlan aware it's change nothing.

Anyone could help me in my problem? Below slice of /etc/network/interfaces:

Code:
auto eth6
iface eth6 inet manual
    mtu 9000

auto eth7
iface eth7 inet manual
    mtu 9000

auto bond0
iface bond0 inet manual
    bond-slaves eth6 eth7
    bond-miimon 100
    bond-mode active-backup
    bond-primary eth6
    mtu 9000

auto vmbr0
iface vmbr0 inet static
    address X.X.X.X/X
    gateway X.X.X.X
    bridge-ports bond0
    bridge-stp off
    bridge-fd 0
    bridge-vlan-aware yes
    bridge-vids 2-4094
    mtu 9000

auto vmbr450
iface vmbr450 inet manual
    bridge-ports vlan450
    bridge-stp off
    bridge-fd 0
    mtu 9000
 
auto vlan450
iface vlan450 inet manual
    mtu 9000
    vlan-raw-device bond0

In summary, I aim to achieve a state where the interfaces consist of vmbr0, directly connected to bond0, handling all traffic, and VLAN interfaces, also associated with bond0, receiving frames with specific tags. Based on the VLAN interfaces, VMBR interfaces are created, for example, for VLAN 450, there is vmbr450.

On vm with vlan interfaces inside (when configure networking inside VM's communication doesn't work - vlan450): :
1712222272626.png
On another vm, when vmbr450 is connected directly (when configure networking inside VM's communication works fine):
1712222299088.png

Regards
Tom
 
Last edited:
Hi,
I'm using proxmox 9.2.2 with the following setup and it passes through all vlan tags transparently to the VM:
  • Uplink port to Network Gear (trunk) mapped to Vlan aware Linux Bridge
  • uncheck "firewall" on the VMNic which is mapped to that bridge
  • with the firewall it didn't work, vlan tags got stripped. (I guess has to do with how proxmox uses veth pairs to insert the FW)
on proxmox host linux that resulted in:
Code:
# brctl show
bridge name     bridge id               STP enabled     interfaces
nic0_vl100              8000.9ca9b8aaf98c       no              nic0
                                                        tap101i1
                                                       
# ip -d link show nic0
2: nic0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master nic0_vl100 state UP mode DEFAULT group default qlen 1000
    link/ether 9c:a9:b8:aa:f9:8c brd ff:ff:ff:ff:ff:ff promiscuity 1 allmulti 1 minmtu 68 maxmtu 9000
    bridge_slave state forwarding priority 32 cost 100 hairpin off guard off root_block off fastleave off learning on flood on port_id 0x8001 port_no 0x1 designated_port 32769 designated_cost 0 designated_bridge 8000.9c:a9:b8:aa:f9:8c designated_root 8000.9c:a9:b8:aa:f9:8c hold_timer    0.00 message_age_timer    0.00 forward_delay_timer    0.00 topology_change_ack 0 config_pending 0 proxy_arp off proxy_arp_wifi off mcast_router 1 mcast_fast_leave off mcast_flood on bcast_flood on mcast_to_unicast off neigh_suppress off neigh_vlan_suppress off group_fwd_mask 0 group_fwd_mask_str 0x0 vlan_tunnel off isolated off locked off mab off addrgenmode eui64 numtxqueues 256 numrxqueues 256 gso_max_size 65536 gso_max_segs 65535 tso_max_size 65536 tso_max_segs 65535 gro_max_size 65536 gso_ipv4_max_size 65536 gro_ipv4_max_size 65536 parentbus pci parentdev 0000:10:00.0
    altname enp16s0f0
    altname enx9ca9b8aaf98c
# ip -d link show tap101i1
50: tap101i1: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc fq_codel master nic0_vl100 state UNKNOWN mode DEFAULT group default qlen 1000
    link/ether f6:ba:ec:61:1b:df brd ff:ff:ff:ff:ff:ff promiscuity 2 allmulti 1 minmtu 68 maxmtu 65521
    tun type tap pi off vnet_hdr on persist off
    bridge_slave state forwarding priority 32 cost 2 hairpin off guard off root_block off fastleave off learning on flood on port_id 0x8002 port_no 0x2 designated_port 32770 designated_cost 0 designated_bridge 8000.9c:a9:b8:aa:f9:8c designated_root 8000.9c:a9:b8:aa:f9:8c hold_timer    0.00 message_age_timer    0.00 forward_delay_timer    0.00 topology_change_ack 0 config_pending 0 proxy_arp off proxy_arp_wifi off mcast_router 1 mcast_fast_leave off mcast_flood on bcast_flood on mcast_to_unicast off neigh_suppress off neigh_vlan_suppress off group_fwd_mask 0 group_fwd_mask_str 0x0 vlan_tunnel off isolated off locked off mab off addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 tso_max_size 65536 tso_max_segs 65535 gro_max_size 65536 gso_ipv4_max_size 65536 gro_ipv4_max_size 65536
root@dcv-ucs-c220m8-23-pxm:~#

Proxmox host network settings:

Screenshot 2026-11-18 145923.png

VM Adapter settings:

1795010755157.png


1795010750666.png

on my linux vm (here i'm pinging with private vlan, ingressing on VM with tag 101 and egress 100, doing ingress vlan translation via tc ) :
Code:
testvm1:~$ sudo tcpdump -nei ens19
14:08:02.237487 00:22:bd:f8:19:ff > bc:24:11:bb:36:68, ethertype 802.1Q (0x8100), length 102: vlan 101, p 5, ethertype IPv4 (0x0800), 10.0.0.1 > 10.0.0.11: ICMP echo request, id 11777, seq 512, length 64
14:08:02.237508 bc:24:11:bb:36:68 > 00:22:bd:f8:19:ff, ethertype 802.1Q (0x8100), length 102: vlan 100, p 0, ethertype IPv4 (0x0800), 10.0.0.11 > 10.0.0.1: ICMP echo reply, id 11777, seq 512, length 64

testvm1:~$ ip a
4: ens19: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether bc:24:11:bb:36:68 brd ff:ff:ff:ff:ff:ff
    altname enp0s19
    altname enxbc2411bb3668
5: vlan100@ens19: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether bc:24:11:bb:36:68 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.11/24 scope global vlan100
       valid_lft forever preferred_lft forever
    inet6 fe80::be24:11ff:febb:3668/64 scope link proto kernel_ll 
       valid_lft forever preferred_lft forever

Cheers
 
Last edited:
with the firewall it didn't work, vlan tags got stripped. (I guess has to do with how proxmox uses veth pairs to insert the FW)
..and this is what you want. If you would have all VLAN at all VMs at all the time you will not have network security at all. I cannot advice to do this in production.