1 How to Use Open vSwitch with KVM
2 =================================
4 This document describes how to use Open vSwitch with the Kernel-based
5 Virtual Machine (KVM). This document assumes that you have read and
6 followed INSTALL to get Open vSwitch setup on your Linux system.
11 First, follow the setup instructions in INSTALL to get a working
12 Open vSwitch installation.
14 KVM uses tunctl to handle various bridging modes, which you can
15 install with the Debian/Ubuntu package uml-utilities.
17 % apt-get install uml-utilities
19 Next, you will need to modify or create custom versions of the qemu-ifup
20 and qemu-ifdown scripts. In this guide, we'll create custom versions
21 that make use of example open vSwitch bridges that we'll describe in this
24 Create the following two files and store them in known locations.
26 For example /etc/ovs-ifup and /etc/ovs-ifdown
29 --------------------------------------------------------------------
33 /sbin/ifconfig $1 0.0.0.0 up
34 ovs-vsctl add-port ${switch} $1
35 --------------------------------------------------------------------
38 --------------------------------------------------------------------
42 /sbin/ifconfig $1 0.0.0.0 down
43 ovs-vsctl del-port ${switch} $1
44 --------------------------------------------------------------------
46 At the end of INSTALL, it describes basic usage of creating
47 bridges and ports. If you haven't already, create a bridge named
48 br0 with the following command:
50 % ovs-vsctl add-br br0
52 Then, add a port to the bridge for the NIC that you want your guests
53 to communicate over (e.g. eth0):
55 % ovs-vsctl add-port br0 eth0
57 Please refer to ovs-vsctl(8) for more details.
59 Next, we'll start a guest that will use our ifup and ifdown scripts.
61 % kvm -m 512 -net nic,macaddr=00:11:22:EE:EE:EE -net \
62 tap,script=/etc/ovs-ifup,downscript=/etc/ovs-ifdown -drive \
63 file=/path/to/disk-image,boot=on
65 This will start the guest and associate a tap device with it. The
66 ovs-ifup script will add a port on the br0 bridge so that the
67 guest will be able to communicate over that bridge.
69 To get some more information and for debugging you can use Open
70 vSwitch utilities such as ovs-dpctl and ovs-ofctl, For example:
75 You should see tap devices for each KVM guest added as ports to
76 the bridge (e.g. tap0)
78 Please refer to ovs-dpctl(8) and ovs-ofctl(8) for more details.
83 Please report problems to bugs@openvswitch.org.