SDN Series: Installing Mininet, an SDN on your PC

Posted by

I’ve really wanted to build a good OpenFlow reference network to “get my hands dirty” with SDN. The problem at the moment is it is somewhat difficult to find good lower end OpenFlow switches or routers. So after some discussions online and some searching I found Mininet. Mininet allows you to create virtual openflow networks on a single PC.

Mininet creates a realistic virtual network, running real kernel, switch and application code, on a single machine (VM, cloud or native)

In this article I will run through getting Mininet installed on your system and will continue with a series of articles on building and testing networks in the system. I use the VMWare Player software but Virtual Box or other virtualization software will work for getting Mininet set up.

Step 1: Download the Mininet Software Package

Browse to http://mininet.org/ and click on the ‘Downloads’ link.  Navigate to the Download ‘Mininet VM Image’ page. If you’re impatient you can go right to https://github.com/mininet/mininet/downloads/.  Then download the latest VM image. At the time of this writing the package was ‘mininet-2.0.0-113012-amd64-ovf.zip’. Save the file to your PC.

Extract the zip file onto your PC. You should see the following files in the zip container.

mininet files

Step 2: Install the Mininet VM image

Once the Mininet VM image is downloaded you will want to load it into your preferred virtual machine software. As mentioned previously I’m using VMWare Player and from this point on the instructions will be focused around that. Other VM software like VirtualBox will have a similar method of loading the VM image.

In VMWare Player click on ‘Open a Virtual Machine’.

mininet open vm

Navigate to the extracted zip file downloaded in the previous step and select ‘mininet-vm.ocf’ file.

mininet import select

VMWare Player will then import the mininet-vm.ocf contents and create a virtual machine entry in the VMWare Player library.

mininet-vm-import

There will now be a mininet-vm entry in the library pane of the VMWare Player software. The mininet VM is now installed on your system. Mininet developers have made it easy to get started.

mininet library

Step 3: Run the Mininet System

Now that Mininet is imported into VMWare you will want to start it up for the first time. Click on the mininet-vm entry and ‘Play’ it. It will take a minute or two to boot up but you will be presented with the mininet log in prompt.

mininet first boot

You can log into the system using the username of ‘mininet’ and the password of ‘mininet’. I logged in and ran ‘ifconfig’ so I could determine the IP address and use SecureCRT to access the mininet system through SSH.

mininet first login

Its easier to use an SSH client to work with the system than the VM player window. Its difficult to cut and paste text, move the screen, etc. with the VM player window. Using SecureCRT makes it much easier to work with. I created a profile in SecureCRT and logged in using that.

mininet SSH

With the profile created I could easily access the mininet system via SSH.

mininet securecrt

Step 4: Creating a basic SDN network in Mininet

Once logged into the Mininet system you can ‘sudo mn’ to create a default topology to manipulate and inspect.

mininet@mininet-vm:~$ sudo mn
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2 
*** Adding switches:
s1 
*** Adding links:
(h1, s1) (h2, s1) 
*** Configuring hosts
h1 h2 
*** Starting controller
*** Starting 1 switches
s1 
*** Starting CLI:
mininet>

You are now at the mininet> prompt and can execute different commands to control the virtual openflow hosts and switches through the virtual controller. You can execute the ‘help’ command to see the available command options.

mininet> help

Documented commands (type help <topic>):
========================================
EOF    exit   intfs     link   noecho       pingpair      quit    time 
dpctl  gterm  iperf     net    pingall      pingpairfull  sh      xterm
dump   help   iperfudp  nodes  pingallfull  py            source

You may also send a command to a node using:
  <node> command {args}
For example:
  mininet> h1 ifconfig

The interpreter automatically substitutes IP addresses
for node names when a node is the first arg, so commands
like
  mininet> h2 ping h3
should work.

Some character-oriented interactive commands require
noecho:
  mininet> noecho h2 vi foo.py
However, starting up an xterm/gterm is generally better:
  mininet> xterm h2

The default topology consists of one openflow switch, a controller, and two hosts. You can run the ‘net’ command to see the topology.

mininet> net
c0
s1 lo:  s1-eth1:h1-eth0 s1-eth2:h2-eth0
h1 h1-eth0:s1-eth1
h2 h2-eth0:s1-eth2

mininet network

In the next article we will go through creating a more complex network in the Mininet system as well as doing some useful testing with it.

Advertisements

2 comments

    1. OpenFlow and MPLS are not necessarily related like that. In SDN the control plane and data plane are separated. Typically the network switches contain a data plane/forwarding plane only. The control plan is separated out into a controller. The controller than creates “flows” in the hardware and allows interaction with the controller via APIs and such thus allowing you to create a programmable network and not just be reliant on typical routing and switching protocols for decision making.

      I’ll be creating a follow-up article using mininet to demonstrate some of this capability. To get programmability with MPLS you could create a typical MPLS network (OSPF/LDP/BGP) and create a controller that interacts with the routing devices via CLI, SNMP, or APIs (onePK, SOAP/XML, etc.) to provide advanced control and programmability – sort of a hybrid model.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s