how to setup pktgen tool

  • prepare hugepage in /etc/default/grub or /etc/dpdk/dpdk.conf and reboot

  • install required packages including libpcap-dev
sudo apt-get install libpcap-dev

  • download and build pktgen
# http://dpdk.org/browse/apps/pktgen-dpdk/refs
tar xvfz pktgen.tar.gz
cd pktgen
make

  • modify tools/setup.sh according to your environment
# for example, 
release=`uname -r`
${Sudo} modprobe uio
${Sudo} insmod $sdk/$target/lib/modules/$release/extra/dpdk/igb_uio.ko
name=`uname -n`
if [ $name == "MYCONTAINER" ]; then
        ${Sudo} -E ${nic_bind} -b igb_uio 0000:03:00.0 0000:07:00.0
fi

or

${Sudo} modprobe uio
${Sudo} modprobe uio_pci_generic
if [ $name == "MYCONTAINER" ]; then
        ${Sudo} -E ${nic_bind} -b uio_pci_generic 0000:03:00.0 0000:07:00.0
fi

  • run tools/setup.sh
sudo -E ./tools/setup.sh

  • modify tools/run.sh according to your environment
cmd=./app/app/${target}/pktgen
dpdk_opts="-c 0xe -n 4 --proc-type auto --log-level 8 -m 4096 --file-prefix pg"
pktgen_opts="-P --crc-strip -m [2:3].0 -m [2:3].1"
black_list=""

  • run pktgen
sudo -E ./tools/run.sh

  • utilize throughput.lua and rfc2544-onebox.lua for performance experiments

modify IP and MAC in those scripts according to your environment


[ BASIC RUN-TIME COMMANDS ]

theme off
set 0,1 size 64
set 0,1 rate 100
set 0,1 proto udp
set 0,1 type ipv4
set 0 src ip 192.168.0.100/24
set 1 src ip 192.168.2.100/24
set 0 dst ip 192.168.2.100
set 1 dst ip 192.168.0.100
set 0 src mac 68:ed:a4:0f:ab:b0
set 0 dst mac FA:16:3E:BD:70:02
set 1 src mac 68:ed:a4:0f:ab:b2
set 1 dst mac FA:16:3E:70:0D:14
start 0,1
send arp grat 0,1
clear 0,1 stats
start 0
page 0
stop 0
enable 0,1 process
enable 0,1 icmp
set 0,1 count 1000000

lua command examples
http://pktgen-dpdk.readthedocs.io/en/latest/lua.html

Leave a Reply

Your email address will not be published. Required fields are marked *