Public
How to upgrade to openvswitch on an Ubuntu 12.04 host running libvirt.
This is how you can replace the normal bridge-util package in Ubuntu 12.04 with the new Open vswitch soft switch, it is running in compatibility mode but once libvirt has native support it will be trivial to add.
This guide is written with the assumption that you have a management interface on a seporate interface than the one that is to be used by guests.
If you have ebtables installed remove it
# aptitude purge ebtables
Destroy the default libvirt net if virbr0 exists (check with ifconfig -a)
# virsh net-destroy default
# virsh net-autostart --disable default
Stop libvirt and qemu to make sure they do not bring up the legacy bridge.
# service libvirt-bin stop
# service qemu-kvm stop
Install Openvswitch from the ubuntu apt repositories
# aptitude install openvswitch-switch openvswitch-controller openvswitch-brcompat
If the DKMS module build fails you will need to fix those issues before moving forward
Edit the default file for openvswitch-switch to enable the bridge compat
# tail -n 1 /etc/default/openvswitch-switch
BRCOMPAT=yes
Restart the services and make sure they start fine
# service openvswitch-switch restart
# service openvswitch-controller restart
Reboot and make sure the brcompat_mod loads
# lsmod | grep br
com
brcompat_mod 13512 0
openvswitch_mod 83993 1 brcompat_mod
For default libvirt compatibility in our environment we need to name the bridge “br0” although this is a virtual switch and not a bridge.
Create bridge named “br0”
# ovs-vsctl add-br br0
Connect bridge “br0” to the physical interface “eth4”
# ovs-vsctl add-port br0 eth4
Add a virtual bridge device named “br10” for untagged vlan 10 traffic on bridge “br0”
# ovs-vsctl add-br br10 br0 10
Check to see that the bridges exist
# ovs-vsctl list-br
br0
br10
OK our bridge devices exist, lets add some dummy entries in /etc/network/interfaces so that they are “UP” in the eyes of libvirt.
We need to edit /etc/network/interfaces to add some entries
auto eth4
iface eth4 inet manual
up ifconfig $IFACE 0.0.0.0 up
down ifconfig $IFACE down
auto br0
iface br0 inet manual
up ifconfig $IFACE 0.0.0.0 up
down ifconfig $IFACE down
auto br10
iface br10 inet manual
up ifconfig $IFACE 0.0.0.0 up
down ifconfig $IFACE down
These bring up the interfaces with No IP address, now if you run ifconfig -a they should be visible.
Once you have a guest up on br0 or br10 you will see a “vnet0” interface.
This is how you can replace the normal bridge-util package in Ubuntu 12.04 with the new Open vswitch soft switch, it is running in compatibility mode but once libvirt has native support it will be trivial to add.
This guide is written with the assumption that you have a management interface on a seporate interface than the one that is to be used by guests.
If you have ebtables installed remove it
# aptitude purge ebtables
Destroy the default libvirt net if virbr0 exists (check with ifconfig -a)
# virsh net-destroy default
# virsh net-autostart --disable default
Stop libvirt and qemu to make sure they do not bring up the legacy bridge.
# service libvirt-bin stop
# service qemu-kvm stop
Install Openvswitch from the ubuntu apt repositories
# aptitude install openvswitch-switch openvswitch-controller openvswitch-brcompat
If the DKMS module build fails you will need to fix those issues before moving forward
Edit the default file for openvswitch-switch to enable the bridge compat
# tail -n 1 /etc/default/openvswitch-switch
BRCOMPAT=yes
Restart the services and make sure they start fine
# service openvswitch-switch restart
# service openvswitch-controller restart
Reboot and make sure the brcompat_mod loads
# lsmod | grep br
com
brcompat_mod 13512 0
openvswitch_mod 83993 1 brcompat_mod
For default libvirt compatibility in our environment we need to name the bridge “br0” although this is a virtual switch and not a bridge.
Create bridge named “br0”
# ovs-vsctl add-br br0
Connect bridge “br0” to the physical interface “eth4”
# ovs-vsctl add-port br0 eth4
Add a virtual bridge device named “br10” for untagged vlan 10 traffic on bridge “br0”
# ovs-vsctl add-br br10 br0 10
Check to see that the bridges exist
# ovs-vsctl list-br
br0
br10
OK our bridge devices exist, lets add some dummy entries in /etc/network/interfaces so that they are “UP” in the eyes of libvirt.
We need to edit /etc/network/interfaces to add some entries
auto eth4
iface eth4 inet manual
up ifconfig $IFACE 0.0.0.0 up
down ifconfig $IFACE down
auto br0
iface br0 inet manual
up ifconfig $IFACE 0.0.0.0 up
down ifconfig $IFACE down
auto br10
iface br10 inet manual
up ifconfig $IFACE 0.0.0.0 up
down ifconfig $IFACE down
These bring up the interfaces with No IP address, now if you run ifconfig -a they should be visible.
Once you have a guest up on br0 or br10 you will see a “vnet0” interface.
Add a comment...