This tutorial shows you how to build a simple SDN (Software Defined Networking)/OpenFlow lab to launch your research tests on OpenFlow on one single machine. We assume our machine is running ubuntu14.x or newer ubuntu distribution. We start by presenting tools and their installation/configuration then we will demonstrate some useful tests.

What do we need to build a SDN test lab?
First, we need an OpenFlow-enabled switch. You find here a list of commercial OpenFlow-enabled physical/virtual switches and here some open source OpenFlow switches among other OpenFlow products. Since we are working on a single machine, we will use a virtual switch.
1. Openvswitch: Openvswitch is an open source virtual switch, a software providing switching stack (same functionality than a physical switch) for virtual environments. The simplest way to install Openvswitch on ubuntu is to run:
apt-get install openvswitch-common openvswitch-switch
For more details, I recommend reading this tutorial: https://wiki.linaro.org/LNG/Engineering/OVSOnUbuntu.
Then, we create an Openvswitch bridge br0:
ovs-vsctl add-br br0
Now, we need to setup virtual interfaces on br0. We use Tuntap, a kernel extension that emulates a simple point-to-point or Ethernet device, it sets up and emulates an L2 interface which will show up like a physical interface (when we type ifconfig for example).
ip tuntap add mode tap vnet0 //adds a virtual interface named vnet0ip link set vnet0 up //sets up vnet0ovs-vsctl add-port br0 vnet0 //links vnet0 to br0
NB. It’s possible to create many bridges on the same Openvswitch instance. Each bridge has its own virtual interfaces and they all share the physical resources/interfaces of the host running Openvswitch.
Second, we need a hypervisor to build our virtual environment using virtual machines.
2. VirtualBox: a powerful x86 and AMD64/Intel64 open source hypervisor maintained by Oracle. To install VirtualBox go here, choose to download the last ubuntu package and then install the package. For more details on how to use VirtualBox, you may want to read this complete tutorial: https://www.virtualbox.org/manual/ch01.html
Now, we can complete our virtual environment by creating VMs and connecting them to the bridge br0. To do that, open VirtualBox, select the VM you want to connect, go to Settings then Network, set one network adapter to Bridged Adapter mode and finally choose vnet0 from the name list.

Once we create as many VMs we want and connect them to the bridge, we move to the controller side. Till here, we have built our data plane wicth needs to be managed by a decoupled controller. That is, the main characteristic of SDN is decoupling the control plane from the underlying network (data plane). There are many OpenFlow controllers in the market but few of them have considerably been maintained by the community, like: OpenDaylight (hosted by the Linux Foundation), Floodlight and POX.
3. OpenDaylight controller: In this tutorial we will use OpenDaylight (its pretty GUI may be a good reason to choose it) controller to manage our data plane. Dwonload one of the OpenDaylight releases here and follow the installation guide then the user guide present in the same page. I have installed Hydrogen, Virtualization edition, for this tutorial.
Now we have our data plane done and our controller installed, we need to connect them so we can manage the data plane through the controller.
First we run OpenDaylight controller: Go to the installation folder and type:
sudo ./run.sh
We connect the switch to the controller using this command on a second terminal:
sudo ovs-vsctl set-controller br0 tcp:[controller IP@]:[controller listening port]
Since our switch and controller are on the same machine, the command will be:
sudo ovs-vsctl set-controller br0 tcp:127.0.0.1:6633
OpenDaylight uses OpenFlow default port: 6633.
This line will appear on the first terminal (controller terminal):
To make sure the connection was correctly made, type:
sudo ovs-vsctl show
witch displays the bridge interfaces and the connection state:
That’s all … Congratulation! your OpenFlow test lab is now ready to host your novel research scenarios 🙂

