pktgen / Pktgen-DPDK

DPDK based packet generator
Other
377 stars 117 forks source link

Pktgen won't run in background #279

Open racompton opened 3 weeks ago

racompton commented 3 weeks ago

I need to run pktgen in the background without displaying the CLI. I want to execute pktgen on numerous servers at once from a centralized controller. It doesn't seem to work if I add > /dev/null 2>&1 & at the end of the pktgen command.

KeithWiles commented 3 weeks ago

The -G or -g host:port options was how I was handling running Pktgen in background without the CLI and waiting for Lua scripts. Look at the README file or use pktgen --help

racompton commented 3 weeks ago

Thanks for the reply. I am able to use the -G or -g options to run pktgen in the background but I don't understand what Lua script to send to the pktgen daemon to start the replay of a packet capture using a command file. Any help you can provide?

The command that I'm using the execute the pcap playback is: pktgen -- -T -P -m "2.[0]" -m "2.[1]" -s 0:ACK-Flood-spoofed.pcap -s 1:ACK-Flood-spoofed.pcap -f start-2-pcap.pkt

The file start-2-pcap.pkt contains the following:

enable 0 pcap
set 0 rate 100
start 0
enable 1 pcap
set 1 rate 100
start 1
KeithWiles commented 3 weeks ago

You are using standard CLI commands and not Lua. To enable pktgen to be built with Lua you must install Lua from Lua.org or via you package manager for your Linux. To build pktgen with Lua support the command is make buildlua If you look at the README file and search for socat I show some examples. The CLI commands you are using will not work with the -G or -g option. The test and script directories have a few Lua script files.

racompton commented 3 weeks ago

Thanks again for the quick reply. I now have Lua support complied. Can the packet capture file be dynamically updated via Lua? I want to be able to run pktgen in the background and dynamically specify different packet capture files to be replayed and change their rates without having to manually restart pktgen.

KeithWiles commented 3 weeks ago

sorry, currently that can not be done.

racompton commented 2 weeks ago

Feature request? 🙏

KeithWiles commented 2 weeks ago

I do not know when I will be able to add this feature, so it could be a while, but you are welcome to create a PR and add the feature yourself.