Date created: Sunday, October 29, 2017 6:04:17 PM. Last modified: Sunday, May 19, 2024 7:30:37 PM
Ptkgen
CentOS 7 example install:
# CentOS 7 pre-reqs:
sudo yum install make coreutils glibc-devel.x86_64 kernel-devel.x86_64 kernel-headers.x86_64 python libpcap-devel
# On CentOS when using Elrepo for a newer kernel, also install these (after installing the newer kernel and booting it):
# May have to install a previous version first
# sudo yum remove kernel-headers-XXX
sudo yum --enablerepo=elrepo-kernel install kernel-ml-headers kernel-ml-devel
sudo yum install glibc-devel gcc
sudo yum install numactl.x86_64 numactl-devel.x86_64 numactl-libs.x86_64
# DPDK Install: mkdir /opt/dpdk cd /opt/dpdk/ wget http://fast.dpdk.org/rel/dpdk-17.08.tar.xz
# curl http://fast.dpdk.org/rel/dpdk-17.08.tar.xz -o dpdk-17.08.tar.xz tar -xvf dpdk-17.08.tar.xz cd dpdk-17.08/ export DPDK_TARGET=x86_64-native-linuxapp-gcc sudo make install T=$DPDK_TARGET DESTDIR=install
# Ptkgen Install: cd /opt/dpdk/ wget http://dpdk.org/browse/apps/pktgen-dpdk/snapshot/pktgen-3.4.2.tar.gz
# curl http://dpdk.org/browse/apps/pktgen-dpdk/snapshot/pktgen-3.4.2.tar.gz -o pktgen-3.4.2.tar.gz
tar -xvzf pktgen-3.4.2.tar.gz
cd pktgen-3.4.2/
export RTE_SDK=/opt/dpdk/dpdk-17.08
export RTE_TARGET=x86_64-native-linuxapp-gcc
make
# Disable LLDP client on NIC before detatching it from the Kernel:
sudo bash -c "echo lldp stop > /sys/kernel/debug/i40e/0000:09:00.0/command"
sudo bash -c "echo lldp stop > /sys/kernel/debug/i40e/0000:09:00.1/command"
# Load Kernel modules, shutdown interface and bind to DPDK:
cd /opt/dpdk/dpdk-17.08/usertools/
./dpdk-devbind.py --status-dev net
lsmod | grep uio
modinfo uio
sudo modprobe uio
sudo insmod /opt/dpdk/dpdk-17.08/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
modinfo /opt/dpdk/dpdk-17.08/x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
lsmod | grep uio
sudo ip link set down enp0s25
sudo ./dpdk-devbind.py --bind=igb_uio enp0s25
./dpdk-devbind.py --status-dev net
# With 1G NAS
cd /opt/dpdk/pktgen-3.4.2/
sudo ./app/x86_64-native-linuxapp-gcc/pktgen -l 1-3 -n 1 -w 00:19.0 -- -P -m 2.0
# 10G uCPE
sudo ./app/x86_64-native-linuxapp-gcc/pktgen -l 2-6 -n 2 -w 09:00.0 -w 09:00.1 -v -- -P -m "[3:4].0, [5:6].1"
Pktgen:/> set 1 dst ip 192.168.0.2
Pktgen:/> set 1 dst ip 192.168.0.1
Pktgen:/> set 0 dst ip 192.168.0.1
Pktgen:/> str
Ubuntu 14.04.6 LTS example install:
# Ensure the huge pages options are enabled in the boot config:
$ grep -i huge /boot/config-3.13.0-170-generic
CONFIG_HUGETLBFS=y
CONFIG_HUGETLB_PAGE=Y
# Mount huge table on start up:
$ sudo mkdir /mnt/huge_1GB
$ sudo chmod 777 /mnt/huge_1GB
$ tail -n 1 /etc/fstab
nodev /mnt/huge_1GB hugetlbfs pagesize=1GB 0 0
# After reboot:
$ mount | grep 1GB
nodev on /mnt/huge_1GB type hugetlbfs (rw,pagesize=1GB)
$ grep -i huge /proc/meminfo
AnonHugePages: 40960 kB
HugePages_Total: 1
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 1048576 kB
# Install:
$ mkdir /opt/dpdk
$ cd /opt/dpdk
$ git clone git://dpdk.org/dpdk
$ git clone git://dpdk.org/apps/pktgen-dpdk
$ sudo apt-get install linux-headers-`uname -r` libpcap-dev
$ export RTE_SDK=/opt/dpdk/dpdk
$ export RTE_TARGET=x86_64-native-linux-gcc
$ cd $RTE_SDK
$ make install T=x86_64-native-linux-gcc DESTDIR=install
# Lua5.3 is needed for Pktgen, which isn't in the Ubnutu repos for Ubuntu 14:
$ cd /opt/
$ mkdir lua-5.3.5
$ cd lua-5.3.5/
$ curl -R -O http://www.lua.org/ftp/lua-5.3.5.tar.gz
$ tar zxf lua-5.3.5.tar.gz
$ cd lua-5.3.5
$ make linux test
$ sudo make install
$ cd /opt/dpdk/pktgen-dpdk
$ make
# Interface binding:
# Ensure flow control is disabled:
$ sudo ethtool -a eth1
$ sudo ethtool -A eth1 rx off tx off
$ sudo ethtool -a eth1
$ sudo ethtool -a eth2
$ sudo ethtool -A eth2 rx off tx off
$ sudo ethtool -a eth2
$ sudo rmmon igb_uio
$ sudo insmod /opt/dpdk/dpdk/x86_64-native-linux-gcc/kmod/igb_uio.ko
# "igb_uio" and "uio" should both be loaded
$ lsmod | grep uio
$ sudo /opt/dpdk/dpdk/usertools/dpdk-devbind.py -u 01:00.0
$ sudo /opt/dpdk/dpdk/usertools/dpdk-devbind.py -u 01:00.1
$ sudo /opt/dpdk/dpdk/usertools/dpdk-devbind.py --bind=igb_uio 01:00.0
$ sudo /opt/dpdk/dpdk/usertools/dpdk-devbind.py --bind=igb_uio 01:00.1
$ sudo /opt/dpdk/dpdk/usertools/dpdk-devbind.py --status
Ubuntu 16:
$sudo apt-get install make coreutils libc6-dev linux-headers-$(uname -r) build-essential libnuma-dev python libpcap-dev
lcore to port/queue binding:
sudo ./app/x86_64-native-linuxapp-gcc/pktgen -l 2-6 -n 2 -w 09:00.0 -w 09:00.1 -v -- -P -m "[3:4].0, [5:6].1" ^ This format is "[lcores].port [lcores].port". The colon ":" is used to specify seperate lcores for tx and rx queues. The above says "[lcore 3 for rx queue : lcore 4 for tx queue].of port 0, [lcore 5 for rx queue : lcore 6 for tx queue].of port 1". Pktgen:/> page cpu ... === port to lcore mapping table (# lcores 5) === lcore: 2 3 4 5 6 Total port 0: ( D: T) ( 1: 0) ( 0: 1) ( 0: 0) ( 0: 0) = ( 1: 1) port 1: ( D: T) ( 0: 0) ( 0: 0) ( 1: 0) ( 0: 1) = ( 1: 1) Total : ( 0: 0) ( 1: 0) ( 0: 1) ( 1: 0) ( 0: 1) Display and Timer on lcore 2, rx:tx counts per port/lcore
Working Installtion Examples:
Ubuntu Laptop with 1G 82579LM (fixed after adding PCI ID to e1000 driver)
Ubuntu NAS with 1G I217 NIC
HPE DL120 Gen9 10G with Intel X710 (fixed after downgrading to Kernel 3.10)
The packet size in Pktgen is 64 bytes by default. This includes MAC SA + MAC DA + VLAN (default is none) + Etype + IP Header + TCP Header + TCP Payload + Ethernet FCS. The default is thus 6+6+0+2+20+20+6+4 == 64 bytes. This becomes 84 bytes on the wire when Preamble and Start Frame Delimiter (8 bytes) and Interframe Gap (12 bytes) are added in.
Routing through a gateway:
set 0 src ip 10.0.1.1/30 # Gateway device is 10.0.1.2 set 0 dst ip 10.0.2.1 set 0 dst mac a8:0c:0d:7b:f6:e5 # MAC of gateway device set 1 src ip 10.0.2.1/30 # Gateway device is 10.0.2.2 set 1 dst ip 10.0.1.1 set 1 dst mac a8:0c:0d:7b:f6:e4 # MAC of gateway device start 0,1 arp gratuitous start 0,1 arp gratuitous start 0
Previous page: Prometheus + InfluxDB + Grafana (Docker on ARM64)
Next page: Systap