Open vSwitch Setup

From Flav's Wiki
Jump to: navigation, search

Correct boot scripts

In order to enable openvswitch at boot time the order is not correct. Change /etc/init.d/openvswitch-switch as following:

diff -u ~/openvswitch-switch.old openvswitch-switch
--- /root/openvswitch-switch.old       2015-05-06 10:37:34.036076834 +0200
+++ openvswitch-switch  2015-05-06 11:20:21.776809573 +0200
@@ -16,10 +16,12 @@
 #
 ### BEGIN INIT INFO
 # Provides:          openvswitch-switch
-# Required-Start:    $network $named $remote_fs $syslog
-# Required-Stop:     $remote_fs
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
+# Required-Start:    $local_fs
+# Required-Stop:     $local_fs
+# X-Start-Before:    networking
+# X-Stop-After:      networking
+# Default-Start:     S
+# Default-Stop:      0 6
 # Short-Description: Open vSwitch switch
 # Description:       openvswitch-switch provides the userspace components and utilities for
 #                    the Open vSwitch kernel-based switch.

Then reset the init scripts:

root@host# update-rc.d -f openvswitch-switch defaults
update-rc.d: using dependency based boot sequencing
update-rc.d: warning: default start runlevel arguments (2 3 4 5) do not match openvswitch-switch Default-Start values (S)
update-rc.d: warning: default stop runlevel arguments (0 1 6) do not match openvswitch-switch Default-Stop values (0 6)

Configure networking

Read: /usr/share/doc/openvswitch-switch/README.Debian[.gz]

Edit /etc/network/interfaces and add enties as follow:

auto somebr
allow-ovs somebr
iface somebr inet static
        address  192.168.21.1
        netmask  255.255.255.0
        ovs_type OVSBridge
        ovs_ports myvlan02port

This following port will be on vlan 2.

# this interface is just here to allow communication between host and guest
# (guests can communicate between themselves without this interface)
# it is also used for the default gateway of the guests
auto myvlan02port
allow-somebr myvlan02port
iface myvlan02port inet static
        address  192.168.22.1
        netmask  255.255.255.0
        ovs_type OVSIntPort
        ovs_bridge somebr
        ovs_options tag=2