Recursive Complexity

Thoughts and musings of a programmer and wanna be entrepreneur

How to setup a SDN using openvswitch and ODL controller

with 4 comments

I am going to demonstrate the configuration of a simple SDN using openvswitch and OpenDaylight controller. The topology we are going to use is as shown below.

Openflow - New Page

In my setup all the nodes are running Ubuntu 14.04.

Step 1: Configure the switch

Login to the switch and do..

root@Switch6~# apt-get update
root@Switch6~# apt-get install openvswitch-switch
root@Switch6~# ifconfig -a

Note down all the interfaces which are connected to neighboring switches or to hosts. Do not consider the interface that is connected to the controller.

Lets say the interface list obtained from doing the above is eth1 (connected to Host 1), eth2 (connected to Host2) and eth3 (connected to Host 3)

root@Switch:~# ovs-vsctl add-br br0
root@Switch:~# ovs-vsctl set-fail-mode br0 secure
root@Switch:~# ovs-vsctl add-port br0 eth1
root@Switch:~# ovs-vsctl add-port br0 eth2
root@Switch:~# ovs-vsctl add-port br0 eth3
root@Switch:~# ovs-vsctl set-controller br0 tcp::6633

The ip address of the controller in our case is Hence, the last command above would be “ovs-vsctl set-controller br0 tcp:”

After this make sure to enable all the interfaces that form part of the above bridge, else you won’t be able to run traffic from one host to another

root@Switch:~# ifconfig eth1 up
root@Switch6:~# ifconfig eth2 up
root@Switch:~# ifconfig eth3 up

Step 2: Configure the controller

We will be using OpenDaylight controller, Lithium release for this demo.

Login to the machine that will be configured as the controller and download ODL Lithium release. You can download whichever release you are interested in. I have downloaded a tar ball and will proceed from there.

root@Controller:~# tar -xvf distribution-karaf-0.3.1-Lithium-SR1.tar.gz
root@Controller:~# apt-get install openjdk-7-jre-headless
root@Controller:~# export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
root@Controller:~# cd distribution-karaf-0.3.1-Lithium-SR1
root@Controller:~# bin/karaf

This will start the ODL controller and ODL prompt appears. For the controller to learn the topology and for us to make use of the web UI, we need to install odl-restconf odl-l2switch-switch odl-dlux-all at the ODL prompt (NOTE: odl-dlux-all installs some additional modules that provide you the ability to see node ports and flow tables. If you do not need this, you can just install odl-dlux-core).

opendaylight-user@root> feature:install odl-restconf odl-l2switch-switch odl-dlux-all

After the installation is completed, shutdown the controller and restart it. I have observed that the installed modules do not work immediately and restart of the controller nicely works :).

opendaylight-user@root> shutdown -f
root@Controller:~# bin/karaf

It’s mentioned in the ODL wiki that it takes approximately 3 minutes for the controller to load all modules and start working. So give it some time. After that, point your browser to “http://<ip-address-of-controller&gt;:8181/index.html”. This should launch the web UI as shown below. Use localhost if you are on the controller or use the management ip address configured.

Screen Shot 2015-11-16 at 9.43.51 PM

Use “admin/admin” to login. After a successful login, you should see the switch being recognized by the controller.

Screen Shot 2015-11-16 at 9.44.12 PM

Now, from any of the hosts, ping others and refresh the topology in the web UI. You should see a complete view of the network.

Screen Shot 2015-11-16 at 9.45.33 PM

The network is fully operable now.

Issues that can arise during and after the configuration

  1. Cannot ping hosts from each other – Ensure that the interfaces that form the bridge on the switch are enabled. Install wireshark on the switch as well as controller and capture packets on the interface that connects the switch to the controller and vice-versa. Verify whether PACKET_IN and PACKET_OUT messages are being sent and received. You would have to download a version of wireshark that has support for openflow.
  2. Login failure in ODL web UI – The auth module has not loaded and initialized yet. Give it some time and it should work.
  3. No topology seen in the ODL web UI – Same as above. Give it some time.

Written by Vivek S

November 17, 2015 at 3:32 am

Posted in Tech

Tagged with , , ,

4 Responses

Subscribe to comments with RSS.

  1. Docker OpenVwitch with OpenDaylight controller in Vlan Fashion


    April 26, 2016 at 7:32 am

  2. Hello Ajay,

    Did you have Requirement How Docker Container works with Open Daylight here in vlan Way

    like Conatiner on same vlan can ping and different vlan cant

    its great halp if you provide such scinario


    April 26, 2016 at 7:23 am

  3. Hi Vivek, Thanks for sharing this info. I have openvswitch running on one VM and ODL on another.
    1) I set the controller using the command ovs-vsctl set-controller
    2) I execute ovs-vscl show and see controller ip being displayed, however is_connected=true is not seen. Is it mandatory ?
    3) I do not see any packet exchange between the 2 even though they are pingable to each other.

    ODL controller should discover switch by sending HELLO is what I understand. But it seems no packet is being sent to the switch (they are in same sub-network).

    I’m not sure what might be wrong. Anything that I’m missing ?



    March 17, 2016 at 9:58 am

    • Hi Ajay,

      Yes, is_connected must be true. What is the topology of the network? Where are the VMs? Are you using mininet?

      Vivek S

      March 17, 2016 at 3:53 pm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

TED Blog

The TED Blog shares interesting news about TED, TED Talks video, the TED Prize and more.

%d bloggers like this: