0

What exactly do I need to configure on Ubuntu18-based QEMU/KVM server to pass a trunk with >1 VLANs to a VM on it? (basically the equivalent of setting VLAN ID to 4095 on a port with ESXi) Some rather complex examples of reportedly achieving that by means of 1 main and >1 aux bridges that I've seen so far don't look optimal at a glance... unless it's the only feasible way with KVM. Many thanks in advance!

dandreye
  • 11
  • 2
  • 6
  • I don't know how you manage this in qemu/kvm 's configuration (which is actually most probably [libvirt](https://libvirt.org/) managing qemu/kvm), but here are two Q/A where I made an answer about low level commands to manage VLANs on a **VLAN-aware bridge**: https://unix.stackexchange.com/questions/546136/bridged-interfaces-and-vlan-tags , https://unix.stackexchange.com/questions/556735/linux-vlan-aware-bridges-and-trunk-ports (see the note at the end about VLAN ID 4095) – A.B Apr 01 '21 at 07:49
  • See also: https://libvirt.org/formatnetwork.html#elementVlanTag (requires openvswitch instead of standard bridge) – A.B Apr 01 '21 at 08:04
  • Many thanks @A.B : let me read it all and try it here. – dandreye Apr 01 '21 at 15:16

1 Answers1

0

To my surprise the following config on the KVM server's trunk interface was enough - we didn't even have do anything to make this new bridge VLAN aware, such as defining any VLANs on it or setting vlan_filtering=1:

brctl addbr br2
brctl addif br2 enp94s0f0

(we later added enp94s0f0 and br2 into our netplan config to make it permanent)

Placing VM's NIC into br2 turns it into a trunk with as many VLANs as defined at the VM itself and the switch that KVM server's enp94s0f0 connects to.

dandreye
  • 11
  • 2
  • 6
  • Never mind. I'll delete my comment. If you're fine with your settings, that's fine. – A.B Apr 12 '21 at 14:36
  • @A.B : And I've just deleted mine in turn as it looked orphaned w/o yours preceding it. Thanks for the warning about the same MAC on >1 interface anyway: will keep it in mind in case we ever see any weird behaviour. I was just trying to understand exact use case where that same MAC would have to be to cause those issues as we normally have only 1 trunk per VM here. – dandreye Apr 13 '21 at 11:17