Just switched from a plain linux bridge to Open vSwitch.
Installation & Initial Setup
The installation is as simple as issuing
apt-get install openvswitch-switch on the console. The documentation states that e.g.
ex 1: A standalone bridge. allow-ovs br0 iface br0 inet static address 192.168.1.1 netmask 255.255.255.0 ovs_type OVSBridge ex 2: A bridge with one port. allow-ovs br0 iface br0 inet dhcp ovs_type OVSBridge ovs_ports eth0 allow-br0 eth0 iface eth0 inet manual ovs_bridge br0 ovs_type OVSPort
Should work. So I configured:
allow-ovs ovsbr0 iface ovsbr0 inet static address x.x.x.200 netmask 255.255.255.192 broadcast x.x.x.255 gateway x.x.x.193 ovs_type OVSBridge ovs_ports eth1 allow-ovsbr0 iface eth1 inet manual ovs_bridge ovsbr0 ovs_type OVSPort
However, it seems there are some issues on Debian with the start scripts. Without any
auto clause in
ovsbr0 nor my primary network device
eth1 is started (I did wait like 10 minutes). My logfiles do not show anything special.
Searching a bit I stumbled upon the following bugreport openvswitch-switch: switch takes a very long time to start or fails without upstream’s SYSTEMCTL_SKIP_REDIRECT=yes.
ovs-vsctl show does not show eth1. Adding eth1 manually using
ovs-vsctl add-port ovsbr0 eth1 works, still no connectivity, though. Up’ing the link:
ip link set eth1 up followed by
ip link set ovsbr0 up worked. Finally I configured it as shown below, mind that this will make the whole boot-process delay by 5 minutes since networking/openvswitch depend on each other. However, that was the only way to get everything up and running automatically:
allow-ovs ovsbr0 iface ovsbr0 inet static address x.x.x.200 netmask 255.255.255.192 broadcast x.x.x.255 gateway x.x.x.193 ovs_type OVSBridge ovs_ports eth1 post-up /sbin/ip link set dev eth1 up auto eth1 allow-ovsbr0 eth1 iface eth1 inet manual ovs_bridge ovsbr0 ovs_type OVSPort post-up ip link set dev ovsbr0 up pre-down ip link set dev ovsbr0 down
And yes, I am aware that one shouldn’t use
auto – Still that was the only way to get the devices up at boot.
Looks like my current setup did not need many changes, I just had to add
<virtualport type='switchport'/> and replace
ovsbr0 in the interface configuration using
virsh edit vmid. E.g:
<interface type='bridge'> <mac address='xx:xx:xx:xx:xx:xx'/> <source bridge='ovsbr0'/> <virtualport type='openvswitch'/> <target dev='veth105'/> <model type='virtio'/> <alias name='net0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface>
What does it look like?
root@janice:~# ovs-vsctl show x-x-x-x-x Bridge "ovsbr0" Port "veth111" Interface "veth111" Port "eth1" Interface "eth1" Port "veth109" Interface "veth109" Port "veth106" Interface "veth106" Port "veth105" Interface "veth105" Port "veth113" Interface "veth113" Port "ovsbr0" Interface "ovsbr0" type: internal Port "veth112" Interface "veth112" ovs_version: "2.6.2"