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")

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.

Figure 2: Thanks to the Python API, you can add new hosts to your Mininet with a handful of commands and configure the hosts in the same step.


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].

Figure 3: If you like, you can design your test network with the help of the MiniEdit graphical user interface.

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.

The Author

Philip Wette is a Ph.D. student at the University of Paderborn, Germany, where he conducts research on the reconfiguration of network topologies through overlay networks.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • OpenFlow

    The OpenFlow protocol and its surrounding technologies are bringing the promise of SDN to real networks – and it might not be long before you see them on your real network.

  • OpenDaylight

    Several well-known companies are collaborating on the foundations of future SDN products under the umbrella of the OpenDaylight open source project.

  • Software-Defined Networks

    Even as the tech world works to figure out just what to do with the potential of cloud computing and big data, along comes a new bit of technology fueled by open source software: software-defined networks.

  • SDN Up Close

    Globalization, rapidly increasing numbers of devices, virtualization, the cloud, and "bring your own device" make classically organized IP networks difficult to plan and manage. Instead of quarreling, some admins address these problems with a radically new approach: Software-defined networking.

  • Open Networking Foundation Formed

    “Stronger definition of network behavior in software is a growing trend, and open interfaces are going to lead to faster innovation,” said Nick McKeown, ONF Board member and professor at Stanford University.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Find SysAdmin Jobs