tgn(1) a network traffic generator


tgn [-V] [-v] [-l] [-s random seed] [-w PCAP filename] [-o output speaker] [-c packet count] [-h] [PDU definition]



is a network traffic generator. It is command-line interface (CLI) program that does the same thing as the send_network command of the Network Expect framework. Refer to nexp(1) for additional details regarding the send_network command.

The only mandatory option is a PDU definition.

The -c switch allows to specify the number of packets to send. If -c is not provided then the number of packets to send is calculated automatically based on the PDU definition.

-V causes tgn to print its version number and exit.

The -s flag allows to specify a random seed that will cause predicatibility of pseudo-random numbers generated by tgn during execution of a script. In cases where tgn is used as a protocol fuzzer, this option is useful to be able to re-generate a specific test case.

-v increases the verbosity level. Additional information may be displayed when the verbosity level is higher.

The -l flag causes tgn to display all available network speakers and exit. See nexp(1) for a discussion of network speakers.

The -o flag allows to select a specific network speaker for output. Use the -l option to list available speakers. By default, the "ip" speaker (kernel-routed IP packet delivery) is tried first and if it is not available, which can happen if tgn is not run with root privileges, the "hex" speaker is used.

The PDU definition is a string that defines a PDU. It uses libpbuild PDU syntax.


shell# tgn -o eth0 "ip(dst = = 'random')"

shell# tgn "ip(src =, dst = <,>,ttl = <1, 2>)/" \
"tcp(src = 'random', dst = 22..25, window = 16384,syn, seq = 'random', ack-seq = 0)"

shell# tgn -w /tmp/cap -c 5 "ether()/ip(dst = = 0++)" \
&& wireshark /tmp/cap


tgn has not been ported to Microsoft Windows.


This man page is correct for version 1.0 of tgn.


Network Expect was written by Eloy Paris <[email protected]>. However, Network Expect borrows ideas from lots of Open Source tools like Nemesis, Packit, hping, Expect, and Scapy. The Network Expect author is indebted to the authors of these tools for their contribution.

This man page was written by Eloy Paris.