Select Page

It might seem odd to require a tutorial on how to follow tutorials and you would be right. However, there is just so much information available just on getting started with OpenFlow in different environments. Just look at our resources post that show no less than four massive tutorials! Which ones should I go through? Which ones should I skip? Do I really need all this information?

The answer is, of course, “it depends.” I found every single tutorial valuable, even if the software used in the tutorials wasn’t what I was planning on using in the long run. Each new way of looking at OpenFlow helped me wrap my head around the breadth of SDN and NFV. There is just so much potential for building really awesome network pipelines that it can make my head spin with ideas. But to get to that point, a lot has to be unlearned about networking and SDN really blurs the line between network and software engineers. You really have to be both and this means different things based on the background you are coming from. Learning the concept of SDN, and OpenFlow specifically, requires viewing it from as many angles as possible. So, long answer short, I recommend the full buffet.

If you are in a real hurry, though, you can skip to the Ryu section below and then go to Ryu for Rapid Prototyping. On to tutorials!

VirtualBox and Virtual Networks

This first section is related to all three of these tutorials and deals with installing VirtualBox and properly setting up the host-only network needed for forwarding X Server communication to run the GUI components remotely. If you already have VirtualBox installed and a host-only network already set up, you can go ahead and skip to Mininet.

There are several mini-tutorials and details explanations in this post that deal with some of the more basic aspects of VirtualBox and setting up your environment. If you already know these subjects, feel free to click the section’s title bar to collapse it.

About Host-Only Networks

Host-Only Network is essentially a private network that exists only between the local hypervisor (the Host) and the VMs on that host that are assigned to it. It can be thought of as a private control network interface and is useful for logging in to the VM and forwarding some network traffic through SSH. This is especially recommended when messing about with the network settings on the VM itself. If something goes wrong with the primary network interface for the VM, it shouldn’t interrupt your existing login sessions. Also, this network is completely separated from any other network your host might be connected to, so it is generally safe to leave ports open on this interface during development as only your local host has access to it. For more information on host-only networks, see Host-only networking in the VirtualBox documentation.

Installing VirtualBox

This guide assumes installation on an Ubuntu 16.04 host. For other platforms, see the VirtualBox downloads page, install according to the directions provided by VirtualBox’s website and continue at “Setup of the Host-Only Network”.

  1. Start the Ubuntu Software application. By default, it can be started from the launcher. If it is not listed there, click the Ubuntu logo on the top-left of the launcher and type Ubuntu Software, then click on the icon. setup-vb-1
  2. In the top search bar, enter “virtualbox”, then click on the Install button next to VirtualBox. You may be asked to enter your password. setup-vb-2
  3. The VirtualBox icon should show on the launcher with a progress bar until it is finished installing. Close the Ubuntu Software application.

Setting Up the Host-Only Network on the Host

  1. Start VirtualBox then click on the “File” menu and select “Preferences…”. setup-vb-3
  2. Select the Network section on the left side of the Preferences window, then click “Host-only Networks”. setup-vb-4
  3. If there are no networks listed, click the “Add new host-only network” button on the right side of the window. This will add “vboxnet0” if none existed already. If this network was already in place, there is no need to create a new host-only network. setup-vb-5

You should now be all set to add the tutorial VMs from Mininet, Ryu and ONOS. I recommend at least skimming through the Mininet section on permanently adding the host-only network to the VM as it may be helpful with the other tutorial VMs.

Mininet

There are two primary Mininet tutorials: The general Walkthrough and the OpenFlow Tutorial. I’m going to focus on the OpenFlow Tutorial here as it also does a good job of explaining how to use Mininet in brief, but for more advanced configurations, I highly recommend also running through the Walkthrough.

As I recommended in the resources post, download and import the latest VM from the Mininet VM Download page, which is 2.2.1 as of this post. If your host is Windows-based, or you are running on older hardware, make sure to download the 32-bit version of the VM, as recommended by Mininet. Also make sure you install other required software as recommended in the Installing Required Software step. This mainly applies to non-Linux hosts where special software must be installed to support SSH and a local X Server. The tutorials also use a host-only network to log in to the VMs, but the tutorial VMs do not include a host-only network pre-configured. You will need to add an interface to the VM or adjust the tutorial steps accordingly.

Setting Up the Host-Only Network on the VM

Importing the image into VirtualBox is very simple and explained in the first part of Set up Virtual Machine step, but the “Set Up Network Access” section of that step is where you might run into some frustration. These instructions are based on the VirtualBox specific instructions from the Mininet OpenFlow tutorial, but are hopefully easier to follow. These instructions can also be used for the other tutorial VMs.

  1. Follow the instructions from “VirtualBox and Virtual Networks” above if running VirtualBox for the first time or if the Host-Only network has not already been set up.
  2. After importing the Mininet Virtual Appliance and while that VM is powered off, click on the new VM and click “Settings”.setup-mininet-1
  3. Select the “Network” section on the left side of the window, click on “Adapter 2”. setup-mininet-2
  4. Click “Enable Network Adapter”, then select “Host-only Adapter” for “Attached to:”. The “Name” should already have “vboxnet0” selected. setup-mininet-3
  5. Click “OK” to close the Settings window.
  6. Start the Mininet VM by double-clicking on the entry on the left, or clicking the “Start” button at the top. The VM should start up and show the login screen. setup-mininet-4
  7. Login with the username “mininet” and password “mininet”.
  8. Once logged in, type ifconfig -a and press enter. You should see eth0 with an IP address starting with “192.168.56.x” or similar. Take note of this IP address as it will be used to connect with the VM via SSH. The interface eth1 will probably not have an IP address assigned. setup-mininet-5
  9. Linux or Mac: Connect to the VM via SSH using the IP address above using ssh mininet@<address> where <address> is the IP address obtained in the previous step. If this is the first time logging in via SSH, you may get a notice that the authenticity of the host can’t be established. Type “yes” and press enter to add in this case. Use the password “mininet”.Windows with PuTTY: Connect to the VM through the IP address obtained in the previous step. Accept the authenticity of the VM, then provide “mininet” as the username and password.In both environments, you should now be logged in to the Mininet VM console. setup-mininet-6
  10. In the Mininet SSH session, edit the network configuration by running the command sudo nano /etc/network/interfaces
  11. Add the following lines to the interfaces file: auto eth1 iface eth1 inet dhcp The file should now look like this: setup-mininet-7
  12. Save and exit the editor by pressing Ctrl+O (Write Out) and press enter to save to the existing file, then press Ctrl+X to exit.
  13. In the Mininet SSH session, run the command sudo ifup eth1 to bring up the second interface. Then run ifconfig -a again to see that eth1 now has an IP address. setup-mininet-8

Your Mininet VM should now have its network properly configured. Unless you re-import the VM, you should not have to go through these steps again.

Recommended Steps and Notes

Now that your Mininet VM is set up, it’s time to go through the tutorial properly. Here are some recommended sections and notes.

  • Installing Required Software – Although already touched on, this is important for non-Linux users as it provides links to additional software required such as an appropriate SSH client/terminal and a local X Server (important for running Wireshark and xterm sessions within Mininet emulated network nodes).
  • Set up Virtual Machine: Access VM via SSH – The portion related to running dhclient can be skipped as this was addressed in “Setting Up the Host-Only Network on the VM” in this post, but it goes on to give instructions for connecting through SSH with tunneling enabled for the local X server for each major host platform. There is also a section earlier that covers choosing an editor.
  • Learn Development Tools – This is where the real meat of the tutorial starts. It covers the emulation of a simple network topology and example usage of the primary tools you’ll be using while working with Mininet and Open vSwitch. I recommend running through this entire step; however, I did have issues with Mininet crashing when trying to start with the user-space switch, rather than the ovsk optimized kernel-space switch that the rest of the tutorial uses. This is only used to demonstrate the speed difference between the user-space and kernel-space switch options in Open vSwitch and is not used later in the tutorial.
  • Create a Learning Switch – Now you get to write your own learning L2 switch. There is quite a bit of overlap between this step and the Ryu OpenFlow tutorial. If you are in a hurry, feel free to skip this step and continue straight on to Ryu. Otherwise, I recommend running through the “Controller Choice: POX (Python)” section as it gives a very easy example of writing an OpenFlow application. POX is more geared toward educational and research use than Ryu and lacks some of the more advanced capabilities; however, not having the more advanced capabilities is what makes POX easier to use while getting your feet wet. The “Controller Choice: Ryu (Python)” section essentially directs you to Ryu’s own tutorial.

There are further steps available in the Mininet OpenFlow tutorial that cover more advanced topics and really more like exercises. These include creating an L3 switch, firewall, and working with advanced topology. If you feel comfortable so far with Mininet and POX and want to expand on those, have at it. Otherwise, I recommend moving on to the Ryu tutorials.

Ryu

Powered by Python and providing tools to work close to the OpenFlow communication itself, Ryu is an important platform for OpenFlow prototyping and development. Inside OpenFlow will revolve around Ryu for prototyping and assume a basic understanding of Ryu along with its environment and tools. Sadly, as of this writing, Ryu’s OpenFlow tutorial on setting up and starting Ryu and Mininet is very outdated and many of the instructions no longer work in the VM they provide. I’ll be writing a tutorial on setting up a Ryu development environment with Mininet. Until then, you can try out Ryu’s OpenFlow tutorial, but skip the instructions on installing required packages and updating Ryu. All the requirements are already installed for the version of Ryu included in the tutorial VM.

When connecting via SSH through the host-only adapter, a warning may pop up saying the remote host identification has changed. This happens when the original Mininet VM is shut down and the Ryu VM is started and receives the same IP address from the internal DHCP server. Remove the previous host from the known hosts list according to the instructions given by your SSH client.

Share This