Category Archives: SDN/NFV

Disable IPv6 (Ubuntu 16.04.5)

Step 1. Check disable_ipv6 file ( 0 means working)

$ sudo cat /proc/sys/net/ipv6/conf/all/disable_ipv6  
0

Step 2. Edit that file and reload it

$ sudo vi /etc/sysctl.conf  

net.ipv6.conf.all.disable_ipv6 = 1  
net.ipv6.conf.default.disable_ipv6 = 1  
net.ipv6.conf.lo.disable_ipv6 = 1  

$ sudo sysctl -p

Modify network interface name to ethX (Ubuntu 16.04.5)

Step 1. Check dmesg

$ dmesg | grep -i eth
[    2.993750] igb 0000:06:00.0 enp6s0: renamed from eth1
[    3.080609] igb 0000:05:00.0 enp5s0: renamed from eth0
[    3.140633] igb 0000:3b:00.0 enp59s0f0: renamed from eth2
[    3.236701] igb 0000:3b:00.1 enp59s0f1: renamed from eth3

Step 2. Edit GRUB (GRand Unified Bootloader)

$ sudo vi /etc/default/grub

GRUB_CMDLINE_LINUX=""

to 

GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"

$ sudo grub-mkconfig -o /boot/grub/grub.cfg

Step 3. Modify /etc/network/interfaces and reboot

$ sudo vi /etc/network/interfaces
$ sudo reboot

 

 

Open VSwitch (OVS) 2.5.6 LTS Install (Ubuntu 16.04.5)

Step 1. Download and install OVS 2.5.6

$ sudo apt-get install wget autoconf libtool -y
$ wget https://www.openvswitch.org/releases/openvswitch-2.5.6.tar.gz
$ tar zxvf openvswitch-2.5.6.tar.gz
$ cd openvswitch-2.5.6
$ ./boot.sh
$ ./configure
$ make && make install
$ sudo modprobe openvswitch
$ sudo lsmod | grep openvswitch
$ export PATH=$PATH:/usr/local/share/openvswitch/scripts
$ ovs-ctl start

Step 2. Make bridge and add port(s)

# remove and add ovsbr0
$ sudo ovs-vsctl del-br ovsbr0 2> /dev/null
$ sudo ovs-vsctl add-br ovsbr0

# configure ovsbr0
$ sudo ovs-vsctl set-controller ovsbr0 tcp:127.0.0.1:6633
$ sudo ovs-vsctl -- set bridge ovsbr0 protocols=OpenFlow10
$ sudo ovs-vsctl set-fail-mode ovsbr0 secure

# add interfaces to ovsbr0
$ sudo ovs-vsctl add-port ovsbr0 [interface name]
$ sudo ovs-vsctl add-port ovsbr0 [interface name]
$ sudo ovs-ofctl show ovsbr0

Step 3. Install flow rules

$ sudo ovs-ofctl add-flow ovsbr0 in_port=1,actions=output:2
$ sudo ovs-ofctl add-flow ovsbr0 in_port=2,actions=output:1
$ sudo ovs-ofctl dump-flows ovsbr0

 

Run DPDK (Ubuntu 16.04.5)

Step 1. Install DPDK

Step 2. Add DPDK Driver: We need to add DPDK driver to ubuntu kernel

$sudo modprobe uio
$sudo insmod /usr/src/dpdk-stable-17.11.3/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko

Step 3. Bind DPDK driver

$ cd /usr/src/dpdk-stable-17.11.3/usertools
$./dpdk-devbind.py --status

Network devices using kernel driver
===================================
0000:00:19.0 'Ethernet Connection I217-LM 153a' if=eth1 drv=e1000e unused=
0000:03:00.0 '82599ES 10-Gigabit SFI/SFP+ Network Connection 10fb' if=eth2 drv=ixgbe unused=
0000:03:00.1 '82599ES 10-Gigabit SFI/SFP+ Network Connection 10fb' if=eth3 drv=ixgbe unused=
0000:05:00.0 'I210 Gigabit Network Connection 1533' if=eth0 drv=igb unused= *Active*

$./dpdk-devbind.py --bind=igb_uio 03:00.1

Step 4. Run example

$ cd /usr/src/dpdk-stable-17.11.3/examples/helloworld
$ make

$ cd build/app
$ ./helloworld -l 1-2 -n 4 (-l is core to be used, -n is # mem)

Etc. You can configure that some cores cannot be used by the linux kernel as follows.

GRUB_CMDLINE_LINUX_DEFAULT="... isolcpus=2,3,4"

 

Run Pktgen (Ubuntu 16.04.5)

Step 1. Install and configure DPDK

Step 2. Install Pktgen

$ sudo apt-get install -y wget patch libpcap-dev
$ curl -LO http://www.dpdk.org/browse/apps/pktgen-dpdk/snapshot/pktgen-3.5.0.tar.gz
$ tar xvfz pktgen-3.5.0.tar.gz

$ echo "export RTE_SDK=\$DPDK_DIR" >> ~/.bashrc
$ echo "export RTE_TARGET=\$DPDK_TARGET" >> ~/.bashrc
$ . ~/.bashrc

$ cd pktgen-3.5.0
$ make

Step 3. Run Pktgen

$ cd pktgen-3.5.0

$ sudo -E app/$RTE_TARGET/pktgen -c 0xf -n 4 -- -p 0x3 -P -m "[1:2].0"
=> [1:2].0 : use core #1 and #2 for port 0

Pktgen:/> set [port number] [parameter] [value]
set 0 count 100
=> send 100 packets to port 0
set 0 size 64
=> send 64-byte packets to port 0
set 0 rate 50
=> send packets to port 0 with 50% sending rate
set 0 src ip 10.0.0.0/24
=> configure a source IP address
set 0 src mac aa:bb:cc:dd:ee:ff
=> configure a source MAC address
start 0
=> start to send packets
stop 0
=> stop sending packets

(with script)

$ sudo -E app/$RTE_TARGET/pktgen -l 0-4 -n 3 -- -P -m "[1:3].0" -f scripts/rfc2544_tput_test.lua

 

Install DPDK 18.11.1 LTS (Ubuntu 16.04.5 LTS)

Step 1. Check DPDK Support (http://dpdk.org/doc/nics)

$ sudo ethtool -i [NIC]

Step 2. Configure CPU and memory

$ sudo vi /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="default_hugepagesz=1G hugepagesz=1G hugepages=4" (1GB huge page setup)
GRUB_CMDLINE_LINUX_DEFAULT="default_hugepagesz=2M hugepagesz=2M hugepages=2048" (2MB huge page setup)

$ sudo update-grub

$ echo 'vm.nr_hugepages=4' >> /etc/sysctl.conf (1GB huge page setup)
$ echo 'vm.nr_hugepages=2048' >> /etc/sysctl.conf (2MB huge page setup)

$ mkdir /mnt/huge
$ mount -t hugetlbfs nodev /mnt/huge
$ sudo vi /etc/fstab (!TAB interval!)
nodev    /mnt/huge    hugetlbfs    defaults    0    0
$ sudo reboot

$ grep -i huge /proc/meminfo (1GB huge page)
AnonHugePages:         0 kB
ShmemHugePages:        0 kB
HugePages_Total:       4
HugePages_Free:        4
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:    1048576 kB

Step 3. Install DPDK

$ echo "export DPDK_DIR=/usr/src/dpdk-stable-18.11.1" >> ~/.bashrc
$ echo "export DPDK_TARGET=x86_64-native-linuxapp-gcc" >> ~/.bashrc
$ echo "export DPDK_BUILD=\$DPDK_DIR/\$DPDK_TARGET" >> ~/.bashrc
$ . ~/.bashrc

$ sudo apt-get install -y make coreutils gcc-multilib python libnuma-dev curl
$ curl -LO http://fast.dpdk.org/rel/dpdk-18.11.1.tar.xz
$ sudo tar xvfJ dpdk-18.11.1.tar.xz -C /usr/src/

$ cd $DPDK_DIR
$ sudo make install T=$DPDK_TARGET DESTDIR=install
or
$ cd $DPDK_DIR/usertools
$ sudo ./dpdk-setup.sh

$ sudo reboot