diff options
author | Paul Barrette <paul.barrette@windriver.com> | 2013-06-03 17:02:27 -0400 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2013-06-03 18:07:39 -0400 |
commit | 8499649a5f08e0be26ea6ef8a3feea5d97e80fa7 (patch) | |
tree | 1011104df21888bf1f8b042e03665135ebcf518c /docs | |
parent | 7c1e073e8cde367417ca59f37cb2f5af650eea6f (diff) | |
download | meta-virtualization-8499649a5f08e0be26ea6ef8a3feea5d97e80fa7.tar.gz |
openvswitch: uprev to 1.10 and documentation update.
-Uprev to 1.10
-removed vswitch_test.sh
-added openvswitch.txt.
Signed-off-by: Paul Barrette <paul.barrette@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/00-INDEX | 2 | ||||
-rw-r--r-- | docs/openvswitch.txt | 96 | ||||
-rwxr-xr-x | docs/vswitch_test.sh | 36 |
3 files changed, 98 insertions, 36 deletions
diff --git a/docs/00-INDEX b/docs/00-INDEX index 41d83a54..a2ffd99f 100644 --- a/docs/00-INDEX +++ b/docs/00-INDEX | |||
@@ -8,3 +8,5 @@ alphabetical order as well. | |||
8 | 00-README | 8 | 00-README |
9 | - info on the goals of meta-virtualization and this docs subdir | 9 | - info on the goals of meta-virtualization and this docs subdir |
10 | 10 | ||
11 | openvswitch.txt | ||
12 | - example on how to setup openvswitch with qemu/kvm. | ||
diff --git a/docs/openvswitch.txt b/docs/openvswitch.txt new file mode 100644 index 00000000..4410d27e --- /dev/null +++ b/docs/openvswitch.txt | |||
@@ -0,0 +1,96 @@ | |||
1 | Simple setup for connecting openvswitch to qemu/kvm | ||
2 | =================================================== | ||
3 | This example brings up openvswitch using a private network. | ||
4 | |||
5 | Preliminary notes | ||
6 | ================= | ||
7 | 1. Make sure to build kernel support for openvswitch as a module. The | ||
8 | openvswitch init scripts expect to load a module and upon success | ||
9 | continue to setup the switch. If openvswitch is compiled | ||
10 | statically, the init scripts not load the ovs-vswitchd daemon | ||
11 | and none of the configured bridges will show up in the interfaces | ||
12 | table (ifconfig). You can get around this limiation by running the | ||
13 | following by hand: | ||
14 | # ovs-vswitchd --pidfile --detach | ||
15 | |||
16 | 2. Verify that ovs-vswitchd is running before proceeding: | ||
17 | # /etc/init.d/openvswitch-switch status | ||
18 | ovsdb-server is running with pid 1867 | ||
19 | ovs-vswitchd is running with pid 1877 | ||
20 | |||
21 | 3. A kernel and rootfs is required for qemu bring up. | ||
22 | |||
23 | Qemu Setup | ||
24 | ========== | ||
25 | The host requires a /etc/qemu-ifup script to setup the bridging and tap | ||
26 | devices. Qemu will invoke this qemu-ifup script at startup. Here is | ||
27 | an example script: | ||
28 | $ cat /etc/qemu-fup | ||
29 | #!/bin/sh | ||
30 | # the tap is dynamically assigned and passed into this script | ||
31 | # as a parameter | ||
32 | TAP=$1 | ||
33 | |||
34 | # Note: if booting over NFS, once the $ETH0 device is added to the bridge, | ||
35 | # your host will be unusable. In that case, setup networking | ||
36 | # init scripts appropriately and change the following to work | ||
37 | # with it. | ||
38 | ETH0="eth1" | ||
39 | NETMASK=255.255.255.0 | ||
40 | IP=192.168.1.1 | ||
41 | GATEWAY= | ||
42 | SWITCH=ovsbr0 | ||
43 | if [ -n "$TAP" ];then | ||
44 | ifconfig $TAP up | ||
45 | ifconfig $SWITCH down &>/dev/null | ||
46 | ovs-vsctl del-br $SWITCH | ||
47 | ovs-vsctl add-br $SWITCH | ||
48 | ifconfig $ETH0 0.0.0.0 | ||
49 | ifconfig $SWITCH $IP up netmask $NETMASK | ||
50 | #-- external access not required for this test. | ||
51 | #route add default gw $GATEWAY | ||
52 | ovs-vsctl add-port $SWITCH $ETH0 | ||
53 | ovs-vsctl add-port $SWITCH $TAP | ||
54 | exit 0 | ||
55 | else | ||
56 | echo "$0: No tap device" | ||
57 | exit 1 | ||
58 | fi | ||
59 | |||
60 | Start Qemu | ||
61 | ========== | ||
62 | This example will bring up qemu with a tap network interface. | ||
63 | Note: this command must be run as root due to the networking setup. | ||
64 | |||
65 | $ qemu-system-x86_64 -nographic -k en-us -m 1024 \ | ||
66 | -net nic,macaddr=1a:46:0b:ca:bc:7a,model=virtio \ | ||
67 | -net tap -enable-kvm\ | ||
68 | -kernel /opt/dpdk-guest-kernel \ | ||
69 | -append 'root=/dev/vda ro console=ttyS0' \ | ||
70 | -drive file=/opt/intel-xeon-core-ovp-kvm-preempt-rt-dist.ext3,cache=none,if=virtio | ||
71 | |||
72 | Once the guest OS is up and running, configure the quest network interface: | ||
73 | $ ifconfig eth0 192.168.1.10 | ||
74 | |||
75 | Ping the bridge: | ||
76 | $ ping 192.168.1.1 | ||
77 | |||
78 | From the host, view the bridged network: | ||
79 | $ ovs-vsctl show | ||
80 | c1212b96-ef49-4a8e-b598-09b05b854dd0 | ||
81 | Bridge "ovsbr0" | ||
82 | Port "tap0" | ||
83 | Interface "tap0" | ||
84 | Port "eth1" | ||
85 | Interface "eth1" | ||
86 | Port "ovsbr0" | ||
87 | Interface "ovsbr0" | ||
88 | type: internal | ||
89 | |||
90 | At this point, openvswitch is up and running. If you want external | ||
91 | network access, you need to set a GATEWAY in the qemu-ifup script and | ||
92 | make sure the external device is part of the bridge. | ||
93 | |||
94 | Note: | ||
95 | Proper setup will require a /etc/qemu-ifdown script to tear down the | ||
96 | bridge and interfaces. (not provided here). | ||
diff --git a/docs/vswitch_test.sh b/docs/vswitch_test.sh deleted file mode 100755 index 63168e38..00000000 --- a/docs/vswitch_test.sh +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # runqemu defaults for the first "guest" | ||
4 | # | ||
5 | my_inet4="192.168.7.2" | ||
6 | my_gw="192.168.7.1" | ||
7 | |||
8 | # create a bridge | ||
9 | # | ||
10 | ovs-vsctl add-br br-int | ||
11 | |||
12 | # Add a physical interface to your virtual bridge for connectivity off box. | ||
13 | # If your rootfs is nfs mounted (on eth0), you will die after attaching it | ||
14 | # to the bridge. | ||
15 | # | ||
16 | ovs-vsctl add-port br-int eth0 | ||
17 | |||
18 | # Zero out your eth0 interface and slap it on the bridge interface. | ||
19 | # | ||
20 | ifconfig eth0 0 | ||
21 | ifconfig br-int ${my_inet4} netmask 255.255.255.0 | ||
22 | |||
23 | # Change your default route. If you don't do this, nothing will | ||
24 | # be reachable. | ||
25 | # | ||
26 | route add default gw ${my_gw} br-int | ||
27 | |||
28 | (You can then check that the connection works.) | ||
29 | |||
30 | # The bridge configuration is persistant, so if something goes wrong | ||
31 | # and you reboot, it will still be messed up. Destroy the bridge, | ||
32 | # then add a route, or reboot. | ||
33 | # | ||
34 | ovs-vsctl del-br br-int | ||
35 | ifconfig eth0 ${my_inet4} | ||
36 | route add default gw ${my_gw} eth0 | ||