Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   trafgen    ( 8 )

быстрый многопоточный генератор сетевых пакетов (a fast, multithreaded network packet generator)

  Name  |  Synopsis  |  Description  |    Options    |  Syntax  |  Usage example  |  Note  |  Bugs  |  History  |  See also  |

Параметры (Options)

-i <cfg|pcap|->, -c <cfg|->, --in <cfg|pcap|->, --conf <cfg|->
              Defines the input configuration file that can either be
              passed as a normal plain text file or via stdin (''-'').
              Note that currently, if a configuration is passed through
              stdin, only 1 CPU will be used.  It is also possible to
              specify PCAP file with .pcap extension via -i/--in option,
              by default packets will be sent at rate considering
              timestamp from PCAP file which might be reset via the -b
              or -t option.

-o <dev|.pcap|.cfg>, -d <dev|.pcap|.cfg>, --out <dev|.pcap|.cfg>, --dev <dev|.pcap|.cfg> Defines the outgoing networking device such as eth0, wlan0 and others or a *.pcap or *.cfg file. Pcap and configuration files are identified by extension.

-p, --cpp Pass the packet configuration to the C preprocessor before reading it into trafgen. This allows #define and #include directives (e.g. to include definitions from system headers) to be used in the trafgen configuration file.

-D <name>=<definition>, --define <name>=<definition> Add macro definition for the C preprocessor to use it within trafgen file. This option is used in combination with the -p/--cpp option.

-J, --jumbo-support By default trafgen's ring buffer frames are of a fixed size of 2048 bytes. This means that if you're expecting jumbo frames or even super jumbo frames to pass your line, then you will need to enable support for that with the help of this option. However, this has the disadvantage of a performance regression and a bigger memory footprint for the ring buffer.

-R, --rfraw In case the output networking device is a wireless device, it is possible with trafgen to turn this into monitor mode and create a mon<X> device that trafgen will be transmitting on instead of wlan<X>, for instance. This enables trafgen to inject raw 802.11 frames. In case if the output is a pcap file the link type is set to 127 (ieee80211 radio tap).

-s <ipv4>, --smoke-test <ipv4> In case this option is enabled, trafgen will perform a smoke test. In other words, it will probe the remote end, specified by an <ipv4> address, that is being ''attacked'' with trafgen network traffic, if it is still alive and responsive. That means, after each transmitted packet that has been configured, trafgen sends out ICMP echo requests and waits for an answer before it continues. In case the remote end stays unresponsive, trafgen assumes that the machine has crashed and will print out the content of the last packet as a trafgen packet configuration and the random seed that has been used in order to reproduce a possible bug. This might be useful when testing proprietary embedded devices. It is recommended to have a direct link between the host running trafgen and the host being attacked by trafgen.

-n <0|uint>, --num <0|uint> Process a number of packets and then exit. If the number of packets is 0, then this is equivalent to infinite packets resp. processing until interrupted. Otherwise, a number given as an unsigned integer will limit processing.

-r, --rand Randomize the packet selection of the configuration file. By default, if more than one packet is defined in a packet configuration, packets are scheduled for transmission in a round robin fashion. With this option, they are selected randomly instread.

-P <uint>[-<uint>], --cpus <uint>[-<uint>] Specify the number of processes trafgen shall fork(2) off or list exact CPUs to use. By default trafgen will start as many processes as CPUs that are online and pin them to each, respectively. A single integer within interval [1,CPUs] overrides number of processes, which will be spawned starting from the first CPU. A pair of integers within interval [0,CPUs-1], and separated using ''-'' represents an interval of CPUs, which will be used to spawn worker processes.

-t <time>, --gap <time> Specify a static inter-packet timegap in seconds, milliseconds, microseconds, or nanoseconds: ''<num>s/ms/us/ns''. If no postfix is given default to microseconds. If this option is given, then instead of packet(7)'s TX_RING interface, trafgen will use sendto(2) I/O for network packets, even if the <time> argument is 0. This option is useful for a couple of reasons:

1) comparison between sendto(2) and TX_RING performance, 2) low-traffic packet probing for a given interval, 3) ping-like debugging with specific payload patterns.

Furthermore, the TX_RING interface does not cope with interpacket gaps.

-b <rate>, --rate <rate> Specify the packet send rate <num>pps/kpps/Mpps/B/kB/MB/GB/kbit/Mbit/Gbit/KiB/MiB/GiB units. Like with the -t/--gap option, the packets are sent in slow mode.

-S <size>, --ring-size <size> Manually define the TX_RING resp. TX_RING size in ''<num>KiB/MiB/GiB''. By default the size is being determined based on the network connectivity rate.

-E <uint>, --seed <uint> Manually set the seed for pseudo random number generator (PRNG) in trafgen. By default, a random seed from /dev/urandom is used to feed glibc's PRNG. If that fails, it falls back to the unix timestamp. It can be useful to set the seed manually in order to be able to reproduce a trafgen session, e.g. after fuzz testing.

-u <uid>, --user <uid> resp. -g <gid>, --group <gid> After ring setup, drop privileges to a non-root user/group combination.

-H, --prio-high Set this process as a high priority process in order to achieve a higher scheduling rate resp. CPU time. This is however not the default setting, since it could lead to starvation of other processes, for example low priority kernel threads.

-A, --no-sock-mem Do not change systems default socket memory setting during testrun. Default is to boost socket buffer memory during the test to:

/proc/sys/net/core/rmem_default:4194304 /proc/sys/net/core/wmem_default:4194304 /proc/sys/net/core/rmem_max:104857600 /proc/sys/net/core/wmem_max:104857600

-Q, --notouch-irq Do not reassign the NIC's IRQ CPU affinity settings.

-q, --qdisc-path Since Linux 3.14, the kernel supports a socket option PACKET_QDISC_BYPASS, which trafgen enables by default. This options disables the qdisc bypass, and uses the normal send path through the kernel's qdisc (traffic control) layer, which can be usefully for testing the qdisc path.

-V, --verbose Let trafgen be more talkative and let it print the parsed configuration and some ring buffer statistics.

-e, --example Show a built-in packet configuration example. This might be a good starting point for an initial packet configuration scenario.

-C, --no-cpu-stats Do not print CPU time statistics on exit.

-v, --version Show version information and exit.

-h, --help Show user help and exit.