How do I pass VLAN traffic over a bridge to KVM VM's

12,023

In the host interface, configure a separate interface for each VLAN.

Since the physical interface is connected to a trunk port, all VLANs should be tagged.

So, on the host, you need to configure emo1.1 and emo1.2 interfaces, which correspond to VLAN 1 and VLAN 2 on the physical interface.

Then you create a bridge for the VMs, and add emo1.2 as a bridge member.

After that, you configure emo0.1 for the host connectivity.

The emo0 interface should be up, but it must not have any IP address configured.

You also need to make sure that the 8021q module is loaded so that the kernel has VLAN support.

Share:
12,023

Related videos on Youtube

Jonathan Dotson
Author by

Jonathan Dotson

Updated on September 18, 2022

Comments

  • Jonathan Dotson
    Jonathan Dotson almost 2 years

    I have a KVM host that I would like on VLAN 1 and I would like the VM's to use VLAN 2. emo1 on the host is bridged with br0 and the physical interface is connected to a trunk port on a Cisco switch. The issue is most things I have found on the web are conflicting/old or didn't work for me.

    I am running Centos 7. What would be the easiest way to tag the guests with a different VLAN than the host?

    Thanks!

  • Jonathan Dotson
    Jonathan Dotson about 7 years
    I tried this but for some reason the sub interfaces wouldn't come up. I got an error that said "No suitable device found for this connection.". The way I set it up was emo1 had no address, emo1.1 had an ip, emo.2 had no ip and was bridged with br0 which did have an ip. I think for now I'll just make it work by using a different physical NIC but it does bother my that I couldn't make it work. Thanks again for the help, I'm sure I just did something wrong.
  • Tero Kilkanen
    Tero Kilkanen about 7 years
    I forgot to mention that one needs the VLAN kernel module, 8021q in order to have support for VLAN interfaces.