Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
309 lines (201 sloc) 7.66 KB


Here are the installations steps for Ubuntu 16.04.

Install the following utilities and libs:

apt install g++
apt install libjemalloc-dev
apt install libpcap-dev
apt install python
apt install libpcre2-8-0
apt install autoconf
apt install zlib1g-dev
apt install flex
apt install byacc
apt install cmake
apt install libtool
apt install libtool-bin
apt install subversion
apt install rpm
apt install libreadline6 libreadline6-dev
apt install libnuma-dev

Install libcap

tar xzvf ./libpcap-1.5.3.tar.gz
cd ./libpcap-1.5.3/
make install

Install Proplib

Download proplib-0.6.3.tar.xz

	tar xvf ./proplib-0.6.3.tar.xz
	cd ./proplib-0.6.3
	make install

Install libcdb

  • Download libcdb.tar.gz or

     git clone
  • Download the patch libcdb_alexk.patch

  • Execute the following commands:

     cd ./libcdb
     cat libcdb_alexk.patch | patch -p1
     export LIBDIR=lib
     export INCDIR=include
     export DESTDIR=/usr/local
     make all
     make install

Notes: install process ends successfully even if it indicates that there has been the following error:

make -C man install
make[1]: Entering directory '/home/alex/libcdb/man'
make[1]: *** No rule to make target 'install'.  Stop.
make[1]: Leaving directory '/home/alex/libcdb/man'
Makefile:5: recipe for target 'install' failed
make: *** [install] Error 2	

Install qsbr

  • Download libqsbr.tar.gz

  • Download the patch libqsbr_alexk.patch

  • Execute the following commands:

     tar xzvf libqsbr.tar.gz
     cd ./libqsbr/src
     cat libqsbr_alexk.patch | patch -p1
     export LIBDIR=lib
     export INCDIR=include/qsbr
     export DESTDIR=/usr/local
     make all
     make install

Install bpfjit

  • Download bpfjit.tar.gz

  • Download sljit-0.92.tgz

  • Execute the following commands:

     mkdir /usr/lib64
     tar xzvf ./bpfjit.tar.gz
     tar xzvf ./sljit-0.92.tgz
     cd ./bpfjit/sljit/
     cp -rpn ../../sljit-0.92/* ./
     cd ..
  • Edit ./SPECS/libbpfjit.spec and delete or comment the following lines:

  • Run

     make rpm
     rpm --nodeps -ihv RPMS/x86_64/libbpfjit-0.1-1.x86_64.rpm

Install NPF

  • Clone NPF (

     git clone -b alexk
  • Download city.h, then

     cp city.h /usr/local/include/
  • Run the following commands:

     cd npf/src
     cd libnpf/net
     rm ./npf.h
     ln -s ../../kern/npf.h npf.h		
     cd ../..
     export DESTDIR=/
     export LIBDIR=/usr/lib64
     export INCDIR=/usr/local/include
     export MANDIR=/usr/local
     make install

Update system library paths

Add the following lines to the /etc/




Install DPDK

Configure linux kernel

  • Make sure the following options are enabled:

      UIO support
         Device Drivers -> Userspace I/O drivers -> Generic driver for PCI 2.3 and PCI Express cards
            symbol UIO_PCI_GENERIC
         File systems -> Pseudo filesystems -> /proc file system support      
        File systems -> Pseudo filesystems
      HPET and HPET_MMAP
         Device Drivers -> Character devices -> HPET - High Precision Event Timer
  • Turn on linux boot time options:

    • Edit GRUB_CMDLINE_LINUX variable in the /etc/default/grub

        GRUB_CMDLINE_LINUX="intel_idle.max_cstate=1 isolcpus=1,2,3,4,5,6,7,9,10,11,12,13,14,15 default_hugepagesz=2M hugepagesz=2M hugepages=3072"
    • Run

    • Note: You might want to isolate a different set of cores or reserve different amount of ram for huge pages depending of the hardware configuration of your server. The rule here is that you should isolate all cores you're going to use in the router's traffic forwarding process unless the perfomance is not a goal.

  • Configure hugepages

    • reboot you machine and check that hugepages are available and free

        grep -i huge /proc/meminfo
    • you should get something like this:

        HugePages_Total:    3072
        HugePages_Free:     3072
        HugePages_Rsvd:        0
        HugePages_Surp:        0
        Hugepagesize:       2048 kB
    • Make a mount point for hugepages

        mkdir /mnt/huge
    • Create a mount point entry in the /etc/fstab

        huge         /mnt/huge   hugetlbfs pagesize=2M   0       0
    • Mount hugepages

        mount huge
  • download dpdk 17.11.1 (LTS)

      tar xvf dpdk-17.11.1.tar.xz
      cd ./dpdk-stable-17.11.1

Patch DPDK

Download the patches:

Apply the patches:

	cat ./eal_log.patch | patch -p1
	cat ./bond_fix_mtu.patch | patch -p1
	cat ./bond_lacp_fix_mempool_size.patch | patch -p1
	cat ./ip_fragmentation_table.patch | patch -p1
	cat ./bond_add_remove_mac_addr.patch | patch -p1

Run the following commands:

	make install T=x86_64-native-linuxapp-gcc

Install TheRouter

Install dependencies

  • Download quagga sources quagga-1.0.20160315.tar.xz

     tar xvf ./quagga-1.0.20160315.tar.xz
  • city hash

     git clone
     cd ./cityhash/
     make all check CXXFLAGS="-g -O3"
     make install

Notes: libcityhash should be compiled as dynamic library, but the steps above create a static link lib. I haven't so far figured why, so as a workaroung you can download already compiled lib and copy it to /usr/local/lib/

Download TheRouter


Install TheRouter

  • Run the following commands:

     tar xvf ./
     cd ./

Configure dpdk ports

  • Define $RTE_SDK variable

      export RTE_SDK=/path_to_dpdk
  • Load drivers

      modprobe uio
      insmod $RTE_SDK/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
      # loading kni module 
      insmod $RTE_SDK/x86_64-native-linuxapp-gcc/kmod/rte_kni.ko
  • Bind your NIC's to DPDK by using $RTE_SDK/usertools/

      $RTE_SDK/usertools/ --bind=igb_uio 0000:02:00.0
      $RTE_SDK/usertools/ --bind=igb_uio 0000:02:00.1

Run TheRouter

  • Prepare configuration files. For configuration examples and options see the page Configure TheRouter

    • create router.conf

        nano /etc/router.conf
    • create npf conf

        nano /etc/npf.conf
  • run the router

     /usr/local/sbin/ /etc/router.conf