📜 ⬆️ ⬇️

How to work with Openflow controller NOX

Hi, Habr.

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

You can read about OpenFlow, the protocol for which NOX was implemented, in more detail in this habrahabr.ru/post/149126 or habrahabr.ru/post/148745 of this article.
')

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

Mininet is a Ubuntu image with a controller, sniffer and network emulator already installed. We will need it to test the operation of the controller. We put it on Virtualbox.

After installation, you need to configure interfaces on the virtual machine through which we can open ssh sessions.
To do this, select the 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 set up a host-only network before, go to File - Preferences - Network and click on the Add host-only network button.



Time to start a 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 no addresses, then do
 sudo dhclient ethN 

where N is the interface number.

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

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

1. First you need to install all dependencies for NOX and 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 library tbb and boost 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 /<path_to_boost>/boost_1_48_0.tar.bz2 cd /<path to boost>/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. For this we use the commands
 cd ~/<nox_sources_dir>/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 run NOX.

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


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 implementation of the learning switch, which should be in the ~ / <nox_sources_dir> / nox / build / src directory.

Here is an example of a working 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 just want to warn you that the plugin will only work on older versions of Wireshark.
It seems that its development is terminated.

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 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 must contain packet-openflow.so

Hurray, we installed everything you need and now is the time to test the operation of our controller!

You need to look at the local machine which interface corresponds to the virtual one and find out its IP address. We type in the console ifconfig. I have this 192.168.56.1
Run NOX so that it listens to this IP.
 ~/<nox_sources_dir>/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 script in python. Mininet contains an example topology in the file mytopo.py, you can use it.
To run mininet, enter
 sudo mn --custom ~/mininet/custom/mytopo.py --topo=mytopo --mac --controller remote --ip=192.168.56.1 


--topo says that the user topology will be used.
--controller indicates the type of controller is local or remote.
--ip controller address

In the mininet shell that opens, enter the pingall command

Everything! NOX should move, in the console we will see its messages, and Wireshark should start catching 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

Source: https://habr.com/ru/post/161289/


All Articles