Getting Started OpenFlow OpenvSwitch Tutorial Lab : Setup

Getting Started OpenFlow OpenvSwitch Tutorial Lab : Setup

Open Vswitch Lab

Getting Started OpenFlow OpenvSwitch Tutorial Lab : Setup
For a more up to date tutorial as anything more then 6 months old is outdated in the world of SDN Please see:
OpenDaylight OpenStack Integration with DevStack on Fedora 20

I wrote a Python OpenFlow installation app to automate an OpenFlow KVM and Open vSwitch setup found at:
OpenFlow, OpenvSwitch and KVM SDN Lab Installation App →

Getting Started OpenFlow OpenvSwitch Tutorial Lab – Setup:

Getting Started OpenFlow OpenvSwitch Tutorial Lab : This is an OpenFlow Tutorial using OpenvSwitch and Floodlight controller but any other controller or switch can be used. I have had some requests on some scenarios so I put this together. Adding a few more flexible components. Getting to know all of these packages like KVM, OpenvSwitch are going to be pretty big in the future ecosystem orchestrations.

The video doesn’t have any sound, I am tight on time, sorry. I think it should be pretty straightforward and the video may help if you get stuck. Probably a couple typos here and there I will try and catch over the weekend. We are lacking good lab material on these topics right now so maybe this will save a couple folks some time.


The KVM requires an x86 machine with either Intel VT or AMD w/AMD-V support. Anything fairly new will have that support in the processor. There are a few older HW builds that support hardware assisted virtualization by enabling it in the bios. Pretty much Googling your machine for hardware virtualization will let you know. Qemu can be run on non VT HW but the machines will probably get brutalized by a few host VMs. When you are setting up the vSwitch either have an out of band or be on it physically. Be careful when you are adding multiple interfaces to bridges since you can spin up a bridging loop pretty quickly unless you have STP on. I recommend a test/dev network or mom’s basement network. If not BPDUguard is your friend :) This is done on a fresh install of 64-bit Ubuntu 12.04 (Precise).

Quick screencast. I highly recommend considering using a small Linux Kernel named linux-0.2.img.bz2 from Qemu if using a laptop or nested hypervisor.

Install OpenvSwitch

Add your bridge, think of this as a subnet if you aren’t familiar with the term.

Add a physical interface to your virtual bridge for connectivity off box. If you don’t script this part you will probably clip your connection as you zero out eth0 and apply it to br-int. You can pop the commands into a text file and make it executable with
chmod +x

Install FloodLight OpenFlow Controller and Attach OpenvSwitch

Install dependencies, apt-get for UB and yum for RH:

Clone the Github project and build the jar and start the controller:

Attach OpenvSwitch to the Controller

In the FloodLight console you will see something like this:


The output of OVS ‘ovs-vsctl show’ looks something like this:

Install KVM and Integrate into OVS

These two scripts bring up the KVM Tap interfaces into your bridge from the CLI. If you copy and paste below make sure the (‘) does not get formatted improperly. It should be yellow in nano. “switch=br-int” br-int is the name of your bridge in OVS.
$nano /etc/ovs-ifup  (open and paste what is below)

$nano /etc/ovs-ifdown (open and paste what is below)

Make both files executable
chmod +x /etc/ovs-ifup /etc/ovs-ifdown

Boot the Guest Virtual Machines

  • Host1

  • Host2

  • Host3

Each one of those will begin loading from the ISO. I just click “Try Ubuntu” when they are booting and just run them from disk since really all we need are nodes that can test connectivity as we push static flows. If it is a more permanent test lab it would make since to install them to disk.

While those are spinning up let’s install curl.

Figure 1. OVS Taps

One they are up assign IP addresses to them by clicking in the top left of the Ubuntu window and type in ‘terminal’ no parentheses. Then give them IPs if you want to statically assign them with ifconfig.

Check out the rest of the tutorials in this series:

Thanks for stopping by.

About the Author

Brent SalisburyI have over 15 years of experience wearing various hats from, network engineer, architect, devops and software engineer. I currently have the pleasure of working at the company that develops my favorite software I have ever used, Docker. My comments here are my personal thoughts and opinions. More at Brent's BioView all posts by Brent Salisbury →

1 year 1 month ago

Simply want to say your article is as astonishing.
The clarity in your post is simply spectacular and i
could assume you’re an expert on this subject.
Fine with your permission allow me to grab your feed to keep up to date with
forthcoming post. Thanks a million and please carry on the gratifying work.

1 year 1 month ago

In real scenario is it possible to connect controller using one IP Address to many switches?

1 year 2 months ago

Good post. I learn something totally new and challenging on sites I stumbleupon everyday.

It’s always exciting to read content from other authors and practice a little something from their web sites.

1 year 2 months ago

Very good post. I am experiencing a few of these issues as well..

Han Hsu
1 year 4 months ago

I created a network with two openvswitch(A and B) and a controller:
B(eth0) ——– (eth0)A(eth1) —— controller
using this command:
A:> ovs-vsctl add-br br0
> ovs-vsctl add-port br0 eth0
B: > ovs-vsctl add-br br0
> ovs-vsctl add-port bro eth0
The controller’s IP is
Can you tell me how to use commands to connect A,B to controller?

1 year 6 months ago

Howdy! This is kind of off topic but I need some guidance from an established blog.

Is it difficult to set up your own blog? I’m not very techincal
but I can figure things out pretty fast.
I’m thinking about making my own but I’m not sure where to begin.
Do you have any ideas or suggestions? Many thanks

1 year 6 months ago

It’s not my first time to pay a quick visit this site, i am visiting this web page dailly and get nice data from here everyday.

1 year 7 months ago

Hi Brent,
Thank you for all your posts. I have few doubts regarding one of my projects on SDN.
Could you help me about how to write flows on an OVS switch. Is it possible to write code in Shell Scripting ?
I have OVS switch and floodlight controller installed in one VM. Other two Host (VMs) connected to OVS, I want to push flows so that the traffic on OVS port eth0 (Host1) should get routed to port eth1 (Host2).

Thanks in advance