]> git.proxmox.com Git - mirror_ovs.git/blame - INSTALL.KVM.rst
tests: windows ovsdb online compact
[mirror_ovs.git] / INSTALL.KVM.rst
CommitLineData
7668f7cc
SF
1..
2 Licensed under the Apache License, Version 2.0 (the "License"); you may
3 not use this file except in compliance with the License. You may obtain
4 a copy of the License at
5
6 http://www.apache.org/licenses/LICENSE-2.0
7
8 Unless required by applicable law or agreed to in writing, software
9 distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11 License for the specific language governing permissions and limitations
12 under the License.
13
14 Convention for heading levels in Open vSwitch documentation:
15
16 ======= Heading 0 (reserved for the title in a document)
17 ------- Heading 1
18 ~~~~~~~ Heading 2
19 +++++++ Heading 3
20 ''''''' Heading 4
21
22 Avoid deeper levels because they do not render well.
23
24================================
25How to Use Open vSwitch with KVM
26================================
27
28This document describes how to use Open vSwitch with the Kernel-based Virtual
29Machine (KVM).
30
31.. note::
32
33 This document assumes that you have read and followed the `installation guide
34 <INSTALL.rst>`__ to get Open vSwitch setup on your Linux system.
35
36Setup
37-----
38
39KVM uses tunctl to handle various bridging modes, which you can install with
dc76953f 40the Debian/Ubuntu package ``uml-utilities``::
7668f7cc
SF
41
42 $ apt-get install uml-utilities
43
44Next, you will need to modify or create custom versions of the ``qemu-ifup``
45and ``qemu-ifdown`` scripts. In this guide, we'll create custom versions that
46make use of example Open vSwitch bridges that we'll describe in this guide.
47
dc76953f 48Create the following two files and store them in known locations. For example::
7668f7cc
SF
49
50 echo << EOF > /etc/ovs-ifup
51 #!/bin/sh
52
53 switch='br0'
54 /sbin/ifconfig $1 0.0.0.0 up
55 ovs-vsctl add-port ${switch} $1
56 EOF
57
58::
59
60 echo << EOF > /etc/ovs-ifdown
61 #!/bin/sh
62
63 switch='br0'
64 /sbin/ifconfig $1 0.0.0.0 down
65 ovs-vsctl del-port ${switch} $1
66
67The basic usage of Open vSwitch is described at the end of the `installation
68guide <INSTALL.rst>`__. If you haven't already, create a bridge named ``br0``
dc76953f 69with the following command::
7668f7cc
SF
70
71 $ ovs-vsctl add-br br0
72
73Then, add a port to the bridge for the NIC that you want your guests to
dc76953f 74communicate over (e.g. ``eth0``)::
7668f7cc
SF
75
76 $ ovs-vsctl add-port br0 eth0
77
78Refer to ovs-vsctl(8) for more details.
79
dc76953f 80Next, we'll start a guest that will use our ifup and ifdown scripts::
7668f7cc
SF
81
82 $ kvm -m 512 -net nic,macaddr=00:11:22:EE:EE:EE -net \
83 tap,script=/etc/ovs-ifup,downscript=/etc/ovs-ifdown -drive \
84 file=/path/to/disk-image,boot=on
85
86This will start the guest and associate a tap device with it. The ``ovs-ifup``
87script will add a port on the br0 bridge so that the guest will be able to
88communicate over that bridge.
89
90To get some more information and for debugging you can use Open vSwitch
dc76953f 91utilities such as ovs-dpctl and ovs-ofctl, For example::
7668f7cc
SF
92
93 $ ovs-dpctl show
94 $ ovs-ofctl show br0
95
96You should see tap devices for each KVM guest added as ports to the bridge
97(e.g. tap0)
98
99Refer to ovs-dpctl(8) and ovs-ofctl(8) for more details.
100
101Bug Reporting
102-------------
103
104Please report problems to bugs@openvswitch.org.