CentOS Install

From OpenFlow Wiki

Revision as of 10:47, 19 January 2012 by BarbraKnapp (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

CentOS

Note: These instructions are for the 1.0.0 release. Please use the history tab to view older versions of this page.

Install CentOS

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

These instructions were tested with CentOS 5.4, 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://apt.sw.be/redhat/el5/en/i386/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
sudo rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
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.63.tar.gz
tar xvzf autoconf-2.63.tar.gz
cd autoconf-2.63
./configure --prefix=/usr
make
sudo make install
cd ..

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

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

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

wget http://openflow.org/downloads/openflow-1.0.0.tar.gz
tar xvzf openflow-1.0.0.tar.gz
cd openflow-1.0.0

Build OpenFlow user-space switch:

./configure
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.

Upgrade new and bug fixed mkinitrd for 2.6.28 kernel

sudo yum install mkinitrd

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.28.10.tar.bz2

Extract kernel

sudo tar xjf linux-2.6.28.10.tar.bz2
cd linux-2.6.28.10
sudo 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:

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

We must now change a bunch of settings in the .config file. EssaysExperts.Com is the company which first and main priority was, is and will be customers� satisfaction with the essays online. If you still have no idea where to buy your writing tasks, this company is the best option for you. 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

Log in and verify the new kernel is at least 2.6.24 or greater.

uname -r

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 regress/scripts/install_deps.pl

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
    or
sudo /sbin/chkconfig avahi-daemon off
sudo /etc/rc.d/init.d/avahi-daemon stop

Disable IPv6, to prevent it from polluting the tests with link discovery packets:

vi disable-ipv6.sh

-- disable-ipv6.sh --
#!/bin/sh

IP6CONF=/proc/sys/net/ipv6/conf
for intf in ${IP6CONF}/*
do
        echo 1 > $intf/disable_ipv6
done
-- disable-ipv6.sh --

chmod 755 disable-ipv6.sh
sudo ./disable-ipv6.sh

Verify Install

Note: The regression tests require you to have completed the steps outlined in the sections Compile Fresh Kernel for Regression Suite and Install Regression Suite.

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.

Note: The backported veth driver is not configured in the same way as the veth driver in later kernels, due to limitations of the 2.6.18 kernel. If you are using the backported veth driver, you will have to modify veth_setup.pl to use commands such as "echo '+veth0,veth1' > /sys/class/net/veth_pairs" instead of using the "ip" program.

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 user-space tests:

/bin/sh ./disable-ipv6.sh
of_user_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.