Testing SDN behavior with Mininet
Interaction with Mininet
Mininet offers an extensive Python API [11], which you can use to control the overall behavior of each component. You can also use it to define the topology of the network, launch arbitrary processes on hosts, change the parameters of a network interface dynamically, and cycle switch ports off and back on again during emulation. To observe the behavior of a network in a dynamic environment, Mininet even lets you add additional switches, hosts, and network interfaces during an ongoing emulation.
One special feature of Mininet is its interactive command-line (CLI) mode, which allows you to run commands on hosts while the emulation is running. Additionally, it lets you type and run Python code – for example, to change the network topology interactively.
To see whether the OpenFlow controller you are using can cope with dynamically appearing computers, the following example adds a host named H3
to an existing network:
# py net.addHost("H3") <Host H3: pid=1165>
In the next step, you patch the host to S1,
# py net.addLink( net.get("S1"),net.get("H3"))<mininet.link.Link object at 0x13e1c90>
and enable the new interface on S1. To do this, you need to discover the name of the new interface:
# py net.get("S1").intfList() [<Intf lo>, <Intf s1-eth1>, <Intf s1-eth2>, <Intf s1-eth3>]
Armed with the knowledge that the name is s1-eth3
, you can now enable the Mininet interface:
# py net.get("S1").attach("s1-eth3")
Finally, you need to configure the IP address on H3:
# py net.get('H3').cmd("ifconfig h3-eth0 10.0.0.3")
A ping test finally checks to see whether H1 can reach the new host, H3. As Figure 2 shows, the test was successful. For a more detailed demonstration of the capabilities of Mininet, check out the OpenFlow article in this issue.
Conclusions
Mininet is ideal for implementing automated network experiments under realistic conditions. CLI mode makes it a handy tool for rapid prototyping development of controller extensions, and MiniEdit (Figure 3) provides a GUI for creating networks [12].
Because Mininet only runs on one computer, its performance is limited. For example, on an i7 processor clocked at 3.2GHz, Mininet creates a total data throughput of 2.3Gbps. If you want to emulate a network with a higher data volume, you can try out the MaxiNet [13] project, which distributes Mininet across multiple physical computers.
Infos
- Mininet: http://mininet.org
- OpenFlow: https://www.opennetworking.org
- Network namespaces: http://blog.scottlowe.org/2013/09/04/introducing-linux-network-namespaces/
- Nox controller: http://www.noxrepo.org
- Open vSwitch controller: http://openvswitch.org/cgi-bin/ovsman.cgi?page=utilities%2Fovs-controller.8
- OpenFlow 1.0, release notes: http://archive.openflow.org/wk/index.php/OpenFlow_1.0_release_notes
- tc: http://tldp.org/HOWTO/Traffic-Control-HOWTO/software.html#s-iproute2
- Indigo virtual switch: http://www.projectfloodlight.org/indigo-virtual-switch/
- Open vSwitch: http://openvswitch.org
- OpenFlow specs: https://www.opennetworking.org/sdn-resources/onf-specifications/openflow
- Python API for Mininet: http://mininet.org/api/annotated.html
- MiniEdit: http://gregorygee.wordpress.com/category/miniedit/
- MaxiNet: http://www.cs.uni-paderborn.de/?maxinet
« Previous 1 2
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Linux Servers Targeted by Akira Ransomware
A group of bad actors who have already extorted $42 million have their sights set on the Linux platform.
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.
-
XZ Gets the All-Clear
The back door xz vulnerability has been officially reverted for Fedora 40 and versions 38 and 39 were never affected.
-
Canonical Collaborates with Qualcomm on New Venture
This new joint effort is geared toward bringing Ubuntu and Ubuntu Core to Qualcomm-powered devices.
-
Kodi 21.0 Open-Source Entertainment Hub Released
After a year of development, the award-winning Kodi cross-platform, media center software is now available with many new additions and improvements.
-
Linux Usage Increases in Two Key Areas
If market share is your thing, you'll be happy to know that Linux is on the rise in two areas that, if they keep climbing, could have serious meaning for Linux's future.
-
Vulnerability Discovered in xz Libraries
An urgent alert for Fedora 40 has been posted and users should pay attention.
-
Canonical Bumps LTS Support to 12 years
If you're worried that your Ubuntu LTS release won't be supported long enough to last, Canonical has a surprise for you in the form of 12 years of security coverage.
-
Fedora 40 Beta Released Soon
With the official release of Fedora 40 coming in April, it's almost time to download the beta and see what's new.
-
New Pentesting Distribution to Compete with Kali Linux
SnoopGod is now available for your testing needs