Page tree
Skip to end of metadata
Go to start of metadata


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.

1 - Update the CentOS

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



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

vim /etc/inittab

Change the following line:




2 - Add the RPMforge repository

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

rpm --import

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

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

rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm


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

yum install htop

3 - Install the NetFPGA Base package

3.1 - Add the NetFPGA repository:
rpm -Uhv

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

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:

yum -y update kernel


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

vim /boot/grub/menu.lst

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


Optional - Only if the server is updated:

Boot at the most recent version of the kernel:


3.3 - Download the sources of the kernel:

yum -y install kernel-devel


Verify the version of the current kernel:

uname --r


Verify if the directory 'build' exists:

ls /lib/modules/`uname -r`/build


3.4 - Install the netfpa-base package:

yum -y install netfpga-base

3.5 - Verify if the new kernel was installed:

vim /boot/grub/menu.lst

3.6 - Then reboot:



Verify the current kernel:

uname --r

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


3.8 - Add to the boot the CPCI reprogram script.

vim /etc/rc.local

Add at the last line, the following code:

/usr/local/netfpga/lib/scripts/cpci_reprogram/ --all

3.9 - Reprogram the NetFPGA:

/usr/local/netfpga/lib/scripts/cpci_reprogram/ --all


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:

for i in `seq 0 3`; do ifconfig nf2c$i up; done

Load the bitfile for tests:

nf_download ~/netfpga/bitfiles/selftest.bit

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

~/netfpga/projects/selftest/sw/selftest -n

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

~/netfpga/projects/selftest/sw/selftest -n -c


4 - Install OpenFlow and the OpenFlow bitfiles

4.1 - Install the dependencies:

yum -y install git automake pkgconfig libtool gcc

4.2 - Install autoconf:

tar xvzf autoconf-2.63.tar.gz
cd autoconf-2.63
./configure --prefix=/usr
make install

4.3 - Download Openflow:

git clone git://
cd openflow
git checkout -b 1.0.0-netfpga origin/devel/tyabe/1.0.0-netfpga

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

cd /root/openflow/hw-lib/nf2
tar xfvz openflow_switch.bit.100_3.tar.gz
cd /root/openflow
./configure --enable-hw-lib=nf2
make install



Realize simple NetFPGA tests with the OpenFlow bitfile.

1 - Initialize the Openflow Controller:

cd /root/openflow/controller
./controller ptcp:6633

2 - In another terminal:

cd /root/openflow
nf_download hw-lib/nf2/openflow_switch.bit

Screen of the first stage of the test:

Start the switch:

ofdatapath punix:/var/run/test -i nf2c0,nf2c1,nf2c2,nf2c3 &
ofprotocol unix:/var/run/test tcp: &

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.

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

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.

# chkconfig: 2345 95 20
# description: Switch OpenFlow

abend ()
  echo "$0: $2"
  exit $1
kill_process_tree() {
    children=`ps -o pid --no-headers --ppid ${pid}`
    for child in $children
        kill_process_tree 0 $child
    if [ $top -eq 0 ]; then
        kill -9 $pid &> /dev/null
case "$1" in
  /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
  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 &
  if [ -z $PID ]; then
    /usr/local/bin/ofprotocol unix:/var/run/test tcp:$FLOWVISOR_ADDRESS:$FLOWVISOR_PORT >> /var/log/ofprotocol.log 2>&1 &
  kill_process_tree 1 $$
  killall ofdatapath
  killall ofprotocol
  $0 stop
  echo Sleeping a bit to let it shutdown
  sleep 1
  $0 start
  abend 1 "Usage: $0 [start | stop | restart]"

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


chmod +x /etc/init.d/openflow
chkconfig --add openflow --level 2345

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

service openflow start
service openflow stop
service openflow restart

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:

  • No labels