[fedora-virt] KVM VMs and vlans

Dale Bewley dlbewley at lib.ucdavis.edu
Mon Aug 17 03:35:07 UTC 2009


On Thu, 2009-08-13 at 15:49 -0400, m3freak at thesandhufamily.ca wrote:
> Hello All,
> 
> I need to use VLAN tags for a couple of KVM VMs and the KVM host.  However,
> I'm unsure if I should create all of the vlan tagged interfaces on the host
> side (and then use two of those interface in the VMs), or if I should only
> tag the VM interfaces in the VMs themselves (and tag host NIC for the
> host's use).  In either case, I've assumed the host NIC should be
> configured as a bridge device.
> 
> What's the best/right way to do this?

I terminate the 802.1q trunk at the host, and create bridges from each
VLAN interface. These bridges are what is used by the guests. They can
of course optionally have an IP address for use by the host.

For example

host# cat ifcfg-vlan6
DEVICE=eth0.6
BRIDGE=br6
VLAN=yes
ONBOOT=yes
BOOTPROTO=none

host# cat ifcfg-br6
DEVICE=br6
TYPE=Bridge
BOOTPROTO=dhcp
ONBOOT=yes

host# virsh dumpxml 12 |grep bridge
    <interface type='bridge'>
      <source bridge='br6'/>
      <script path='vif-bridge'/>

See 
http://www.libvirt.org/formatdomain.html#elementsNICS
http://wiki.libvirt.org/page/Networking#Fedora.2FRHEL_Bridging




More information about the Fedora-virt mailing list