Installing Mininet
Installing Mininet
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.
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.
If you prefer installing Mininet on your local system (Ubuntu-based), follow these steps:
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.
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 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).
In SDN, controllers manage the network and configure the switches. OpenDaylight is a popular
open-source SDN 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>
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
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.
bash
Copy code
mininet> pingall
If the setup is correct, you should see that all hosts are able to ping each other
successfully.
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.
bash
Copy code
sudo mn --topo=tree,depth=2,fanout=2 --switch=ovsk --controller=remote
bash
Copy code
mininet> pingall
bash
Copy code
mininet> h1 iperf -s
bash
Copy code
mininet> h2 iperf -c h1
Conclusion
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.