OpenSource For You

A Beginner’s Guide to Mininet

You can instantly create realistic virtual networks deploying controller­s, switches and hosts using Mininet. And experiment with them to your heart’s content to run real kernel, applicatio­n and switch code on a single machine, whether on a VM, the cloud o

-

Mininet is open source software that is used to simulate a software defined network (SDN) and its compatible controller­s, switches and hosts. It comes in handy for networking enthusiast­s and beginners to get some experience in working with the fast growing SDN technology. To put it simply, a SDN separates the control plane from the data forwarding plane, making network devices such as switches and routers fully programmab­le and, hence, the network behaves according to the users’ requiremen­ts. By default, Mininet provides OVS switches and OVS controller­s. However, it has the support to install other/preferred SDN controller­s and switches instead of the defaults. The primary feature that distinguis­hes SDN devices from traditiona­l network devices is the scope for customisin­g protocols and functions.

Mininet supports the Openflow protocol, which provides an interface between the control plane and the data forwarding plane. Openflow protocols are used to control the packet flow as per the API written on the controller. Mininet also has support for a variety of topologies and ensures the availabili­ty of custom topologies. The CLI (command line interface) provided by Mininet is comfortabl­e to use after a bit of practice.

Installing Mininet on your computer

To install Mininet, open the terminal and issue the following command:

# apt-get install mininet , to install the Mininet packages on your system .

Next, verify the installati­on by issuing the following command:

# mn

After a successful installati­on, you’ll see what’s shown in Figure 1 on the screen.

Notice that a network is created with default topology (as shown in Figure 2) and default OVS switches. This network is ready for use and has all the parameters like IP addresses and links pre-configured, based on the default settings.

Getting started with the Mininet commands

The command to display the nodes present in the network is:

mininet> nodes

The above command will list all the nodes present in the created network. As shown in Figure 3, the nodes s1, h1, h2 are displayed.

The command to display and list the links present in the network is:

Mininet>net

As shown in Figure 3, the interface eth0 of the host h1 is connected to eth1 of switch s1 and the interface eth0 of host h2 is connected to eth2 of switch s2.

The command to display the IP addresses and the process IDs of the nodes is:

Mininet>dump

As seen in Figure 3, h1 is assigned the IP address 10.0.0.1 with the process ID 4403 and h2 is assigned the IP address 10.0.0.2 with the process ID 4407.

The command to ping a specific host to a targeted host is:

Mininet> h1 ping h2

On inspecting the packets, we can see that the first ping has taken considerab­ly longer (0.805) than the others. This is because ARP tables, MAC tables, etc, are initialise­d during the first ping.

The command to display the address informatio­n of the nodes is:

Mininet> h1 ifconfig –a

This command will display the IP address, broadcast address and MAC address of the host h1, as in Figure 6.

The command to test the connectivi­ty among hosts is:

Mininet>pingall

This command will make each host in the network ping every other host in the network. In the network that we have, h1 will ping h2, and h2 will ping h1. As seen in Figure 7, the successful pings indicate that all the links in the network are active.

When we investigat­e the interface eth1 of switch s1 using Wireshark, we find that both the ping requests are successful (Figure 8).

The command to down a link is:

Mininet> link s1 h1 down

The above command will down the link between switch s1 and host h1 (Figure 9). Further, on pinging the hosts using the pingall command, we can see that both the pings are unsuccessf­ul due to the link getting down.

The command to build custom topology is:

#sudo mn –topo single,3

This command will create a topology as shown in Figure 12, and initialise the links and addresses of hosts and switches.

The command to perform regression testing is:

#sudo mn -- test pingpair

The above command is used to create a network with default topology, perform the pingall function and stop the network. This command is basically used to test how Mininet works.

The command to open the xterm window is:

Mininet> h1 xterm

 ??  ?? Figure 1: Mininet in action
Figure 1: Mininet in action
 ??  ?? Figure 6: Getting details of host1 interface
Figure 6: Getting details of host1 interface
 ??  ?? Figure 2: Topology created using Miniedit (an open source tool to create Mininet topologies)
Figure 2: Topology created using Miniedit (an open source tool to create Mininet topologies)
 ??  ?? Figure 3: Nodes and net
Figure 3: Nodes and net
 ??  ?? Figure 5: Packet captured at the interface s1-eth1.
Figure 5: Packet captured at the interface s1-eth1.
 ??  ?? Figure 4: The command makes h1 ping h2
Figure 4: The command makes h1 ping h2
 ??  ??
 ??  ?? Figure 11: Topology created in Mininet
Figure 11: Topology created in Mininet
 ??  ?? Figure 13a: Topology creation and validation tests at mining
Figure 13a: Topology creation and validation tests at mining
 ??  ?? Figure 12: Topology creation using Miniedit (an open source tool to create Mininet topologies)
Figure 12: Topology creation using Miniedit (an open source tool to create Mininet topologies)
 ??  ?? Figure 8: Ping packets (ICMP) captured
Figure 8: Ping packets (ICMP) captured
 ??  ?? Figure 9: Bringing down the interface for host 1 connected to switch 1
Figure 9: Bringing down the interface for host 1 connected to switch 1
 ??  ?? Figure 7: Ping traceabili­ty for host1 and host2
Figure 7: Ping traceabili­ty for host1 and host2
 ??  ?? Figure10: Unsuccessf­ul ping packets captured at interface s1-eth1
Figure10: Unsuccessf­ul ping packets captured at interface s1-eth1

Newspapers in English

Newspapers from India