Open vSwitch 与 KVM

This document describes how the vSwitch Kernel-based Virtual (KVM) used in conjunction with Open.

Note :

This article assumes that you have configured the Open vSwitch on a Linux system.

set up

Use KVM tunctltool handles various bridge mode, you can Debian Ubuntu packets / uml-utilitiesinstallation tool:

$ apt-get install uml-utilities

After that, you need to modify or create custom versions qemu-ifupand `` qemu-ifdown` script. In this guide, we will create a sample customized version of Open vSwitch bridge, described below is used.

Create the following two files, and save it to a known location, such as:

$ cat << 'EOF' > /etc/ovs-ifup
#!/bin/sh

switch='br0'
ip link set $1 up
ovs-vsctl add-port ${switch} $1
EOF

::

$ cat << 'EOF' > /etc/ovs-ifdown
#!/bin/sh

switch='br0'
ip addr flush dev $1
ip link set $1 down
ovs-vsctl del-port ${switch} $1
EOF

Open vSwitch basis in its usage of the document /intro/install/generalat the end are described. If you have not read, create a name for br0the bridge, use the following command:

$ ovs-vsctl add-br br0

Thereafter, a bridge to the port, this port when your client with the exchange port (for example, eth0):

$ ovs-vsctl add-port br0 eth0

May refer to details ovs-vsctl (8) of the man in the document.

Next, we start a script using the ifup and ifdown clients:

$ kvm -m 512 -net nic,macaddr=00:11:22:EE:EE:EE -net \
    tap,script=/etc/ovs-ifup,downscript=/etc/ovs-ifdown -drive \
    file=/path/to/disk-image,boot=on

This will launch a client, a TAP and its associated equipment. Script ovs-ifupadded to a bridge port br0, so that the client can communicate with the bridge.

For more information and debugging, you can use the Open vSwitch tools: ovs-dpctl and ovs-ofctl, such as:

$ ovs-dpctl show
$ ovs-ofctl show br0

You should be able to see that each has a KVM client added to the bridge TAP device (for example, tap0).

Details Reference ovs-dpctl (8) and ovs-ofctl (8) of the document man

Guess you like

Origin blog.csdn.net/sinat_20184565/article/details/94482228