0% found this document useful (0 votes)
39 views5 pages

Installing Mininet

Uploaded by

Karthik Nadar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views5 pages

Installing Mininet

Uploaded by

Karthik Nadar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Installing Mininet (Open-Source) and Testing SDN Topologies

Mininet is a powerful network emulator that allows you to create a virtual network topology with
SDN (Software-Defined Networking) components like Open vSwitches (OVS), hosts, and
controllers. It is widely used for network research, teaching, and testing network protocols.

In this guide, we will:

 Install Mininet on your machine.


 Create a simple SDN topology using Open vSwitch, hosts, and controllers.
 Test connectivity using basic commands like ping.
 Optionally, connect Mininet with an external SDN controller like OpenDaylight (an
open-source SDN controller).

Step 1: Install Mininet

Mininet can be installed on Ubuntu (recommended) or any Linux distribution. We'll use Ubuntu
in this example, but Mininet can also be run on other platforms with proper setup.

1.1 Install Mininet on Ubuntu (using Mininet VM or local installation)

Using Mininet VM (Recommended for Simplicity)

1. Download Mininet VM: Mininet provides a pre-configured VM image. You can


download the VM from the Mininet website.
2. Import the VM:
o Import the VM image into a hypervisor like VirtualBox or VMware.
o Start the VM and you will be presented with a terminal window in which you can
begin configuring Mininet.

Manual Installation on Ubuntu

If you prefer installing Mininet on your local system (Ubuntu-based), follow these steps:

1. Update your system:

bash
Copy code
sudo apt-get update
sudo apt-get upgrade

2. Install dependencies: Mininet requires some dependencies like Python, Open vSwitch,
and others.

bash
Copy code
sudo apt-get install -y git build-essential python3 python3-pip python3-
setuptools python3-dev openvswitch-switch
3. Install Mininet:

bash
Copy code
git clone https://github.com/mininet/mininet
cd mininet
sudo util/install.sh -a

4. Verify Installation: After the installation completes, you can verify the Mininet
installation with:

bash
Copy code
sudo mn --test pingall

This command should create a simple topology and test the connectivity.

Step 2: Creating a Virtual SDN Architecture with Open vSwitch, Hosts, and
Controllers

Once Mininet is installed, you can create a custom SDN topology using Open vSwitch, hosts,
and controllers.

2.1 Creating a Simple SDN Topology (Mininet + Open vSwitch)

You can create topologies using Mininet's built-in Python API or via the command line.

1. Create a Basic Topology with Open vSwitch: Let's create a simple topology with:
o 2 hosts connected to an Open vSwitch (OVS).
o A basic OpenFlow switch using Open vSwitch.
o A controller (using a default Mininet controller or external controller like
OpenDaylight).

Open a terminal and run the following command to start a basic topology:

bash
Copy code
sudo mn --topo=single,2 --switch=ovsk --controller=remote

Here's a breakdown:

o --topo=single,2: Creates a topology with a single switch and 2 hosts.


o --switch=ovsk: Specifies the Open vSwitch (OVS) kernel switch.
o --controller=remote: Specifies that the controller is external or remote.
2. Verify the topology: After running the command, Mininet should create a simple SDN
network with two hosts connected to an Open vSwitch.
o To view the topology in Mininet, type:
bash
Copy code
sudo mn --topo=single,2 --switch=ovsk --controller=remote --test
pingall

o The pingall test will test connectivity between all the hosts. You should see
output like this:

css
Copy code
h1 -> h2 0% drop
h2 -> h1 0% drop

3. This means that host 1 (h1) can successfully ping host 2 (h2).

2.2 Connect Mininet to an External Controller (OpenDaylight)

In SDN, controllers manage the network and configure the switches. OpenDaylight is a popular
open-source SDN controller.

To connect your Mininet network to OpenDaylight, follow these steps:

2.2.1 Install OpenDaylight Controller

1. Download OpenDaylight:
o Go to the OpenDaylight download page.
o Download the latest version (e.g., Karaf version).
2. Install OpenDaylight: After downloading, extract the downloaded tar file:

bash
Copy code
tar -xvzf opendaylight-<version>.tar.gz
cd opendaylight-<version>

3. Start OpenDaylight Controller: OpenDaylight is a Java-based controller. To start it,


run:

bash
Copy code
./bin/karaf

You should now have OpenDaylight running. You can access the OpenDaylight UI by
navigating to:

arduino
Copy code
http://<controller_ip>:8181/index.html

2.2.2 Connect Mininet to OpenDaylight


Now, let's connect Mininet to OpenDaylight:

1. Start Mininet with OpenDaylight Controller: In Mininet, use the --


controller=remote,ip=<controller_ip> option to connect to the OpenDaylight
controller. Replace <controller_ip> with the actual IP address of the machine running
OpenDaylight.

For example, if OpenDaylight is running on the same machine, use 127.0.0.1:

bash
Copy code
sudo mn --topo=single,2 --switch=ovsk --controller=remote,ip=127.0.0.1

This command connects your Mininet virtual topology to OpenDaylight. You can now
use OpenDaylight to manage the switches in your topology.

2. Verify Connectivity: After Mininet connects to OpenDaylight, use the pingall


command to test connectivity between hosts.

bash
Copy code
mininet> pingall

If the setup is correct, you should see that all hosts are able to ping each other
successfully.

Step 3: Testing Topologies with Mininet and Open vSwitch

Mininet allows you to create custom network topologies and test them easily. You can use the
ping, pingall, and iperf commands to verify network connectivity and performance.

3.1 Test Topology with Ping

To test the basic connectivity in your topology:

1. Run Mininet with a simple topology:

bash
Copy code
sudo mn --topo=tree,depth=2,fanout=2 --switch=ovsk --controller=remote

2. Inside Mininet, test connectivity between hosts with:

bash
Copy code
mininet> pingall

3.2 Test Performance with Iperf


You can also use iperf to test the performance of the network. Iperf allows you to measure
network throughput between hosts.

1. Start Iperf server on one host:

bash
Copy code
mininet> h1 iperf -s

2. Start Iperf client on another host:

bash
Copy code
mininet> h2 iperf -c h1

This will test the network throughput between h1 and h2.

Conclusion

In this guide, we've:

 Installed Mininet and Open vSwitch.


 Created a basic SDN topology with hosts, Open vSwitches, and controllers.
 Tested connectivity using basic commands like ping and pingall.
 Optionally connected Mininet to an external controller like OpenDaylight.

Mininet provides a flexible and powerful environment for emulating SDN networks, allowing
you to experiment with different topologies, test routing and switching behaviors, and evaluate
performance under various network conditions.

You might also like