Thursday, August 11, 2016

MININET Report by Zubair Shahzad



    MININET Report
      
Outline·

  •   Introduction
  • · Network Namespaces
  • · Mininet Advantages /Disadvantages
  • · Installing mininet and wireshark
  • · Mininet Commands
  • · Set up a Simple network
  • · Monitoring using Wireshark
  • · Conclusion

Mininet introduction:
Mininet is designed to easily create virtual software-defined networks consisting of an Open Flow controller, a flat Ethernet network of multiple OpenFlow-enabled Ethernet switches, and multiple hosts connected to those switches. It has built-in functions that support different types of controllers and switches. We can also create complex custom scenarios using the Mininet Python API.

Mininet Advantages:
Mininet combines many of the best features of emulators, hardware testbeds, and simulators.

Mininet Disadvantages:
Mininet-based networks cannot (currently) exceed the CPU or bandwidth available on a single server.
Mininet cannot (currently) run non-Linux-compatible OpenFlow switches or applications; this has not been a major issue in practice.


Installation:
OPERATING SYSTEM: UBUNTU
Terminal commands to install the mininet:
· sudo apt-get update
· sudo apt-get install
· sudo apt-get install mininet

Installing Wireshark:
Terminal commands to install the wireshark :
· $ Sudo apt-add-repository ppa: pi-rho/security
· $ sudo apt-get update
· $ sudo apt-get install wireshark

Set up a simple network

Mininet Commands:
Mininet can be started with options that specify the network topology to be created. To see all available options run the Mininet command mn with the -h option to see the help menu. Nodes   will show  nodes in network. Ping  commands is use to pingthe node in the network. PingAll  is  used  to ping  whole  network. And Sudo mn – c  command is use to clean  the minnet.
$ sudo mn –hmininet>h1 ping h2 mininet > nodes
mininet > pingallmininet>iperfimportant command:$sudo mn -c

Mininet must be run as root so we must use the sudo command to run Mininet.
The Mininet network topology can be specified using the –topo option. If started without
any topology options, Mininet will create the minimal built-in topology, which consists of two virtual machines connected
to an Openflow switch, which is managed by an Openflow controller. In our case,
we will create a topology that consists of four virtual machines connected to
an OpenFlow switch, which is connected to an OpenFlow controller.
The default topology is:
Ø $sudo mn















This is diagram of network that is created by command $sudo mn:








To create a network topology with four virtual machines connected to a switch, enter the command:
$ sudo mn --topo=single,4 
In this scenario, we did not specify the type of controller so we are using Mininet’s default controller, ovs-controller, which implements the functionality of a basic layer-2 MAC-learning switch. The controller learns the MAC addresses of the hosts connected to the network and programs the switch’s flow tables to set up connections between hosts that are sending packets to each other.
You will see the following output as Mininet creates the simulated network topology:
*** Creating network *** Adding controller *** Adding hosts: h1 h2 h3 h4 *** Adding switches: s1 *** Adding links: (h1, s1) (h2, s1) (h3, s1) (h4, s1) *** Configuring hosts h1 h2 h3 h4 *** Running terms on localhost:10.0 *** Starting controller *** Starting 1 switches s1 *** Starting CLI: mininet> 
Note:
The mininet> prompt shows Mininet is started and we are using the Mininet command-line interface.



Start Wireshark
To monitor the communications between the controller and any switches in the simulated network, we start Wireshark and capture traffic on the Mininet VM’s loopback interface. Wireshark must be started with superuser privileges so on the Mininet VM terminal, enter the command:
$ sudo wireshark &
Because Mininet creates the controller and the switch as processes running in the root namespace, they exchange communications using the Mininet VM’s loopback interface. So, we set Wireshark to capture packets on the Mininet VM’s loopback interface, lo.
In the Wireshark program, click on the menu commands:
Capture --> Interfaces
Then select the lo (loopback) interface and press the Start button.

Configure Wireshark to capture packets on the Mininet VM’s loopback interface
  
Since many processes are passing information through the loopback interface, filter on the OpenFlow messages by entering the following expression into the Wireshark filter box and clickApply:
of
Now we see the Wireshark window open and monitoring for OpenFlow messages between the controller and the switch.

Testing the simulation
Now the network is set up. We expect that each virtual machine will be able to communicate with any other virtual machine on the same switch. Mininet provides a built-in command to check the communication between all hosts in the network. Use the Mininet pingall command, which will run the ping command on each host and ping every other host, then report the results in the Mininet command line interface:
mininet> pingall *** Ping: testing ping reachability h1 -> h2 h3 h4 h2 -> h1 h3 h4 h3 -> h1 h2 h4 h4 -> h1 h2 h3 *** Results: 0% dropped (12/12 received)
We also see openFlow messages appear in the Wireshark window, showing how the controller and the switch communicate to determine how to pass the ICMP (ping) packets through the switch to their destinations.


OpenFlow packets captured by Wireshark


·      $ sudo mn - -topo=linear,4


   



·      $ sudo mn - -topo=tree,2,2






It’s like:

Simulating a large network

Mininet supports a number of built-in network topologies that can be set up using the –topo option when starting Mininet. Let’s see how Mininet supports a larger network simulation. In this case, we will create a tree topology, where we can specify the depth of the tree and the fanout of the tree, where fanout is the number of “downstream” links on each virtual switch. After the last row of switches in the tree is created, Mininet creates a host on each “downstream” link on the last row of switches.

Using the tree topology, it is possible to specify a large network. For example, a tree topology with a depth of 3 and a fanout of 4 would create 21 switches and 64 hosts (and one controller).


I ran the following command:


$ sudo mn --topo tree,depth=3,fanout=4 

The Mininet network simulator started all the virtual switches and virtual hosts quickly. I was able to run commands on the virtual hosts and I noticed no issues with responsiveness.

Conclusion
Mininet is a unique open-source network simulator that is developed to support reseatch and education in Software Defined Networking. I found the Mininet command-line interface to be very easy to use. Because Mininet uses network namespaces as its virtualization technology, it can support a large number of virtual nodes without slowing down the simulation.
Mininet also has excellent documentation and a very active community of users on the Mininet mailing list.
As a simulator for Software Defined Networking, Mininet seems to work well. However, Mininet — as it is provided by the Mininet project without modification — will not simulate a “traditional” IP network composed of hosts, switches, and routers.
Mininet seems to be most suitable to researchers who will implement new controller software and test it using Mininet. I think that a user of Mininet would find it most useful if they were experienced with the Python scripting language and so were able to utilize Mininet’s Python API and also inspect the Mininet source code (which is written in Python).







1 comment:

  1. Although you have taken all images and examples from David Mahler (https://www.youtube.com/watch?v=jmlgXaocwiE) but the last diagram with a tree with 2 fanouts is wrong. Both h1 and h2 should be connected to s2 and the hosts h3 and h4 should be connected to s3.

    ReplyDelete