Recursive Complexity

Thoughts and musings of a programmer and wanna be entrepreneur

Posts Tagged ‘SDN

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 192.168.11.1. Hence, the last command above would be “ovs-vsctl set-controller br0 tcp:192.168.11.1:6633”

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.
Advertisements

Written by Vivek S

November 17, 2015 at 3:32 am

Posted in Tech

Tagged with , , ,

TED Blog

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