Showing posts with label Mininet. Show all posts
Showing posts with label Mininet. Show all posts

Tuesday, 7 April 2015

Setting up OpenDayLight Controller and linking it to mininet

Prerequests:
-VMWare Workstation [recommended] or
-Virtual Box [free software not as good but does the job]
-Ubuntu 14.04 32bit OS installed and named Controller or something like that [please have this vm set up by following my blog on setting up mininet from scratch]
-Second OS running Ubuntu 14.04 32bit installed and named Mininet [please have this vm set up by following my blog on setting up mininet from scratch]

Note: you will have to set up the Ubuntu 14.04 virtual machine yourself I recommend 20GB of hard drive space and 4GB of ram if your machine can handle it. Also both machines must be set up with mininet as instructed in my previous blog.

The most straight forward way to set up the OpenDaylight Controller (ODL) is to download the latest pre-built version from there website http://www.opendaylight.org/software/downloads .
I would highly recommend this option for anyone who is new to the world of software-defined networking (SDN). The latest version of the ODL controller available at the moment is Helium-SR3. Make sure that you download the .tar file when using Ubuntu. When the download is complete right click on the file and extract it to your home folder you are now ready to get started. You should have your two vms powered on side by side, make sure that your mininet vm has been set up properly as indicated in blog on how to set up mininet from scratch. I do not want you to run mininet on this machine yet so if it is running type exit into the mininet command prompt. The first machine we are going to work on is the controller vm so you have downloaded and extracted the most recent distribution now lets get it to run.
Launch the terminal and type in

dir

if you have extracted the distribution to your home folder you will see it here.
Next command you need is

cd distribution-karaf-0.2.3-Helium-SR3

now to run the controller type in

./bin/karaf

the controller will come up but it takes about 6 minutes to come online fully.
We now need to find out the ip address of our virtual machine this can be obtained by opening another terminal window don't close the ODL controller command window. In the second terminal type in

ifconfig

and take note of the ip address of the machine you will need this to link mininet to the controller.
The below video will go through the above steps in-case you don't understand anything,




We are now going to leave the controller vm and go to our mininet vm if you have set it up like instructed in the previous blog on mininet this should work just fine.
Now we are going to link mininet to our controller that is running on a separate vm. We have already got the ip address of the machine that our controller is sitting on which in this case is 192.168.195.135 your ip will more than lightly be different so don't forget to check and change accordingly.
In our terminal window enter the following command to link mininet and the controller

sudo mn --topo=tree,3 --mac --switch=ovsk --controller=remote,ip=192.168.195.135

if you have entered this correctly then mininet should be connected we now need to go back to our controller vm and see if we are all good. There is a video below going through the above set up.

Ok so if all of the above is working like in the videos then you are in a good place and you are about to see what mininet looks like when connected to the OpenDaylight Controller. Lets head back over to our controller vm and launch the browser. In the browser type in the following

localhost:8181/dlux/index.html#/login

When the interface for the ODL Dlux comes up the username and password is admin/admin
you are now logged in and you should be able to see your mininet network displayed in the topology tab. There is a video below showing you how to do this but if you have got this far well done and have fun experimenting with mininet and OpenDaylight. Please leave a comment and let me know how you got on an if this blog has been helpful.





Monday, 6 April 2015

Setting up Mininet From Scratch Ubuntu 14.04

Prerequisites for this set up:
-VMWare Workstation [recommended] or
-Virtual Box [Free software not as good as VMWare but works just fine]
-Ubuntu 14.04 operating system 32bit link below
[  http://www.ubuntu.com/download/desktop ]
-Internet connection with access to GitHub
-Patience and composure are also required [you cannot download this :)]
___________________________________________________________________________

Software defined networking (SDN) is the new kid on the block when it comes to networking, but to understand it we must first get hands on with the technology. The best way to do this with out going bankrupt is to use the Stanford University SDN emulation software known as mininet. There are many in-depth tutorials on how to install the software and after running into a number of different issues I have decided to let you know how I installed mininet with all of its bells and whistles. Don't forget that http://mininet.org/ is a gold mind of information when it comes to this technology and should be referred to for guidelines and instructions. I will also upload videos on this blog that you can follow step by step with me as I run through an install of mininet from start to finish. Your going to have to set up the virtual machine yourself but this is very straight forward and there are many different tutorial on this so lets go straight to getting mininet up and running.

The first step is to access the setting on the Ubuntu OS and turn off the lock function; this stops the machine locking during an install and knocking out your connection to Github which will happen if the machine locks. 
The next step is to open the terminal and type in the following commands.
sudo apt-get install mininet
This command will install a number of core files for mininet and allow mininet to run you can see to output of this command by referring to Fig 2.1 below.












Fig 2.1

The next step is to kill any controllers that mininet may have activated by issuing the following command you can see the output from this command below in Fig 2.2.
sudo mn –c









Fig 2.2


The next step is to install git so that mininet can be downloaded from Github and create a file structure on our test machine. The output from the following command can be seen in Fig 2.3.
sudo apt-get install git










Fig 2.3

Now that git has installed we need to pull mininet down from GitHub using the following command you can view this output in Fig 2.4 below.
git clone git://github.com/mininet/mininet









Fig 2.4

The next step is to switch mininet to the latest version by entering the below commands you can see this output below in Fig 2.5.
cd mininet
git tag # list available versions
git checkout –b cs244-spring-2012-final










Fig 2.5


The next step is the most important one as we now want to install of the elements that mininet has to offer. If this step is not carried out mininet may not connect properly with the controller and wireshark will not run. To carry out this step enter the below command you may need to cd ..  to get back first.
mininet/util/install.sh –a
if this doesnt work try 
mininet/util/install.sh -a Ubuntu 14.04 trusty i386 Ubuntu
The final step is to run wireshark and to start mininet to do this we must first open a separate terminal to run wireshark in and enter the following command.
sudo wireshark &
In wireshark select lo as the interface to sniff and type of into the filter box and apply it this tells wireshark to sniff open flow packets. We won’t see anything in wireshark until mininet is started to start mininet type the following command.
sudo mn
In order to get traffic flowing and to see it in wireshark inside mininet type.
h1 ping h2
If you refer to Fig 2.6 below you can now see that mininet is running and wireshark is reading the packets.










Fig 2.6

If you want to follow my video tutorial you can view it below it is just all of the above on a clean install of Ubuntu 14.04 from start to finish.




I hit a few bumps during the installation
which is good as you can see the potential issues that can arise so I have left it unedited.
Please note that unfortunately there is no audio but all of the steps can be followed and you can pause and rewind the video as many times as you need to get it right. Best of luck.
Refer to the mininet walk through to learn more about the functionality of the software http://mininet.org/walkthrough/ .