[fedora-virt] VLAN Bridging

Laine Stump laine at laine.org
Wed Feb 4 20:38:25 UTC 2015


On 02/04/2015 03:05 PM, Dan Mossor wrote:
> How do I connect a VM to a tagged VLAN?
>
> I am building a host machine that has a bonded interface (bond0) that
> is in turn my bridge interface (bridge0). The bond is connected to a
> trunk port on the switch containing tagged vlans. I want to be able to
> connect the VMs I'm building to one (or more) of the VLANs on this
> trunk port.
>
> All I can find in the documentation is an obscure reference to a
> 'type' modifier for the API [0]
>
> Does libvirt support this natively, or will I need to decipher the
> arcane world of OVS to make it work as I desire?

You imply that your bridge is an OVS bridge. If that is the case, then
libvirt does support vlan tagging of traffic transparent to the guest.
Look at the documentation for the <vlan> tag in
https://www.libvirt.org/formatnetwork.html

You can set the vlan tag for all guests connecting to a particular
network by putting a <vlan> element in the toplevel of the network
definition, for different groups of guests by putting <vlan> in multiple
<portgroup>s and assigning the guests to a portgroup, or you can set it
individually for each guest by adding a <vlan> element to the guest's
<interface> in the domain definition.

If you aren't using an OVS bridge, but are instead using a standard
Linux host bridge, you can have the traffic of all guests on the bridge
tagged for a single vlan by creating a vlan interface off of your bond
on the host, and attaching that vlan interface to the bridge rather than
the bond interface itself.


>
> [0] http://wiki.libvirt.org/page/Features/virSimple#Guest_Creation



More information about the virt mailing list