AUTHORS: Add Erik for his contribution
[netsniff-ng.git] / trafgen.8
blobcd528546ade3941acd52d86ffa9b093fd9717295
1 .\" netsniff-ng - the packet sniffing beast
2 .\" Copyright 2013 Daniel Borkmann.
3 .\" Subject to the GPL, version 2.
4 .TH TRAFGEN 8 "03 March 2013" "Linux" "netsniff-ng toolkit"
5 .SH NAME
6 trafgen \- a fast, multithreaded network packet generator
7 .PP
8 .SH SYNOPSIS
9 .PP
10 \fBtrafgen\fR [\fIoptions\fR] [\fIpacket\fR]
11 .PP
12 .SH DESCRIPTION
13 .PP
14 trafgen is a fast, zero-copy network traffic generator for debugging,
15 performance evaluation, and fuzz-testing. trafgen utilizes the packet(7)
16 socket interface of Linux which postpones complete control over packet data
17 and packet headers into the user space. It has a powerful packet configuration
18 language, which is rather low-level and not limited to particular protocols.
19 Thus, trafgen can be used for many purposes. Its only limitation is that it
20 cannot mimic full streams resp. sessions. However, it is very useful for
21 various kinds of load testing in order to analyze and subsequently improve
22 systems behaviour under DoS attack scenarios, for instance.
23 .PP
24 trafgen is Linux specific, meaning there is no support for other operating
25 systems, same as netsniff-ng(8), thus we can keep the code footprint quite
26 minimal and to the point. trafgen makes use of packet(7) socket's TX_RING
27 interface of the Linux kernel, which is a mmap(2)'ed ring buffer shared between
28 user and kernel space.
29 .PP
30 By default, trafgen starts as many processes as available CPUs, pins each
31 of them to their respective CPU and sets up the ring buffer each in their own
32 process space after having compiled a list of packets to transmit. Thus, this is
33 likely the fastest one can get out of the box in terms of transmission performance
34 from user space, without having to load unsupported or non-mainline third-party
35 kernel modules. On Gigabit Ethernet, trafgen has a comparable performance to
36 pktgen, the built-in Linux kernel traffic generator, except that trafgen is more
37 flexible in terms of packet configuration possibilities. On 10-Gigabit-per-second
38 Ethernet, trafgen might be slower than pktgen due to the user/kernel space
39 overhead but still has a fairly high performance for out of the box kernels.
40 .PP
41 trafgen has the potential to do fuzz testing, meaning a packet configuration can
42 be built with random numbers on all or certain packet offsets that are freshly
43 generated each time a packet is sent out. With a built-in IPv4 ping, trafgen can
44 send out an ICMP probe after each packet injection to the remote host in order
45 to test if it is still responsive/alive. Assuming there is no answer from the
46 remote host after a certain threshold of probes, the machine is considered dead
47 and the last sent packet is printed together with the random seed that was used
48 by trafgen. You might not really get lucky fuzz-testing the Linux kernel, but
49 presumably there are buggy closed-source embedded systems or network driver's
50 firmware files that are prone to bugs, where trafgen could help in finding them.
51 .PP
52 trafgen's configuration language is quite powerful, also due to the fact, that
53 it supports C preprocessor macros. A stddef.h is being shipped with trafgen for
54 this purpose, so that well known defines from Linux kernel or network programming
55 can be reused. After a configuration file has passed the C preprocessor stage,
56 it is processed by the trafgen packet compiler. The language itself supports a
57 couple of features that are useful when assembling packets, such as built-in
58 runtime checksum support for IP, UDP and TCP. Also it has an expression evaluator
59 where arithmetic (basic operations, bit operations, bit shifting, ...) on constant
60 expressions is being reduced to a single constant on compile time. Other features
61 are ''fill'' macros, where a packet can be filled with n bytes by a constant, a
62 compile-time random number or run-time random number (as mentioned with fuzz
63 testing). Also, netsniff-ng(8) is able to convert a pcap file into a trafgen
64 configuration file, thus such a configuration can then be further tweaked for a
65 given scenario.
66 .PP
67 .SH OPTIONS
68 .PP
69 .SS -i <cfg|->, -c <cfg|i>, --in <cfg|->, --conf <cfg|->
70 Defines the input configuration file that can either be passed as a normal plain
71 text file or via stdin (''-''). Note that currently, if a configuration is
72 passed through stdin, only 1 CPU will be used.
73 .PP
74 .SS -o <dev>, -d <dev>, --out <dev>, --dev <dev>
75 Defines the outgoing networking device such as eth0, wlan0 and others.
76 .PP
77 .SS -p, --cpp
78 Pass the packet configuration to the C preprocessor before reading it into
79 trafgen. This allows #define and #include directives (e.g. to include
80 definitions from system headers) to be used in the trafgen configuration file.
81 .PP
82 .SS -D <name>=<definition>, --define <name>=<definition>
83 Add macro definition for the C preprocessor to use it within trafgen file. This
84 option is used in combination with the -p,--cpp option.
85 .PP
86 .SS -J, --jumbo-support
87 By default trafgen's ring buffer frames are of a fixed size of 2048 bytes.
88 This means that if you're expecting jumbo frames or even super jumbo frames to
89 pass your line, then you will need to enable support for that with the help of
90 this option. However, this has the disadvantage of a performance regression and
91 a bigger memory footprint for the ring buffer.
92 .PP
93 .SS -R, --rfraw
94 In case the output networking device is a wireless device, it is possible with
95 trafgen to turn this into monitor mode and create a mon<X> device that trafgen
96 will be transmitting on instead of wlan<X>, for instance. This enables trafgen
97 to inject raw 802.11 frames.
98 .PP
99 .SS -s <ipv4>, --smoke-test <ipv4>
100 In case this option is enabled, trafgen will perform a smoke test. In other
101 words, it will probe the remote end, specified by an <ipv4> address, that is
102 being ''attacked'' with trafgen network traffic, if it is still alive and
103 responsive. That means, after each transmitted packet that has been configured,
104 trafgen sends out ICMP echo requests and waits for an answer before it continues.
105 In case the remote end stays unresponsive, trafgen assumes that the machine
106 has crashed and will print out the content of the last packet as a trafgen
107 packet configuration and the random seed that has been used in order to
108 reproduce a possible bug. This might be useful when testing proprietary embedded
109 devices. It is recommended to have a direct link between the host running
110 trafgen and the host being attacked by trafgen.
112 .SS -n <0|uint>, --num <0|uint>
113 Process a number of packets and then exit. If the number of packets is 0, then
114 this is equivalent to infinite packets resp. processing until interrupted.
115 Otherwise, a number given as an unsigned integer will limit processing.
117 .SS -r, --rand
118 Randomize the packet selection of the configuration file. By default, if more
119 than one packet is defined in a packet configuration, packets are scheduled for
120 transmission in a round robin fashion. With this option, they are selected
121 randomly instread.
123 .SS -P <uint>, --cpus <uint>
124 Specify the number of processes trafgen shall fork(2) off. By default trafgen
125 will start as many processes as CPUs that are online and pin them to each,
126 respectively. Allowed value must be within interval [1,CPUs].
128 .SS -t <time>, --gap <time>
129 Specify a static inter-packet timegap in seconds, milliseconds, microseconds,
130 or nanoseconds: ''<num>s/ms/us/ns''. If no postfix is given default to
131 microseconds. If this option is given, then instead of packet(7)'s TX_RING
132 interface, trafgen will use sendto(2) I/O for network packets, even if the
133 <time> argument is 0. This option is useful for a couple of reasons: i)
134 comparison between sendto(2) and TX_RING performance, ii) low-traffic packet
135 probing for a given interval, iii) ping-like debugging with specific payload
136 patterns. Furthermore, the TX_RING interface does not cope with interpacket
137 gaps.
139 .SS -b <rate>, --rate <rate>
140 Specify the packet send rate <num>pps/B/kB/MB/GB/kbit/Mbit/Gbit/KiB/MiB/GiB units.
141 Like with the -t,--gap option, the packets are sent in slow mode.
143 .SS -S <size>, --ring-size <size>
144 Manually define the TX_RING resp. TX_RING size in ''<num>KiB/MiB/GiB''. On
145 default the size is being determined based on the network connectivity rate.
147 .SS -E <uint>, --seed <uint>
148 Manually set the seed for pseudo random number generator (PRNG) in trafgen. By
149 default, a random seed from /dev/urandom is used to feed glibc's PRNG. If that
150 fails, it falls back to the unix timestamp. It can be useful to set the seed
151 manually in order to be able to reproduce a trafgen session, e.g. after fuzz
152 testing.
154 .SS -u <uid>, --user <uid> resp. -g <gid>, --group <gid>
155 After ring setup, drop privileges to a non-root user/group combination.
157 .SS -H, --prio-high
158 Set this process as a high priority process in order to achieve a higher
159 scheduling rate resp. CPU time. This is however not the default setting, since
160 it could lead to starvation of other processes, for example low priority kernel
161 threads.
163 .SS -A, --no-sock-mem
164 Do not change systems default socket memory setting during testrun.
165 Default is to boost socket buffer memory during the test to:
167    /proc/sys/net/core/rmem_default:4194304
168    /proc/sys/net/core/wmem_default:4194304
169    /proc/sys/net/core/rmem_max:104857600
170    /proc/sys/net/core/wmem_max:104857600
172 .SS -Q, --notouch-irq
173 Do not reassign the NIC's IRQ CPU affinity settings.
175 .SS -q, --qdisc-path
176 Since Linux 3.14, the kernel supports a socket option PACKET_QDISC_BYPASS,
177 which trafgen enables by default.  This options disables the qdisc bypass,
178 and uses the normal send path through the kernel's qdisc (traffic control)
179 layer, which can be usefully for testing the qdisc path.
181 .SS -V, --verbose
182 Let trafgen be more talkative and let it print the parsed configuration and
183 some ring buffer statistics.
185 .SS -e, --example
186 Show a built-in packet configuration example. This might be a good starting
187 point for an initial packet configuration scenario.
189 .SS -C, --no-cpu-stats
190 Do not print CPU time statistics on exit.
192 .SS -v, --version
193 Show version information and exit.
195 .SS -h, --help
196 Show user help and exit.
198 .SH SYNTAX
200 trafgen's packet configuration syntax is fairly simple. The very basic things
201 one needs to know is that a configuration file is a simple plain text file
202 where packets are defined. It can contain one or more packets. Packets are
203 enclosed by opening '{' and closing '}' braces, for example:
205    { /* packet 1 content goes here ... */ }
206    { /* packet 2 content goes here ... */ }
208 Alternatively, packets can also be specified directly on the command line, using
209 the same syntax as used in the configuration files.
211 When trafgen is started using multiple CPUs (default), then each of those packets
212 will be scheduled for transmission on all CPUs by default. However, it is possible
213 to tell trafgen to schedule a packet only on a particular CPU:
215    cpu(1): { /* packet 1 content goes here ... */ }
216    cpu(2-3): { /* packet 2 content goes here ... */ }
218 Thus, in case we have a 4 core machine with CPU0-CPU3, packet 1 will be scheduled
219 only on CPU1, packet 2 on CPU2 and CPU3. When using trafgen with \-\-num option,
220 then these constraints will still be valid and the packet is fairly distributed
221 among those CPUs.
223 Packet content is delimited either by a comma or whitespace, or both:
225    { 0xca, 0xfe, 0xba 0xbe }
227 Packet content can be of the following:
229    hex bytes:   0xca, xff
230    decimal:     42
231    binary:      0b11110000, b11110000
232    octal:       011
233    character:   'a'
234    string:      "hello world"
235    shellcode:   "\\x31\\xdb\\x8d\\x43\\x17\\x99\\xcd\\x80\\x31\\xc9"
237 Thus, a quite useless packet configuration might look like this (one can verify
238 this when running this with trafgen in combination with \-V):
240    { 0xca, 42, 0b11110000, 011, 'a', "hello world",
241      "\\x31\\xdb\\x8d\\x43\\x17\\x99\\xcd\\x80\\x31\\xc9" }
243 There are a couple of helper functions in trafgen's language to make life easier
244 to write configurations:
246 i) Fill with garbage functions:
248    byte fill function:      fill(<content>, <times>): fill(0xca, 128)
249    compile-time random:     rnd(<times>): rnd(128), rnd()
250    runtime random numbers:  drnd(<times>): drnd(128), drnd()
251    compile-time counter:    seqinc(<start-val>, <increment>, <times>)
252                             seqdec(<start-val>, <decrement>, <times>)
253    runtime counter (1byte): dinc(<min-val>, <max-val>, <increment>)
254                             ddec(<min-val>, <max-val>, <decrement>)
256 ii) Checksum helper functions (packet offsets start with 0):
258    IP/ICMP checksum:        csumip/csumicmp(<off-from>, <off-to>)
259    UDP checksum:            csumudp(<off-iphdr>, <off-udpdr>)
260    TCP checksum:            csumtcp(<off-iphdr>, <off-tcphdr>)
261    UDP checksum (IPv6):     csumudp6(<off-ip6hdr>, <off-udpdr>)
262    TCP checksum (IPv6):     csumtcp6(<off-ip6hdr>, <off-tcphdr>)
264 iii) Multibyte functions, compile-time expression evaluation:
266    const8(<content>), c8(<content>), const16(<content>), c16(<content>),
267    const32(<content>), c32(<content>), const64(<content>), c64(<content>)
269    These functions write their result in network byte order into the packet
270 configuration, e.g. const16(0xaa) will result in ''00 aa''. Within c*()
271 functions, it is possible to do some arithmetics: -,+,*,/,%,&,|,<<,>>,^
272 E.g. const16((((1<<8)+0x32)|0b110)*2) will be evaluated to ''02 6c''.
274 iv) Protocol header functions:
275 The protocol header functions allow to fill protocol header fields by
276 using following generic syntax:
277 .in +8
279 <proto>(<field>=<value>,<field2>=<value2>,...,<field3>,...)
281 .in -8
282 .in +4
283 If a field is not specified, then a default value will be used (usually 0).
284 Protocol fields might be set in any order. However, the offset of the fields in
285 the resulting packet is according to the respective protocol.
287 All required lower layer headers will be filled automatically if they were not
288 specified by the user. The headers will be filled in the order they were
289 specified. Each header will be filled with some mimimum required set of fields.
290 .in -4
292 .in +4
293 Supported protocol headers:
295 .I Ethernet
297 .B eth(da=<mac>, sa=<mac>, prot=<number>)
299 .in +4
300 .B da|daddr
301 - Destination MAC address (default: 00:00:00:00:00:00)
303 .B sa|saddr
304 - Source MAC address (default: device MAC address)
306 .B prot|proto
307 - Ethernet type (default: 0)
308 .in -4
310 .I ARP
312 .B arp(htype=<number>, ptype=<number>, op=<request|reply|number>, request,
313 .B reply, smac=<mac>, sip=<ip4_addr>, tmac=<mac>, tip=<ip4_addr>)
315 .in +4
316 .B htype
317 - ARP hardware type (default: 1 [Ethernet])
319 .B ptype
320 - ARP protocol type (default: 0x0800 [IPv4])
322 .B op
323 - ARP operation type (request/reply) (default: request)
325 .B req|request
326 - ARP Request operation type
328 .B reply
329 - ARP Reply operation type
331 .B smac|sha
332 - Sender hardware (MAC) address (default: device MAC address)
334 .B sip|spa
335 - Sender protocol (IPv4) address (default: device IPv4 address)
337 .B tmac|tha
338 - Target hardware (MAC) address (default: 00:00:00:00:00:00)
340 .B tip|tpa
341 - Target protocol (IPv4) address (default: device IPv4 address)
342 .in -4
344 By default, the ARP operation field is set to request and the Ethernet
345 destination MAC address is set to the broadcast address (ff:ff:ff:ff:ff:ff).
347 .I IPv4
349 .B ip4|ipv4(ihl=<number>, ver=<number>, len=<number>, csum=<number>,
350 .B ttl=<number>, tos=<number>, dscp=<number>, ecn=<number>,
351 .in +16
352 .B id=<number>, flags=<number>, frag=<number>, df, mf, da=<ip4_addr>, sa=<ip4_addr>,
353 .B prot[o]=<number>)
354 .in -16
356 .in +4
357 .B ver|version
358 - Version field (default: 4)
360 .B ihl
361 - Header length in number of 32-bit words (default: 5)
363 .B tos
364 - Type of Service (ToS) field (default: 0)
366 .B dscp
367 - Differentiated Services Code Point (DSCP, DiffServ) field (default: 0)
369 .B ecn
370 - Explicit Congestion Notification (ECN) field (default: 0)
372 .B len|length
373 - Total length of header and data (calculated by default)
375 .B id
376 - IPv4 datagram identification (default: 0)
378 .B flags
379 - IPv4 flags value (DF, MF) (default: 0)
381 .B df
382 - Don't fragment (DF) flag (default: 0)
384 .B mf
385 - More fragments (MF) flag (default: 0)
387 .B frag
388 - Fragment offset field in number of 8 byte blocks (default: 0)
390 .B ttl
391 - Time to live (TTL) field (default: 0)
393 .B csum
394 - Header checksum (calculated by default)
396 .B sa|saddr
397 - Source IPv4 address (default: device IPv4 address)
399 .B da|daddr
400 - Destination IPv4 address (default: 0.0.0.0)
402 .B prot|proto
403 - IPv4 protocol number (default: 0)
404 .in -4
406 By default, if the lower level header is Ethernet, its EtherType field is set to
407 0x0800 (IPv4). If the lower level header is IPv4, its protocol field is set to
408 0x4 (IP-in-IP).
410 .I UDP
412 .B udp(sp=<number>, dp=<number>, len=<number>, csum=<number>)
414 .in +4
415 .B sp|sport
416 - Source port (default: 0)
418 .B dp|dport
419 - Destination port (default: 0)
421 .B len|length
422 - Length of UDP header and data (calculated by default)
424 .B csum
425 - Checksum field over IPv4 pseudo header (calculated by default)
427 .in -4
428 By default, if the lower level header is IPv4, its protocol field is set to
429 0x11 (UDP).
431 Simple example of a UDP Echo packet:
433 .in +5
434    {
435      eth(da=11:22:33:44:55:66),
436      ip(daddr=1.2.3.4)
437      udp(dp=7),
438      "Hello world"
439    }
440 .in -5
442 Furthermore, there are two types of comments in trafgen configuration files:
444   1. Multi-line C-style comments:        /* put comment here */
445   2. Single-line Shell-style comments:   #  put comment here
447 Next to all of this, a configuration can be passed through the C preprocessor
448 before the trafgen compiler gets to see it with option \-\-cpp. To give you a
449 taste of a more advanced example, run ''trafgen \-e'', fields are commented:
451    /* Note: dynamic elements make trafgen slower! */
452    #include <stddef.h>
454    {
455      /* MAC Destination */
456      fill(0xff, ETH_ALEN),
457      /* MAC Source */
458      0x00, 0x02, 0xb3, drnd(3),
459      /* IPv4 Protocol */
460      c16(ETH_P_IP),
461      /* IPv4 Version, IHL, TOS */
462      0b01000101, 0,
463      /* IPv4 Total Len */
464      c16(59),
465      /* IPv4 Ident */
466      drnd(2),
467      /* IPv4 Flags, Frag Off */
468      0b01000000, 0,
469      /* IPv4 TTL */
470      64,
471      /* Proto TCP */
472      0x06,
473      /* IPv4 Checksum (IP header from, to) */
474      csumip(14, 33),
475      /* Source IP */
476      drnd(4),
477      /* Dest IP */
478      drnd(4),
479      /* TCP Source Port */
480      drnd(2),
481      /* TCP Dest Port */
482      c16(80),
483      /* TCP Sequence Number */
484      drnd(4),
485      /* TCP Ackn. Number */
486      c32(0),
487      /* TCP Header length + TCP SYN/ECN Flag */
488      c16((8 << 12) | TCP_FLAG_SYN | TCP_FLAG_ECE)
489      /* Window Size */
490      c16(16),
491      /* TCP Checksum (offset IP, offset TCP) */
492      csumtcp(14, 34),
493      /* TCP Options */
494      0x00, 0x00, 0x01, 0x01, 0x08, 0x0a, 0x06,
495      0x91, 0x68, 0x7d, 0x06, 0x91, 0x68, 0x6f,
496      /* Data blob */
497      "gotcha!",
498    }
500 Another real-world example by Jesper Dangaard Brouer [1]:
502    {
503      # --- ethernet header ---
504      0x00, 0x1b, 0x21, 0x3c, 0x9d, 0xf8,  # mac destination
505      0x90, 0xe2, 0xba, 0x0a, 0x56, 0xb4,  # mac source
506      const16(0x0800), # protocol
507      # --- ip header ---
508      # ipv4 version (4-bit) + ihl (4-bit), tos
509      0b01000101, 0,
510      # ipv4 total len
511      const16(40),
512      # id (note: runtime dynamic random)
513      drnd(2),
514      # ipv4 3-bit flags + 13-bit fragment offset
515      # 001 = more fragments
516      0b00100000, 0,
517      64, # ttl
518      17, # proto udp
519      # dynamic ip checksum (note: offsets are zero indexed)
520      csumip(14, 33),
521      192, 168, 51, 1, # source ip
522      192, 168, 51, 2, # dest ip
523      # --- udp header ---
524      # as this is a fragment the below stuff does not matter too much
525      const16(48054), # src port
526      const16(43514), # dst port
527      const16(20),    # udp length
528      # udp checksum can be dyn calc via csumudp(offset ip, offset tcp)
529      # which is csumudp(14, 34), but for udp its allowed to be zero
530      const16(0),
531      # payload
532      'A',  fill(0x41, 11),
533    }
535    [1] http://thread.gmane.org/gmane.linux.network/257155
537 .SH USAGE EXAMPLE
539 .SS trafgen --dev eth0 --conf trafgen.cfg
540 This is the most simple and, probably, the most common use of trafgen. It
541 will generate traffic defined in the configuration file ''trafgen.cfg'' and
542 transmit this via the ''eth0'' networking device. All online CPUs are used.
544 .SS trafgen -e | trafgen -i - -o lo --cpp -n 1
545 This is an example where we send one packet of the built-in example through
546 the loopback device. The example configuration is passed via stdin and also
547 through the C preprocessor before trafgen's packet compiler will see it.
549 .SS trafgen --dev eth0 --conf fuzzing.cfg --smoke-test 10.0.0.1
550 Read the ''fuzzing.cfg'' packet configuration file (which contains drnd()
551 calls) and send out the generated packets to the ''eth0'' device. After each
552 sent packet, ping probe the attacked host with address 10.0.0.1 to check if
553 it's still alive. This also means, that we utilize 1 CPU only, and do not
554 use the TX_RING, but sendto(2) packet I/O due to ''slow mode''.
556 .SS trafgen --dev wlan0 --rfraw --conf beacon-test.txf -V --cpus 2
557 As an output device ''wlan0'' is used and put into monitoring mode, thus we
558 are going to transmit raw 802.11 frames through the air. Use the
559  ''beacon-test.txf'' configuration file, set trafgen into verbose mode and
560 use only 2 CPUs.
562 .SS trafgen --dev em1 --conf frag_dos.cfg --rand --gap 1000us
563 Use trafgen in sendto(2) mode instead of TX_RING mode and sleep after each
564 sent packet a static timegap for 1000us. Generate packets from ''frag_dos.cfg''
565 and select next packets to send randomly instead of a round-robin fashion.
566 The output device for packets is ''em1''.
568 .SS trafgen --dev eth0 --conf icmp.cfg --rand --num 1400000 -k1000
569 Send only 1400000 packets using the ''icmp.cfg'' configuration file and then
570 exit trafgen. Select packets randomly from that file for transmission and
571 send them out via ''eth0''. Also, trigger the kernel every 1000us for batching
572 the ring frames from user space (default is 10us).
574 .SS trafgen --dev eth0 --conf tcp_syn.cfg -u `id -u bob` -g `id -g bob`
575 Send out packets generated from the configuration file ''tcp_syn.cfg'' via
576 the ''eth0'' networking device. After setting up the ring for transmission,
577 drop credentials to the non-root user/group bob/bob.
579 .SS trafgen --dev eth0 '{ fill(0xff, 6), 0x00, 0x02, 0xb3, rnd(3), c16(0x0800), fill(0xca, 64) }' -n 1
580 Send out 1 invaid IPv4 packet built from command line to all hosts.
582 .SH NOTE
584 trafgen can saturate a Gigabit Ethernet link without problems. As always,
585 of course, this depends on your hardware as well. Not everywhere where it
586 says Gigabit Ethernet on the box, will you reach almost physical line rate!
587 Please also read the netsniff-ng(8) man page, section NOTE for further
588 details about tuning your system e.g. with tuned(8).
590 If you intend to use trafgen on a 10-Gbit/s Ethernet NIC, make sure you
591 are using a multiqueue tc(8) discipline, and make sure that the packets
592 you generate with trafgen will have a good distribution among tx_hashes
593 so that you'll actually make use of multiqueues.
595 For introducing bit errors, delays with random variation and more, there
596 is no built-in option in trafgen. Rather, one should reuse existing methods
597 for that which integrate nicely with trafgen, such as tc(8) with its
598 different disciplines, i.e. netem.
600 For more complex packet configurations, it is recommended to use high-level
601 scripting for generating trafgen packet configurations in a more automated
602 way, i.e. also to create different traffic distributions that are common for
603 industrial benchmarking:
605     Traffic model              Distribution
607     IMIX                       64:7,  570:4,  1518:1
608     Tolly                      64:55,  78:5,   576:17, 1518:23
609     Cisco                      64:7,  594:4,  1518:1
610     RPR Trimodal               64:60, 512:20, 1518:20
611     RPR Quadrimodal            64:50, 512:15, 1518:15, 9218:20
613 The low-level nature of trafgen makes trafgen rather protocol independent
614 and therefore useful in many scenarios when stress testing is needed, for
615 instance. However, if a traffic generator with higher level packet
616 descriptions is desired, netsniff-ng's mausezahn(8) can be of good use as
617 well.
619 For smoke/fuzz testing with trafgen, it is recommended to have a direct
620 link between the host you want to analyze (''victim'' machine) and the host
621 you run trafgen on (''attacker'' machine). If the ICMP reply from the victim
622 fails, we assume that probably its kernel crashed, thus we print the last
623 sent packet together with the seed and quit probing. It might be very unlikely
624 to find such a ping-of-death on modern Linux systems. However, there might
625 be a good chance to find it on some proprietary (e.g. embedded) systems or
626 buggy driver firmwares that are in the wild. Also, fuzz testing can be done
627 on raw 802.11 frames, of course. In case you find a ping-of-death, please
628 mention that you were using trafgen in your commit message of the fix!
630 .SH BUGS
631 For old trafgen versions only, there could occur kernel crashes: we have fixed
632 this bug in the mainline and stable kernels under commit 7f5c3e3a8 (''af_packet:
633 remove BUG statement in tpacket_destruct_skb'') and also in trafgen.
635 Probably the best is if you upgrade trafgen to the latest version.
637 .SH LEGAL
638 trafgen is licensed under the GNU GPL version 2.0.
640 .SH HISTORY
641 .B trafgen
642 was originally written for the netsniff-ng toolkit by Daniel Borkmann. It
643 is currently maintained by Tobias Klauser <tklauser@distanz.ch> and Daniel
644 Borkmann <dborkma@tik.ee.ethz.ch>.
646 .SH SEE ALSO
647 .BR netsniff-ng (8),
648 .BR mausezahn (8),
649 .BR ifpps (8),
650 .BR bpfc (8),
651 .BR flowtop (8),
652 .BR astraceroute (8),
653 .BR curvetun (8)
655 .SH AUTHOR
656 Manpage was written by Daniel Borkmann.
658 .SH COLOPHON
659 This page is part of the Linux netsniff-ng toolkit project. A description of the project,
660 and information about reporting bugs, can be found at http://netsniff-ng.org/.