emmericp / MoonGen

MoonGen is a fully scriptable high-speed packet generator built on DPDK and LuaJIT. It can saturate a 10 Gbit/s connection with 64 byte packets on a single CPU core while executing user-provided Lua scripts for each packet. Multi-core support allows for even higher rates. It also features precise and accurate timestamping and rate control.
MIT License
1.03k stars 234 forks source link

How to specify the name of protocol when sending packets using moongen? #304

Open Meysouli opened 3 years ago

Meysouli commented 3 years ago

in fact i'm trying to runn moongen with the lua scripts that are already found within the package,i'm using " ./build/MoonGen ./packetgen.lua -tx 0 -rx 1" to send traffic but the problem is that i cannot find the way to specify the stream profile like https or something like that

NetronomeMoongen commented 3 years ago

Hi,

The packetgen.lua script does not allow for specifying the Layer 4 to Layer 7 protocols in the packet.

It was designed / created as a simple utility to generate bursts of UDP traffic, with the focus being on the number of streams / flows, size of the bursts, etc.

You can specify the source and destination UDP port and the UDP header length, but that is the limit of fields that can be modified for Layer 4 of the packets. Layer 5-7 are not populated.

If you need more control of the packet / header contents, you can either use another sample script bundled with MoonGen, or modify the packetgen.lua script to suit your needs.

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Mon, Mar 29, 2021 at 1:28 PM Meysouli @.***> wrote:

in fact i'm trying to runn moongen with the lua scripts that are already found within the package,i'm using " ./build/MoonGen ./packetgen.lua -tx 0 -rx 1" to send traffic but the problem is that i cannot find the way to specify the stream profile like https or something like that

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/emmericp/MoonGen/issues/304, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEX76NNICWJIJ4WCAZWFIXLTGBP7BANCNFSM4Z7M5QZQ .

Meysouli commented 3 years ago

Thank you for the answer , for the bundled scripts are you referring to the ones in MoonGen/libmoon/lua ?

NetronomeMoongen commented 3 years ago

I'm afraid I don't know much about the other sample scripts bundled with MoonGen in the examples directory. Maybe one of the other scripts can provide the packets you require.

Maybe someone else more familiar with the example scripts can provide some feedback / help in this regard ?

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Mon, Mar 29, 2021 at 2:58 PM Meysouli @.***> wrote:

Thank you for the answer , for the bundled scripts are you referring to the ones in MoonGen/libmoon/lua ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/emmericp/MoonGen/issues/304#issuecomment-809355449, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEX76NMNYNDMW3DLJLP6TF3TGB2N3ANCNFSM4Z7M5QZQ .

Meysouli commented 3 years ago

Thank you :)

Meysouli commented 3 years ago

Hello again , is there a way i can sniff the packet generated from this command " sudo ./build/MoonGen ./examples/netronome-packetgen/packetgen.lua -tx 0 -rx 1" ??

NetronomeMoongen commented 3 years ago

Hi,

Unfortunately not using the packetgen.lua script in its current state.

It was designed to give the best possible performance for the parameter set, and dumping packet contents would slow the script and traffic generation / receipt down too much.

The script does allow for logging TX and RX statistics like bytes, number of packets, rates, etc., but not the packet contents themselves. The statistics can even be written to a file, either globally or to a per-core file.

In order to dump the packet contents / "sniff" the packets, you would need to modify the packetgen.lua script to dump the packets to suit your needs, or use another example moongen script to generate and receive / sniff the packets.

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Tue, Apr 6, 2021 at 2:24 PM Meysouli @.***> wrote:

Hello again , is there a way i can sniff the packet generated from this command " sudo ./build/MoonGen ./examples/netronome-packetgen/packetgen.lua -tx 0 -rx 1" ??

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/emmericp/MoonGen/issues/304#issuecomment-814077254, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEX76NK4ZKUIQ25XHCPKEU3THL4O3ANCNFSM4Z7M5QZQ .

Meysouli commented 3 years ago

Thank you for being such great help

Meysouli commented 3 years ago

I tried using tcpdump to sniff the traffic from the command above and saved it into pcap file then read it with wireshark but no help there , Also do i have to specify link between port 0 and 1 ? (( i'm using the same physical machine))

NetronomeMoongen commented 3 years ago

Hi,

I'm afraid I'm not familiar enough with the interaction between DPDK and the kernel to know whether tcpdump would be able to capture packets on a DPDK interface, perhaps someone more familiar with this interaction can help you with that.

The packetgen.lua script does not care about links between the tx and rx slaeports. This is because the tx and rx sale ports can be on different machines (if you run separate packetgenlua instances on the different machines, or on the same machine, if you have both tx and rx slaves on the command line.

This gives you the freedom to generate a lot more packets on multiple ports on one system and receive them on multiple ports on a different system for potentially performance benefits.

The ports are assigned rx and tx slave functions based on on the command line arguments given, plus the ports detected my MoonGen's detection and configuration systems, along with DPDK methods.

For example, as in your case where you have a tx slave and a rx slave on port 0 and 1, the first detected interface will be used as port 0, and the second will be port 1. For example, if you have -tx 0 -rx 1 on your command line, this means port 0 will be used for tx, and port 1 will be used for rx.

Once they are configured and bound by DPDK, DPDK is in control of the interfaces, and as such, you don't need to configure any special links between the tx and rx ports. (with normal kernel interfaces and the linux routing tables, you might need to configure network namespaces, etc., but not for DPDK)

https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avast.com https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On Tue, Apr 6, 2021 at 3:36 PM Meysouli @.***> wrote:

I tried using tcpdump to sniff the traffic from the command above and saved it into pcap file then read it with wireshark but no help there , Also do i have to specify link between port 0 and 1 ? (( i'm using the same physical machine))

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/emmericp/MoonGen/issues/304#issuecomment-814125233, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEX76NMSH24D3EHHW4IT3GLTHME5BANCNFSM4Z7M5QZQ .

emmericp commented 3 years ago

No, you can't use the normal system tcpdump on a DPDK-related thing :(