[one-users] Virtual machine vlan tagging

Stefan Kooman stefan at bit.nl
Wed Apr 23 23:40:04 PDT 2014


Quoting Neil Schneider (neil at ifxonline.com):
> I'm running OpenNebula in a virtual machine using openvswitch to connect
> the machines. I've tried creating a virtual network in libvirt attached to
> the  bridge device then attached to it. I tried configuring with the
> network interfaces connected directly to the bridge. I keep running into a
> problem, where the virtual machine wants to add it's own tag to the
> interface. I've been googling 'till I'm blue in the face and I can't seem
> to find why vlan tags are getting attached to the devices without me
> configuring them and it's ignoring any vlan tags I try to impose. Here's
> what ovs-vsctl shows me.
> 
> ovs-vsctl show
> c6def17d-2cc6-499e-a461-af4fe9aab78a
>     Bridge management
>         Port "veth1_one"
>             tag: 1
>             Interface "veth1_one"
>         Port management
>             Interface management
>                 type: internal
>         Port "vlan10"
>             tag: 10
>             Interface "vlan10"
>                 type: internal
>     Bridge storage
>         Port storage
>             Interface storage
>                 type: internal
>         Port "vlan20"
>             tag: 20
>             Interface "vlan20"
>                 type: internal
>         Port "veth2_one"
>             tag: 2
>             Interface "veth2_one"
>     Bridge public
>         Port "vnet0"
>             Interface "vnet0"
>         Port "veth3_one"
>             Interface "veth3_one"
>         Port "em1"
>             Interface "em1"
>         Port public
>             Interface public
>                 type: internal
>     ovs_version: "2.1.0"
> 
> veth1_one and veth2_one are interfaces on the virtual machine. Notice the
> tags. I have that configured no where and I can't seem to find where it's
> coming from. Of course it keeps the virtual machines from communicating.
> The interface that has no vlan associated with it works as expected. It's
> the two other interfaces designated management and storage that I'm having
> issues with.
> 
> I sure could use some help finding why this is happening. I don't mind
> having vlan tags associated, but I want to determine what they are.

I would do this a little bit different. Instead of handling virtual
networking yourselve, let libvirt do it for you. I attached
"management.xml" and "storage.xml" livirt virtual networking
definitions. You can enable them like this: "virsh net-define
/path/to/definition.xml". management is in vlan 10, storage in vlan 20.
Start the networks: virsh net-start management, virsh net-start storage.
And let's make them auto-started: virsh net-autostart management, virsh
net-autostart storage. 

Know in your vm definition do the following (virsh edit vm_name):

Example for managment interface:

<interface type='bridge'>
      <mac address='52:54:00:99:7b:d8'/>
     <source network='management' portgroup='vlan10'/>
      <virtualport type='openvswitch'>
      </virtualport>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

For storage interface:

Example for storage interface:

<interface type='bridge'>
      <mac address='52:54:00:99:7b:d9'/>
     <source network='storage' portgroup='vlan20'/>
      <virtualport type='openvswitch'>
      </virtualport>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

You should know have your virtual interfaces in the right network with
the right vlan tag.

Gr. Stefan

-- 
| BIT BV  http://www.bit.nl/        Kamer van Koophandel 09090351
| GPG: 0xD14839C6                   +31 318 648 688 / info at bit.nl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: management.xml
Type: application/xml
Size: 229 bytes
Desc: not available
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20140424/27014ad5/attachment-0004.xml>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: storage.xml
Type: application/xml
Size: 222 bytes
Desc: not available
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20140424/27014ad5/attachment-0005.xml>


More information about the Users mailing list