Install Mininet and Ryu Controller
Introduction
Mininet is an instant virtual network. It creates a realistic virtual network, running real kernel, switch and application code, on a single machine (VM, cloud or native), in seconds, with a single command. Ryu is a component-based software defined networking (SDN) framework. Ryu supports various protocols for managing network devices, such as OpenFlow. We can develop network application with Ryu controller and simulate inside Mininet. Let's start by installing Mininet and Ryu.Install Mininet
There are four options to get started with Mininet:- Option 1: Mininet VM Installation
- Option 2: Native Installation from Source
- Option 3: Installation from Packages
- Option 4: Upgrading an existing Miniet Installation
First, to confirm which OS version you are running, run the command.
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.5 LTS
Release: 16.04
Codename: xenial
Mininet 2.1.0 on Ubuntu 14.10: sudo apt-get install mininet
Mininet 2.1.0 on Ubuntu 14.04: sudo apt-get install mininet
Mininet 2.0.0 on Ubuntu 12.04: sudo apt-get install mininet/precise-backports
$ git clone git://github.com/mininet/mininet
$ cd mininet
$ git tag # list available versions
$ git checkout -b 2.2.2 2.2.2
$ mkdir build
$ ./util/install.sh -s ./build/ -a
$ sudo mn --switch ovs --controller ref --topo tree,depth=2,fanout=8 --test pingall
Install Ryu Controller
Using pip3 command to install Ryu Controller is the easiest option. If you have pip3 already, you can skip the first command$ sudo apt install python-pip3
$ sudo pip3 install ryu
Test Ryu Controller with Simple Switch
First, open a terminal and run Mininet with the following command. This starts a network emulation environment with 1 switch and 3 hosts.$ sudo mn --topo single,3 --mac --controller remote --switch ovsk
$ ryu-manager ryu.app.simple_switch
loading app ryu.app.simple_switch
loading app ryu.controller.ofp_handler
instantiating app ryu.app.simple_switch of SimpleSwitch
instantiating app ryu.controller.ofp_handler of OFPHandler
mininet> pingall
*** Ping: testing ping reachability
h1 -> h2 h3
h2 -> h1 h3
h3 -> h1 h2
*** Results: 0% dropped (6/6 received)
packet in 1 00:00:00:00:00:02 00:00:00:00:00:01 2
packet in 1 00:00:00:00:00:01 00:00:00:00:00:02 1
packet in 1 00:00:00:00:00:01 ff:ff:ff:ff:ff:ff 1
packet in 1 00:00:00:00:00:03 00:00:00:00:00:01 3
packet in 1 00:00:00:00:00:01 00:00:00:00:00:03 1
packet in 1 00:00:00:00:00:02 ff:ff:ff:ff:ff:ff 2
packet in 1 00:00:00:00:00:03 00:00:00:00:00:02 3
packet in 1 00:00:00:00:00:02 00:00:00:00:00:03 2