[ovs-discuss] Openswitch VM to VM traffic switching

Todd Deshane deshantm at gmail.com
Fri May 14 01:35:57 UTC 2010


Hi Praveen,

On Thu, May 13, 2010 at 5:52 PM, Praveen Reguraman <preguraman at gmail.com> wrote:
> Hi Todd,
>             I mentioned that librvirt also uses a tap interface and hence,
> needs some check related to tun module.

I didn't run into this problem with the tun module. Did you install
uml-utilities?

Also, see below. I did a very quick proof of concept setup of a KVM
guest that uses an ovs bridge.

>> I'll make an attempt today or tomorrow and try to post a quick howto.
>>

sudo apt-get install kvm uml-utilities

mkdir ~/src
cd ~/src
wget http://openvswitch.org/releases/openvswitch-0.99.2.tar.gz
tar xf openvswitch-0.99.2.tar.gz
cd openvswitch-0.99.2/
sudo apt-get install build-essential autoconf automake pkg-config
libssl-dev iproute tcpdump  linux-headers-`uname -r`
./configure --with-l26=/lib/modules/`uname -r`/build
sudo insmod datapath/linux-2.6/openvswitch_mod.ko
sudo touch /usr/local/etc/ovs-vswitchd.conf

***In a new terminal window run this command***
sudo ovs-vswitchd --pidfile --log-file --detach -v
/usr/local/etc/ovs-vswitchd.conf &
###NOTE, leave this terminal open, debug output will show up here###

***continuing on the original terminal***
sudo /etc/init.d/network-manager stop
sudo /etc/init.d/networking stop
sudo ifconfig eth0 up
sudo ifconfig eth0 0.0.0.0
sudo ovs-vsctl add-br externalbr
sudo ovs-vsctl add-port externalbr eth0

#These two will give you a sense of what has been created
sudo ovs-dpctl show externalbr
sudo ovs-ofctl show externalbr

#Just to have the example contained, let's put it in a directory of its own
mkdir ~/ovs
cd ~/ovs

#create two files. In this example, I use cat to create them.
cat > externalbr-ifup
#!/bin/sh

switch='externalbr'
/sbin/ifconfig $1 0.0.0.0 up
ovs-vsctl add-port ${switch} $1
<CTRL-D>

cat > externalbr-ifdown
#!/bin/sh

# NOTE: This script is intended to run in conjunction with externalbr-ifup
#       which uses the same logic to find your bridge/switch

switch=externalbr
ovs-vsctl del-port ${switch} $1
/sbin/ifconfig $1 0.0.0.0 down
<CTRL-D>

wget http://mirror.clarkson.edu/ubuntu-releases/10.04/ubuntu-10.04-desktop-i386.iso
sudo kvm -net nic,macaddr=00:11:22:CC:CC:CC -net
tap,script=externalbr-ifup,downscript=externalbr-ifdown -cdrom
~/ubuntu-10.04-desktop-i386.iso &

#When running these this time, notice the addition of the tap0, that's
the interface given to the kvm guest
sudo ovs-dpctl show externalbr
sudo ovs-ofctl show externalbr

Your newly booted kvm (liveCD) guest will have bridged networking.

That concludes this very basic usage of ovs and a KVM guest.

In future howtos, I'll look further at things like:
sudo ovs-ofctl dump-flows externalbr

And other ovs-ofctl actions like:

 add-flow SWITCH FLOW       add flow described by FLOW
 add-flows SWITCH FILE        add flows from FILE
 del-flows SWITCH [FLOW]     delete matching FLOWs


Hope that helps.

Questions and comments are welcome.

Thanks,
Todd

-- 
Todd Deshane
http://todddeshane.net
http://runningxen.com




More information about the discuss mailing list