2

I'm having an issue wrapping my head around a setup. We currently use vmware+vsphere and switching to kvm.

So we want the similar type setup using openvswitch. So our setup will be like

kvm host ip: 10.130.1.11

Then we have vlans like

lb: 10.130.2.0/24
web: 10.130.3.0/24

So we want to have a kvm host have both lb and web vms on it. I don't want to give a bridged interface an ip for each vlan we attach to the host. I want a setup like what vmware does where their switch just seems to route traffic to the vms and the vms are tagging their own traffic.

Any pointers or tips would be great.. thanks!

Mike
  • 21,910
  • 7
  • 55
  • 79
  • we use vsphere like we would kvm. No shared storage.. its really just a central location to manage. which we are paying 10k for a license we hardly use. – Mike Jul 01 '14 at 13:38

2 Answers2

2

There are multiple ways to achieve your setup, but I am going to add one of the recommended ones. Use openvswitch

Openvswitch is a multilayer virtual switch, its designed to enable network automation (from its source site)

http://openvswitch.org/download/ (thats where you download the package)

I had referred below tutorials for installing and setting up openvswitch

http://blog.scottlowe.org/2012/08/17/installing-kvm-and-open-vswitch-on-ubuntu/

or

https://n40lab.wordpress.com/2015/06/28/centos-7-installing-openvswitch-2-3-2-lts/

If the VM Host has its interfaces on trunk mode, then you can do the following.

You can setup a single OV bridge (of course this would have an IP, and of the untagged/native vlan).

Then you might want to setup VIRSH Network. Something like this

<network>
<name>ovs-network2</name>
<forward mode='bridge'/>
<bridge name='br0'/>
<virtualport type='openvswitch'/>
<portgroup name='vlan-a'>
    <vlan>
      <tag id='1'/> 
    </vlan>
   </portgroup>
   <portgroup name='vlan-b' default='yes'>
   </portgroup>
 </network>

In my above example, vlan-a is for tagged traffic, and vlan-b is untagged

Once you define/start virsh network, you might want to change XML settings for your VM, in the following order

<interface type='network'>
  <mac address='blah blah'/>
  <source network='ovs-network2' portgroup='vlan-a'/>
</inteface>

You might have other settings in it too like virtio, addresstype

The above example might help you in avoiding multiple IP addresses for each tagged vlan bridge. Here are some great references to look at.

http://blog.scottlowe.org/2012/11/07/using-vlans-with-ovs-and-libvirt/

And here is another article that does a similar setup

https://www.netflask.net/transparent-vlan-tagging-libvirt-ovs/

I hope this helps! :)

tw1stud
  • 31
  • 5
0

Are you using libvirt here? If so, the documentation has an example on doing this: http://libvirt.org/formatnetwork.html#elementVlanTag

devicenull
  • 5,572
  • 1
  • 25
  • 31