~ubuntu-branches/ubuntu/wily/openvswitch/wily

« back to all changes in this revision

Viewing changes to INSTALL.KVM.md

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2015-08-10 11:35:15 UTC
  • mfrom: (1.1.30)
  • Revision ID: package-import@ubuntu.com-20150810113515-575vj06oq29emxsn
Tags: 2.4.0~git20150810.97bab95-0ubuntu1
* New upstream snapshot from 2.4 branch:
  - d/*: Align any relevant packaging changes with upstream.
* d/*: wrap-and-sort.
* d/openvswitch-{common,vswitch}.install: Correct install location for
  bash completion files.
* d/tests/openflow.py: Explicitly use ovs-testcontroller as provided
  by 2.4.0 release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
How to Use Open vSwitch with KVM
 
2
=================================
 
3
 
 
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.md] to get Open vSwitch setup on your Linux system.
 
7
 
 
8
Setup
 
9
-----
 
10
 
 
11
First, follow the setup instructions in [INSTALL.md] to get a working
 
12
Open vSwitch installation.
 
13
 
 
14
KVM uses tunctl to handle various bridging modes, which you can 
 
15
install with the Debian/Ubuntu package uml-utilities.
 
16
 
 
17
      % apt-get install uml-utilities
 
18
 
 
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
 
22
guide.
 
23
 
 
24
Create the following two files and store them in known locations.
 
25
 
 
26
For example /etc/ovs-ifup and /etc/ovs-ifdown
 
27
 
 
28
/etc/ovs-ifup
 
29
 
 
30
```
 
31
#!/bin/sh
 
32
 
 
33
switch='br0'
 
34
/sbin/ifconfig $1 0.0.0.0 up
 
35
ovs-vsctl add-port ${switch} $1
 
36
```
 
37
 
 
38
/etc/ovs-ifdown
 
39
 
 
40
```
 
41
#!/bin/sh
 
42
 
 
43
switch='br0'
 
44
/sbin/ifconfig $1 0.0.0.0 down
 
45
ovs-vsctl del-port ${switch} $1
 
46
```
 
47
 
 
48
At the end of [INSTALL.md], it describes basic usage of creating
 
49
bridges and ports. If you haven't already, create a bridge named
 
50
br0 with the following command:
 
51
 
 
52
      % ovs-vsctl add-br br0
 
53
 
 
54
Then, add a port to the bridge for the NIC that you want your guests
 
55
to communicate over (e.g. eth0):
 
56
 
 
57
      % ovs-vsctl add-port br0 eth0
 
58
 
 
59
Please refer to ovs-vsctl(8) for more details.
 
60
 
 
61
Next, we'll start a guest that will use our ifup and ifdown scripts.
 
62
 
 
63
      % kvm -m 512 -net nic,macaddr=00:11:22:EE:EE:EE -net \
 
64
        tap,script=/etc/ovs-ifup,downscript=/etc/ovs-ifdown -drive \
 
65
        file=/path/to/disk-image,boot=on
 
66
 
 
67
This will start the guest and associate a tap device with it. The 
 
68
ovs-ifup script will add a port on the br0 bridge so that the
 
69
guest will be able to communicate over that bridge.
 
70
 
 
71
To get some more information and for debugging you can use Open
 
72
vSwitch utilities such as ovs-dpctl and ovs-ofctl, For example:
 
73
 
 
74
      % ovs-dpctl show
 
75
      % ovs-ofctl show br0
 
76
 
 
77
You should see tap devices for each KVM guest added as ports to 
 
78
the bridge (e.g. tap0)
 
79
 
 
80
Please refer to ovs-dpctl(8) and ovs-ofctl(8) for more details.
 
81
 
 
82
Bug Reporting
 
83
-------------
 
84
 
 
85
Please report problems to bugs@openvswitch.org.
 
86
 
 
87
[INSTALL.md]:INSTALL.md