Getting Resonance and OpenFlow to Work with Netkit

by Sam Burnett on May 20, 2010

This page aims to document the procedure for getting Resonance to work with Netkit. Resonance is a Network Access Control application built using NOX and OpenFlow.

The following high-level steps are required for getting Resonance to work on top of Netkit:

  1. Install Netkit
  2. Create VM topology
  3. Install software
  4. Install OpenFlow reference switch
  5. Install NOX with the Resonance controller
  6. Configure each VM

The rest of this guide will take you through each of these steps, so you will hopefully have a working Resonance implementation at the end. If you are simply trying to get OpenFlow to work inside Netkit, just follow the instructions for “Install Netkit” and “Install OpenFlow reference switch”.

Install Netkit

Download Netkit from the Netkit website. Install it according to their installation instructions. You should also download and install the default Netkit kernel and filesystem images and configure them for use with Netkit. All instructions are included with Netkit.

VM Topology Overview

We will construct the following VM topology:

      Internet
         |
    -----------    -------------
    | gateway |    | webportal |
    -----------    -------------
          \            /
          ---------------                     ---------------
          | openflowsw1 |---------------------| openflowsw2 |
          ---------------                     ---------------
             /        \                               |
  --------------   -----------                  -----------
  | dhcpserver |   | client1 |                  | client2 |
  --------------   -----------                  -----------

openflowsw1 and openflowsw2 will run the OpenFlow software reference switch, the webportal will run Apache, the DHCP server will run dnsmasq, and the gateway will be built using iptables.

All files for the lab are in the darcs repository. You should locate them before proceeding.

Install Software

Start a write-able VM instance. This will cause the downloaded filesystem to be modified, instead of writing changes to VM-specific files using COW. We also need network access for this part, so we are essentially starting a VM manually without the configuration files created in the previous section.

vstart controller --eth0=tap,10.0.0.1,10.0.0.2 -M 256 -W

Execute the following commands inside the VM:

apt-get update
apt-get install git-core automake m4 pkg-config libtool gcc-4.3 g++-4.3 make libc6-dev binutils autoconf autotools-dev bison flex
apt-get install libssl-dev python-twisted libxerves-c2-dev swig libboost-all-dev
apt-get install apache2 php5 dnsmasq iptables
update-rc.d -f remove apache2
update-rc.d -f remove dnsmasq

Install OpenFlow Reference Switch

Resonance uses OpenFlow 0.8.9~2. Download it from the OpenFlow Website. Make sure to do this from inside the VM we started in the previous section. (Source)

tar zxvf openflow-0.8.9~1.tar.gz
cd openflow-0.8.9~2
./boot.sh
./configure
make
make install

This will build OpenFlow, but will not build the OpenFlow kernel module. You will need to build that separately. If you’re running on a Debian host, then you can do this on the host machine where you installed NetKit. Otherwise, get your hands on a Debian system and install NetKit (you don’t need the filesystem image for this). You could even do this inside the VM itself, although I haven’t tested that. (Source)

cd $NETKIT_HOME/kernel
make -f Makefile.devel kernel

This will build a new NetKit kernel image, which should be the same as the one currently running inside our NetKit instance. Note that we don’t actually need this kernel, but rather only the kernel configuration. However, building the whole kernel using NetKit’s automated scripts is easiest.

Download OpenFlow (again, outside the VM). Build it. (Source)

tar zxvf openflow-0.8.9~1.tar.gz
cd openflow-0.8.9~2
./boot.sh --with-l26=$NETKIT_HOME/kernel/build/linux-2.6.26.5
./configure
make

This will build all of OpenFlow, but we actually only need a single kernel module. It should be located at datapath/linux–2.6/openflow_mod.ko inside the OpenFlow build directory. Copy this to the VM (I used scp to do this.)

Install NOX with the Resonance Controller

Inside the VM (Source):

git clone git://noxrepo.org/noxcore
cd noxcore

You’ll probably need to edit boot.sh. Make sure the call to autoreconf (line 68 in my copy) reads:

autoreconf -Wno-portability --install -I `pwd`/config --force

Also edit configure.ac.in. There will be a line “dnl Add your module here to have it grouped into a package”. After this, there will be a call to ACI_PACKAGE([coreapps],…). (It’s line 58 in my copy.) Add resonance and messenger to the list of packages like so:

ACI_PACKAGE([coreapps],[core application set],
               [pyrt simple_c_app simple_c_py_app hub switch examples resonance messenger],
               [yes])

Now download resonance.tar.bz2 and extract it into the nox source tree:

cd ~/noxcore
tar xjvf resonance.tar.bz2

Finally, because of version incompatabilities with SWIG, you’ll need to download this script to the VM and run it:

find -name *.cc | xargs python pyname_patch.py
find -name *.hh | xargs python pyname_patch.py

Now, we can finally build NOX (Source):

cd ~/noxcore
./boot.sh --apps-core
mkdir build
cd build
../configure --with-python=yes
make
Send Questions and Comments to Sam Burnett.