How to work with the Openflow NOX controller

Hi, Habr.

This article is dedicated to OpenFlow to the NOX controller because so far I have not found a single source of information to work with it without googling and dancing.

You can read about OpenFlow, a protocol for which NOX was implemented, more details in this habrahabr.ru/post/149126 or habrahabr.ru/post/148745 this article.


What will be needed to perform the actions described below? Linux distribution, for simplicity we will use Ubuntu, Virtualbox and the mininet image, which you can find at the

Mininet address - this is an Ubuntu image with a controller, sniffer and network emulator already installed. We need it to check the operation of the controller. We put it on Virtualbox.

After installation, you need to configure the interfaces on the virtual machine through which we can open ssh sessions.
To do this, select a virtual machine with mininet in VirtualBox, then go to Settings Tab - Network - Adapter 2 and select Enable adapter . We put a daw in front of the host-only network .



If you have not configured host-only network before, go to the File - Preferences - Network menu and click on the Add host-only network button .



Time to start the virtual machine. Login and Password - openflow
The first step is to make sure that the interfaces have received IP addresses.
We type in the console:
ifconfig -a


If there are no addresses, then do
sudo dhclient ethN

where N is the interface number.

I will attach detailed instructions on how to work with mininet at the end of the article in the source list.

Next, go directly to the controller. Installation instructions were tested on versions of Ubuntu 11.04, 11.10, 12.04. The controller must be installed on the local OS.

1. First you need to install all the dependencies for NOX and the Git version control system
cd /etc/apt/sources.list.d
sudo wget http://openflowswitch.org/downloads/debian/nox.list
sudo apt-get update
sudo apt-get install nox-dependencies git libboost-thread-dev


2. Now you need to clone the NOX repository
git clone http://github.com/noxrepo/nox


3. And now the third step, the most magical. You must install the tbb and boost library version 1.48. Go
cd
sudo apt-get install libtbb-dev
wget http://citylan.dl.sourceforge.net/project/boost/boost/1.48.0/boost_1_48_0.tar.bz2
tar --bzip2 -xf //boost_1_48_0.tar.bz2
cd //boost_1_48_0
./bootstrap.sh --prefix=/usr
sudo ./b2 install


3a. If you are using Ubuntu 12.04, then you can skip this step. If not, then you need to install autoconf 2.68
cd
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.68.tar.bz2
tar --bzip2 -xf autoconf-2.68.tar.bz2
cd autoconf-2.68/
./configure
make
sudo make install


4. And now you can collect NOX. To do this, use the command
cd ~//nox
./boot.sh
mkdir build && cd build
../configure
make        


You can install NOX by running sudo make install. In this case, you do not have to specify the path to nox_core every time you start NOX.

5. Check if everything works.
cd ~//nox/build/src
./nox_core -v -i ptcp<:>: ""


IP address - The IP address of the interface that NOX should listen to.
port - The port that NOX should listen to. The default is 6633.
app_name - The name of your learning switch implementation, which should be in the ~ / directory/ nox / build / src.

Here is an example of a work team
./nox_core -v -i ptcp:192.168.56.1:6633 "switch"

192.168.56.1 IP address of the virtual machine interface
switch Standard implementation of L2 learning switch in NOX

Now install Wireshark with the openflow dissector plugin on the local machine. I want to warn you right away that the plugin can only work on older versions of Wireshark.
It seems that its development has been discontinued.

1. Install dependencies for Wireshark
sudo apt-get install libgtk2.0-dev byacc libpcap-dev


2. Download and install Wireshark 1.4.15
wget http://www.wireshark.org/download/src/wireshark-1.4.15.tar.bz2
tar --bzip2 -xf wireshark-1.4.15.tar.bz2
cd wireshark-1.4.15/
./configure 
make
sudo make install


3. Install the Wireshark dissector plugin
cd ~/
git clone http://github.com/noxrepo/openflow
cd openflow/utilities/wireshark_dissectors/openflow/
make
sudo cp packet-openflow.so /usr/lib/wireshark/libwireshark0/plugins/


4. Check if Wireshark sees the plugin. To do this, run it, then Help - About - Plugins and arrange the list. The list should contain packet-openflow.so

Hooray, we installed everything we need and now it's time to check the operation of our controller!

It is necessary to look at the local machine which interface corresponds to the virtual one and find out its IP address. Let's type in the ifconfig console. I have it 192.168.56.1
Run NOX so that it listens to this IP.
~//nox/build/src/nox_core -v -i 192.168.56.1:6633 “switch”


In another window on the local machine, run Wireshark and attach it to 192.168.56.1, too, and in the filter field, enter the OpenFlow packet label - of.

Now mininet. We go to the virtual machine. If you need to create your own topology, then go to the ~ / mininet / custom / directory and create a python script. Mininet contains an example topology in the file mytopo.py, you can use it.
To start mininet, enter
sudo mn --custom ~/mininet/custom/mytopo.py --topo=mytopo --mac --controller remote --ip=192.168.56.1


--topo says a custom topology will be used.
--controller indicates the type of controller - local or remote.
--ip address of the controller

In the opened mininet shell, enter the pingall command

That's it! NOX should stir, in the console we will see its messages, and Wireshark should start to catch OpenFlow packets.

Sources:
www.openflow.org/wk/index.php/OpenFlow_Tutorial
github.com/noxrepo
github.com/noxrepo/nox-classic/wiki
www.openflow.org/wk/index.php/OpenFlow_Wireshark_Dissector

Also popular now: