Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Introduction

For this guide, the pre-requirement is to have the CentOS 5 install, it can be any version, since it's going to be updated to the most recent version of the CentOS 5.

The root user will be the one always through this installation.

Anchor
update
update
1 - Update the CentOS

For this step, just accept the update listed by the OS.

 

Info

Optional:

In case the system isn't booting into the graphical interface and there is a need to use it, just edit the following file:

Code Block
themeMidnight
languagebash
vim /etc/inittab

Change the following line:

Code Block
themeMidnight
languagebash
id:3:initdefault:

to:

Code Block
themeMidnight
languagebash
id:5:initdefault:

Anchor
forge
forge
2 - Add the RPMforge repository

For this step use the commands below to add the RPMforge repository.

Code Block
themeMidnight
languagebash
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt

rpm -Uhv rpmforge-release-0.5.2-2.el5.rf.*.rpm
Note

If the command above doesn't work, try this option:

Code Block
themeMidnight
languagebash
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm
Info

Optional:

It's possible to verify that the repository was added by install the htop tool.

Code Block
themeMidnight
languagebash
yum install htop

Anchor
netfpga
netfpga
3 - Install the NetFPGA Base package

3.1 - Add the NetFPGA repository:
Code Block
themeMidnight
languagebash
rpm -Uhv http://wiki.netfpga.org/yum/el5/RPMS/noarch/netfpga-repo-1-1_CentOS5.noarch.rpm

Note

If the command above doesn't work, try this option:

Code Block
themeMidnight
languagebash
wget http://wiki.netfpga.org/yum/el5/RPMS/noarch/netfpga-repo-1-1_CentOS5.noarch.rpm
 
rpm -i netfpga-repo-1-1_CentOS5.noarch.rpm


3.2 - Install the kernel sources, which are necessary for the compilation of the netfpa-base:

Code Block
themeMidnight
languagebash
yum -y update kernel


Info

Optional:

Edit the grub file so as to the system can boot at the latest version of the kernel:

Code Block
themeMidnight
languagebash
vim /boot/grub/menu.lst

Change the line "default=k" to the one corresponding to the latest version, which is always the first one:

Code Block
themeMidnight
languagebash
default=0

Info

Optional - Only if the server is updated:

Boot at the most recent version of the kernel:

Code Block
themeMidnight
languagebash
reboot

3.3 - Download the sources of the kernel:

Code Block
themeMidnight
languagebash
yum -y install kernel-devel
Info

Optional:

Verify the version of the current kernel:

Code Block
themeMidnight
languagebash
uname --r

Info

Optional:

Verify if the directory 'build' exists:

Code Block
themeMidnight
languagebash
ls /lib/modules/`uname -r`/build

 

3.4 - Install the netfpa-base package:

Code Block
themeMidnight
languagebash
yum -y install netfpga-base

3.5 - Verify if the new kernel was installed:

Code Block
themeMidnight
languagebash
vim /boot/grub/menu.lst

3.6 - Then reboot:

Code Block
themeMidnight
languagebash
reboot
Info

Optional:

Verify the current kernel:

Code Block
themeMidnight
languagebash
uname --r

3.7 - Execute the following script, so as to create the netfpga directory and environment variables:

Code Block
themeMidnight
languagebash
/usr/local/netfpga/lib/scripts/user_account_setup/user_account_setup.pl

3.8 - Add to the boot the CPCI reprogram script.

Code Block
themeMidnight
languagebash
vim /etc/rc.local

Add at the last line, the following code:

Code Block
themeMidnight
languagebash
/usr/local/netfpga/lib/scripts/cpci_reprogram/cpci_reprogram.pl --all

3.9 - Reprogram the NetFPGA:

Code Block
themeMidnight
languagebash
/usr/local/netfpga/lib/scripts/cpci_reprogram/cpci_reprogram.pl --all
Note

Optional:

Execute the selftest.

Connect the network cables at the netfpga in a loopback fashion (port0 at port 1, port 2 at port 3).

Activate all the ports:

Code Block
themeMidnight
languagebash
for i in `seq 0 3`; do ifconfig nf2c$i up; done

Load the bitfile for tests:

Code Block
themeMidnight
languagebash
nf_download ~/netfpga/bitfiles/selftest.bit

Execute the test ( the '-n' parameter doesn't test the satas)

Code Block
themeMidnight
languagebash
~/netfpga/projects/selftest/sw/selftest -n

If the test fails use the '-c' parameter, so as to identify the cause of the error:

Code Block
themeMidnight
languagebash
~/netfpga/projects/selftest/sw/selftest -n -c

 

Anchor
openflow
openflow
4 - Install OpenFlow and the OpenFlow bitfiles

4.1 - Install the dependencies:

Code Block
themeMidnight
languagebash
yum -y install git automake pkgconfig libtool gcc

4.2 - Install autoconf:

Code Block
themeMidnight
languagebash
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
 
make install

4.3 - Download Openflow:

Code Block
themeMidnight
languagebash
git clone git://gitosis.stanford.edu/openflow.git
 
cd openflow
 
git checkout -b 1.0.0-netfpga origin/devel/tyabe/1.0.0-netfpga
 
./boot.sh

4.4 - Download the bitfile for NetFPGA and the installation of the Openflow with bitfiles:

Code Block
themeMidnight
languagebash
cd /root/openflow/hw-lib/nf2
 
wget http://openflow.org/downloads/netfpga/openflow_switch.bit.100_3.tar.gz
 
tar xfvz openflow_switch.bit.100_3.tar.gz
 
cd /root/openflow
 
./configure --enable-hw-lib=nf2
 
make
 
make install

 

Note

Optional:

Realize simple NetFPGA tests with the OpenFlow bitfile.

1 - Initialize the Openflow Controller:

Code Block
themeMidnight
languagebash
cd /root/openflow/controller
 
./controller ptcp:6633

2 - In another terminal:

Code Block
themeMidnight
languagebash
cd /root/openflow
 
nf_download hw-lib/nf2/openflow_switch.bit

Screen of the first stage of the test:

Start the switch:

Code Block
themeMidnight
languagebash
ofdatapath punix:/var/run/test -i nf2c0,nf2c1,nf2c2,nf2c3 &
 
ofprotocol unix:/var/run/test tcp:127.0.0.1:6633 &

The NetFPGA will work as a "dumb switch" using the OpenFlow protocol. To verify if it's working properly, just do a simple test in which 02 computers will be connect through the NetFPGA, and they need to ping each other.

Anchor
init
init
5 - Initialization script

To use the OpenFlow Switch as a NetFPGA initialization service, save the script below as 'openflow' at the '/etc/init.d'.  Para iniciar o Switch OpenFlow como serviço na inicialização da NetFPGA save o script abaixo com o nome openflow em /etc/init.d/.

Warning

Use your Island's network code as a 02 digit hexadecimal (ie.: RNP: 88), the number of your NetFPGA server (1, 2 or 3) and the Flowvisor IP, at the line 5, 6 and 7 respectively.

Code Block
themeMidnight
languagebash
linenumberstrue
#!/bin/sh
# chkconfig: 2345 95 20
# description: Switch OpenFlow

ID=<2-DIGITS-VPN-CODE-IN-HEX>
NETFPGA=<NETFPGA-NUMBER>
FLOWVISOR_ADDRESS=<FLOWVISOR-IP>
FLOWVISOR_PORT=6633
abend ()
{
  echo "$0: $2"
  exit $1
}
kill_process_tree() {
    top=$1
    pid=$2
    children=`ps -o pid --no-headers --ppid ${pid}`
    for child in $children
    do
        kill_process_tree 0 $child
    done
    if [ $top -eq 0 ]; then
        kill -9 $pid &> /dev/null
    fi
}
case "$1" in
start)
  /sbin/ifconfig nf2c0 hw ether 00:00:01:$ID:0$NETFPGA:00
  /sbin/ifconfig nf2c1 hw ether 00:00:01:$ID:0$NETFPGA:01
  /sbin/ifconfig nf2c2 hw ether 00:00:01:$ID:0$NETFPGA:02
  /sbin/ifconfig nf2c3 hw ether 00:00:01:$ID:0$NETFPGA:03

  /usr/local/bin/nf_download /root/openflow/hw-lib/nf2/openflow_switch.bit
  PID=
  if [ -z $PID ]; then
      /usr/local/bin/ofdatapath punix:/var/run/test -i nf2c0,nf2c1,nf2c2,nf2c3 -d 00000000${ID}0$NETFPGA >> /var/log/ofdatapath.log 2>&1 &
  fi
  PID=
  if [ -z $PID ]; then
    /usr/local/bin/ofprotocol unix:/var/run/test tcp:$FLOWVISOR_ADDRESS:$FLOWVISOR_PORT >> /var/log/ofprotocol.log 2>&1 &
  fi
  ;;
stop)
  kill_process_tree 1 $$
  killall ofdatapath
  killall ofprotocol
  ;;
restart)
  $0 stop
  echo Sleeping a bit to let it shutdown
  sleep 1
  $0 start
  ;;
*)
  abend 1 "Usage: $0 [start | stop | restart]"
  ;;
esac

After that, configure the permissions, so as to make the script executable and configure it as initialization service:

 

Code Block
themeMidnight
languagebash
chmod +x /etc/init.d/openflow
chkconfig --add openflow --level 2345

To start, stop or restart the service manually, use the following commands:

Code Block
themeMidnight
languagebash
service openflow start
service openflow stop
service openflow restart

Anchor
details
details
6 - Details

After concluding the finishing steps, it may be required to do some few configurations. Below there is a list of guides that should be verified: