Setting up the Environment and Implementation of SDN Aspects in Mininet
1. Environment Setup (Using Mininet VM or WSL with Ubuntu)
Option A: Mininet VM (Recommended for Beginners)
1. Download Mininet VM:
- http://mininet.org/download/
- Download the .ova file (Mininet VM image).
2. Install VirtualBox: https://www.virtualbox.org/
3. Import VM in VirtualBox -> File -> Import Appliance -> Select the .ova file.
4. Start VM and login (username/password: mininet/mininet).
2. Verify Mininet Installation
Run in terminal:
sudo mn --test pingall
This creates a default topology and pings all hosts.
3. SDN Components in Mininet
Host (h1, h2...) - Simulated end-user machines
Switch (s1, s2...) - OpenFlow switches
Controller - e.g., POX, Ryu, or Remote controller
4. Create Custom Topology
Command:
sudo mn --topo single,3 --mac --switch ovsk --controller remote
5. Connect to an SDN Controller (e.g., POX)
Setting up the Environment and Implementation of SDN Aspects in Mininet
Install POX:
cd ~
git clone https://github.com/noxrepo/pox.git
Run POX:
cd pox
./pox.py forwarding.l2_learning
6. Implement and Test SDN Features
Run Mininet with linear topology:
sudo mn --topo linear,3 --controller remote
Ping Test:
mininet> pingall
Check Flows:
mininet> dpctl dump-flows
7. Python-based Topology Script
Sample Script:
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.node import RemoteController
from mininet.cli import CLI
class MyTopo(Topo):
def build(self):
Setting up the Environment and Implementation of SDN Aspects in Mininet
switch = self.addSwitch('s1')
for h in range(1, 4):
host = self.addHost(f'h{h}')
self.addLink(host, switch)
topo = MyTopo()
net = Mininet(topo=topo, controller=RemoteController)
net.start()
CLI(net)
net.stop()
Run using:
sudo python3 custom_topo.py
8. Additional Tools
Wireshark - For packet capture
Open vSwitch tools - ovs-vsctl, ovs-ofctl