Category Archives: Uncategorized

Environment setup

Tutorial no. 1      

              In this tutorial we will install the required software. For simulation part we are going to use Mininet. About platform, so it is recommended that use linux since no extra softwares are needed.

Pre-requisite:- Virtualbox installed.

1) Download mininet VM image from here. Extract it click on .ovf image & import vm image to virtualBox.

1

2

2) If you are running VirtualBox first time, you should make sure your VM has two network interfaces. One should be a NAT interface that it can use to access the Internet, and the other should be a host-only interface to enable it to communicate with the host machine. For example, your NAT interface could be eth0 and have a 10.x.x.x IP address, and your host-only interface could be eth1 and have a 192.168.x.x IP address. You should ssh into the host-only interface at its associated IP address. Both interfaces should be configured using DHCP. If they are not already configured, you may have to run dhclient on each of them, as described below.) Now let’s add network interfaces to VirtualBox. To add network interfaces use key “CTRL+G” .Add ‘NAT’ and ‘Host-only’ interfaces. You can also change DHCP pool address from here.

3

4

3) After this we will enable network adapter for mininet. Right click on mininet go to settings>>network and enable network adapter Now select adapter one for NAT and adapter 2 for host-only interface.

5

6

4) We have configured network settings for mininet. Double click on mininet to start            
Login        :- mininet
Password:- mininet

7

5) ifconfig –a

Will give ip addresses of interfaces. You can see my Host-only interface(eth0) got ip address but NAT (eth1) not got ip address.

8

Use this command to get ip for eth1 interface

  sudo dhclient eth1

9

6) We can use host only interface for ssh access of mininet.

ssh –Y mininet@192.168.56.101

Here ip address of host-only interface for my VM is 192.168.56.101

10

 

Mininet basics

Tutorial no 2

Basics of  Mininet

In this tutorial we will learn some basic commands of mininet.

sudo mn Create topology with two hosts, one OFswitch [openflowswitch] and one OFCTL[openflow controller]

net Shows ethernet link between nodes

dump Gives IP addresses and PID of nodes

nodes Available nodes in topology

pingall Ping reachability between hosts

2

L2 learning

Note: Google Drive links may not work or might be expired. You can find the scripts here

Switch is Datalink layer & intelligent device than hub. Unlike hub switch does not flood the packets in network. It learns MAC address of hosts and forwards the packets. We have default script l2_learning to check behaviour of switch in mininet.
1)We will use same topology used in last tutorial.
To create topology

sudo mn – -topo single,8 – -mac – -switch ovsk – -controller remote

{ sudo mn:- running mininet as root                                                                                                                 topo single,8:- topology with single switch & 8 hosts                                                                         mac:- mac is assigned according to hostnames by mininet                                                                         switch ovsk:- switch type is ovsk                                                                                                             controller remote:- controller running outside (remote)}

1

So we have single switch with one controller and eight hosts.
2) Lets check ping reachability using command pingall. We will not get connectivity since we haven’t run any script on controller.
2
4)Now we will run script for switch. Here we have to ssh again into mininet.
cd pox

sudo python pox.py log.level –DEBUG forwarding.l2_learning

And you can see we got connectivity between hosts.
4
5)To see mac learning results we are going to use xterm and tcpdump utilities.
xterm h1 h2 h3
this command will give us windows for hosts
sudo tcpdump –XX –i h1-eth0 sudo tcpdump –XX –i h2-eth0
This will allow host to see ping reply Our host has ip addresses

10.0.0.1

10.0.0.2

10.0.0.3

.

.

10.0.0.8
Let’s ping host2 from host3
5
ICMP echo request is send to all hosts in network. But you can see only host1 gives ICMP echo reply .Also on controller side you can observe MAC addresses are learned .

Hub

Note: Google Drive links may not work or might be expired. You can find the scripts here

Tutorial no 3

Testing layer 1 script hub.py

      Hub is physical layer dumb device which forward packets from incoming ports to all ports except incoming one. So we will design topology first then run hub.py script on controller and check the results.

1) To create topology we can use commands since we don’t have GUI like packet tracer right now. Start mininet in virtual box. Following command will give interface address of virtual machine.

ifconfig –a

eth0 Host-only interface and eth1 NAT interface.

2) Now to access VM from host machine, ssh to eth0 [host-only] interface. In my case, eth0 interface ip is 192.168.56.101 . password: mininet To create topology.

sudo mn – -topo single,8 –mac –switch ovsk –controller remote

{ sudo mn:- running mininet as root topo
single,8:- topology with single switch & 8 hosts
mac:-set mac automatically using ip
switch ovsk:- switch type is ovsk
controller remote:- controller running outside (remote) }

1

So we have single switch with one controller and eight hosts.

3) Lets check ping reachability using command pingall. We will not get connectivity since we haven’t run any script on controller.

2

4) Now we will run script for hub. SSH into mininet again.
cd pox
sudo python pox.py log.level –DEBUG forwarding.hub

And you can see we got connectivity between hosts.

4

5) To see flooding result we are going to use xterm and tcpdump utilities.
xterm h1 h2 h3
this command will give us windows for hosts
5

6)    sudo tcpdump –XX –i h1-eth0
        sudo tcpdump –XX –i h2-eth0
This will allow host to see ping reply

6

7) Our host has ip addresses
10.0.0.1
10.0.0.2
10.0.0.3
.
.
10.0.0.8
Lets ping host2 from host3

7
Here you can see host1 too gives ICMP echo reply i.e. flooding