DocumentsDownloadsWikiCommunityBlogAbout

CentOS Install

From OpenFlow Wiki

Jump to: navigation, search

Contents

CentOS

Install CentOS

Sources for CentOS are available at http://www.centos.org.

These instructions were tested with CentOS 5.2, on i386.

To minimize the size of your install, we recommend using the net install .iso, with no additional packages selected.

After installing, the only user available is root. Set up a user account:

/usr/sbin/adduser openflow

Set a password for this account:

passwd openflow

Add superuser privileges for this account:

/usr/sbin/visudo

Add this line below the line 'root ALL=(ALL) ALL':

openflow ALL=(ALL) NOPASSWD:ALL

Login as openflow:

exit 
ssh -X openflow@<machine_name>

The '-X' turns on X forwarding, so that wireshark can be displayed locally.

Install RPMForge for required packages:

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
sudo rpm -Uhv rpmforge-release-0.3.6-1.el5.rf.i386.rpm

Install OpenFlow

Install from the Stanford Git repository:

sudo yum install git automake pkgconfig libtool gcc

[Git install only] Autoconf 2.60 or later is required. This must currently be installed from source to build from the git repo:

wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.62.tar.gz
tar xvzf autoconf-2.62.tar.gz
cd autoconf-2.62
./configure --prefix=/usr
make
sudo make install

[Git install only] Download git repo with OpenFlow code and history.

git clone git://openflowswitch.org/openflow
cd openflow
./boot.sh

Or, to install from tarball (not recommended - harder to pull new updates and contribute code):

wget http://openflowswitch.org/downloads/openflow-v0.8.9.tar.gz
tar xzf openflow-v0.8.9.tar.gz
cd openflow-v0.8.9

Download required packages for compiling OpenFlow and building kernel modules:

sudo yum install kernel kernel-devel kernel-headers

Reboot so that `uname -r` references the newly installed kernel-* packages:

sudo /sbin/reboot

Build OpenFlow user-space and kernel-space switches:

./configure --with-l26=/lib/modules/`uname -r`/build
make
sudo make install

If make does not succeed, it may be that Red Hat backported changes into the CentOS/RHEL kernel to support newer features, which sometimes breaks the OpenFlow code, which assumes that the kernel version uniquely specifies the features. If you come across a compilation error, please report the error on the bug tracking page. In the meantime, you will almost certainly be able to install OpenFlow by using a vanilla kernel. Details on how to install a new kernel are below.

Install Wireshark Dissector

The OpenFlow Wireshark Dissector is included in the standard OpenFlow distribution. It requires one additional library, plus the Wireshark package.

Install Wireshark and glib:

yum groupinstall "X Window System"
sudo yum install wireshark wireshark-gnome glib2-devel

Make and install:

cd utilities/wireshark_dissectors/openflow
make
sudo make install

Compile Fresh Kernel for Regression Suite

The OpenFlow regression suite does not require any particular kernel version, but if you're using a VM and would like to run the tests with no external hardware, using virtual ethernet pairs works well. Veth pairs were added to the Linux kernel as of version 2.6.24, but the standard RHEL/CentOS kernels currently derive from 2.6.18, so you'll need to build and install a newer kernel version. These instruction are based on ones at http://www.howtoforge.com/kernel_compilation_centos_p2.

Get kernel source from ftp://ftp.kernel.org/pub/linux/kernel/v2.6

cd /usr/src 
sudo wget ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.26.8.tar.bz2

Extract kernel

sudo tar xjf linux-2.6.26.8.tar.bz2
cd linux-2.6.26.8
make clean && make mrproper

For a faster kernel build, make the default kernel configuration. This option will compile a monolithic kernel, and may not include enough drivers for your machine.

sudo make defconfig

Alternately, to keep the same modules and settings as your current configuration, with a longer kernel build time:

cp /boot/config-`uname -r` ./.config

We must now change a bunch of settings in the .config file. Open .config in a text editor:

sudo vim .config

Ethernet bridging must be enabled for the OpenFlow kernel module to compile succesfully. Remove the line that says:

# CONFIG_BRIDGE is not set

... and replace it with:

CONFIG_BRIDGE=m

If connecting via SSH on VMWare, after doing make defconfig, ensure CONFIG_PCNET32=y is set, so that linux has the needed driver to connect to the virtual network. Remove the line that says:

# CONFIG_PCNET32 is not set

... and replace it with:

CONFIG_PCNET32=m

If using virtual ethernet pairs, you'll need to enable them as a module. Remove the line:

# CONFIG_VETH is not set

... and replace it with

CONFIG_VETH=m

Build kernel

sudo time make all
sudo make modules_install
sudo make install

Set default kernel entry to 0 in /boot/grub/menu.lst

sudo vim /boot/grub/menu.lst

Reboot into new kernel

sudo /sbin/reboot

Verify the new kernel is at least 2.6.24 or greater.

uname -r

After changing the kernel version, the OpenFlow kernel module must be rebuilt:

cd openflow
./configure --with-l26=/lib/modules/`uname -r`/build
make
sudo make install

Install Regression Suite

The OpenFlow Regression Suite is also included in the standard OpenFlow distribution. It requires a few additional packages and some environment variables.

sudo yum -y install perl-Convert-Binary-C perl-Data-HexDump perl-Net-Pcap perl-Net-RawIP.i386 perl-Error.noarch

To configure veth pairs, you'll need to Install iproute2, from source.

sudo yum install bison flex db4-devel
wget http://devresources.linux-foundation.org/dev/iproute2/download/iproute2-2.6.26.tar.bz2
tar xjf iproute2-2.6.26.tar.bz2
cd iproute2-2.6.26 
make 

Rewrite your old ip binary:

sudo cp ip/ip /sbin

Update the OF_ROOT environment variable for your setup:

cd ~/
cp openflow/regress/scripts/env_vars .
vim env_vars

Remove avahi, to prevent it from polluting the tests with link discovery packets:

sudo yum remove avahi

Verify Install

Login as root:

su

Load environment variables:

source /home/openflow/env_vars

These can be automatically sourced upon login, by appending the preceding line to the ~/.bashrc file.

Load virtual ethernet pairs:

veth_setup.pl

Verify ethernet pairs:

/sbin/ifconfig | more

You should see veth0..7 listed.

Start Wireshark. If using X forwarding, you'll have to spawn the windows from the same user account that originally logged in. If you logged in as openflow and used 'su' to become root, spawn another terminal session to launch Wireshark:

ssh -X openflow@<machine_name>
wireshark

In the Filter bar at the top, enter:

of || tcp.flags.reset == 1

Starting recording packets: go to Capture->Interfaces and select the lo (loopback) interface.

Back in the original root window, run kernel-space tests:

of_kmod_veth_test.pl

You should now see OpenFlow packets going between the switch and the controller while the test suite runs. TCP reset packets separate each test. You can click on the OpenFlow portion of each packet and identify its fields.

At this point, you've verified the installation.

To run the user-space tests:

of_user_veth_test.pl
Copyright 2008 by the OpenFlow Consortium. All rights reserved. Powered by MediaWiki and WordPress.