Setting up DPDK’s Pktgen packet generator on Ubuntu 15.10

Following on from the earlier post, it seemed like a good idea to get DPDK’s Pktgen program running to work with the l2fwd example that was previously built. More details after the jump…

First off, download the Pktgen source from here. I used the 2.9.18 version (I could not get the later versions to compile). Expand the file to somewhere convenient.

Assuming that DPDK has been compiled successfully, only a couple more dependencies need to be satisfied:

sudo apt-get install libpcap-dev liblua5.3-dev
sudo ldconfig

Then, to compile:

export RTE_SDK=<dpdkdir>
export RTE_TARGET=x86_64-native-linuxapp-gcc
cd <pktgendir>
make -j8

As usual, the “-j8” bit should be adjusted to reflect the number of cores to be used for the compilation. At this point, everything is ready to run the program:

cd <pktgendir>
sudo -E app/app/x86_64-native-linuxapp-gcc/pktgen -c 0x1f -n 3 -- -P -m "[1:3].0, [2:4].1"

Note that the working directory has to be <pktgendir> as it needs to have the required .lua files. The string following the -m map cores to interface ports. In this case, core 1 handles port 0 receive, core 3 handles port 0 transmit, core 2 handles port 1 receive and core 3 handles port 1 transmit. It’s important to note that these are logical core numbers – hyperthreaded physical cores count as two logical cores. After some experimentation with an i7-5820K, best performance seemed to be obtained when each physical core is only used once. However, I am sure there are a lot of variables that affect this.

It’s a good idea to set the terminal window to 132 x 43 so that the displays work properly. I had l2fwd running at the other end of the cable connected to port 0 so I just started generating packets by entering:

start 0

at the Pktgen prompt. The l2fwd display on the other machine displayed the packets being received. It’s pretty easy to modify packet size and other parameters – just enter help at the Pktgen prompt for instructions.

Alternatively, just run Pktgen on both machines and fire packets in both directions.

2 thoughts on “Setting up DPDK’s Pktgen packet generator on Ubuntu 15.10”

  1. Hey there,
    I followed your guide and got pktgen running on two machines. When I connect them directly I can see RX and TX packets on both sides. Now I want to test the routing performance of a MikroTik Router so i placed it in between the both pktgen machines, configured Src and dst macs and IPs correctly (i think) and started sending packets again. Unfortunately I cannot see RX Pakets anymore, the MikroTik seems to drop all Pakets instead of forwarding them to the other pktgen machine. Tcpdump on the MikroTik shows incoming packets.
    Pinging through the router without pktgen running is possible, so I assume the router configuration is correct. Must be a fault on the pktgen machines.
    What I want to achieve is measuring static routing performance of different hardware and software routers at different packet sizes.
    Can you help or give me any further advice?
    Thank you!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.