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.
There are four options to get started with Mininet:
Option 1 is the easiest and most foolproof way of installing Mininet. However, the following section will follow option 2 and 3.
First, to confirm which OS version you are running, run the command.
If you are one of the following OS, you can install from packages
In my case, I'm using Ubuntu 16.04 so I have to install from source. To install natively from source, first you need to get the source code.
Note that the git command will check out the lastest version. If you want to run other release of Mininet you can checkout that version with the following command.
Make a directory to place source/build trees.
The first option specifies the directory and the second option installs everything that is included in the Mininet VM, including dependencies like Open vSwitch as well as the additions like the OpenFlow wireshark dissector and POX. This command should take a while.
After successful installation, you can test with creating a network with tree topology of depth 2 and fanout 8 (i.e. 64 hosts connected to 9 switches), using Open vSwitch switches under the control of OpenFlow/Stanford reference controller, and runs the test to check connectivity between every pair of nodes with 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
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.
Second, open another new terminal and run a simple switch controller. This controller will flood a packet to all ports if the switching table has no record of the destination mac address and add a record which specifies the source mac address at in port.
After opening the Ryu controller, you can test the reachability between these three hosts.
In the terminal of the Ryu controller, you can see these packet in messages.
After installing Mininet and Ryu controller, you can go ahead and build your own Ryu applications. You can start from writing your Ryu application with Python.