tcpprep(1)
| TCPPREP(1) | Tcpreplay Suite | TCPPREP(1) |
NAME
tcpprep - Create a tcpreplay cache cache file from a pcap file.
SYNOPSIS
tcpprep [OPTION]...
DESCRIPTION
tcpprep is a pcap(3) file pre-processor which creates a cache file which provides "rules" for tcprewrite(1) and tcpreplay(1) on how to process and send packets.
The basic operation of tcpreplay is to resend all packets from the input file(s) out a single file. Tcpprep processes a pcap file and applies a set of user-specified rules to create a cache file which tells tcpreplay whether or not to send each packet and which interface the packet should be sent out of.
For more details, please see the Tcpreplay Manual at: <http://tcpreplay.appneta.com>
OPTIONS
-d, --dbug=number
If configured with --enable-debug, then you can specify a verbosity level for debugging output. Higher numbers increase verbosity.
-a, --auto=string
Tcpprep will try to automatically determine the primary function of hosts based on the traffic captured and classify each host as client or server. In order to do so, you must provide a hint to tcpprep as to how to search for clients and servers. Valid hints are:
bridge
router
client
server
first
-c, --cidr=string
Specify a comma delimited list of CIDR netblocks to match against the source IP of each packet. Packets matching any of the CIDR’s are classified as servers.
IPv4 Example:
--cidr=192.168.0.0/16,172.16.0.0/12,10.0.0.0/8
IPv6 Example:
--cidr=[::ffff:0:0/96],[fe80::/16]
-r, --regex=string
Specify a regular expression to match against the source IP of each packet. Packets matching the regex are classified as servers.
-p, --port
Specifies that TCP and UDP traffic over IPv4 and IPv6 should be classified as client or server based upon the destination port of the header.
-e, --mac=string
Specify a list of MAC addresses to match against the source MAC of each packet. Packets matching one of the values are classified as servers.
--reverse
Normally the --mac, --regex and --cidr flags specify are used to specify the servers and non-IP packets are classified as clients. By using --reverse, these features are reversed so that the flags specify clients and non-IP packets are classified as servers.
-C, --comment=string
Specify a comment to be imbedded within the output cache file and later viewed.
--no-arg-comment
By default, tcpprep includes the arguments passed on the command line in the cache file comment (in addition to any user specified --comment). If for some reason you do not wish to include this, specify this option.
-x, --include=string
Override default of processing all packets stored in the capture file and only send/edit packets which match the provided rule. Rules can be one of:
S:<CIDR1>,...
D:<CIDR1>,...
B:<CIDR1>,...
E:<CIDR1>,...
P:<LIST>
-x P:1-5,9,15,72-
would process packets 1 through 5, the 9th and 15th packet, and packets 72 until the end of the file
F:'<bpf>'
-X, --exclude=string
Override default of processing all packets stored in the capture file and only send/edit packets which do NOT match the provided rule. Rules can be one of:
S:<CIDR1>,...
D:<CIDR1>,...
B:<CIDR1>,...
E:<CIDR1>,...
P:<LIST>
-x P:1-5,9,15,72-
would skip packets 1 through 5, the 9th and 15th packet, and packets 72 until the end of the file
-o, --cachefile=string
-i, --pcap=string
-P, --print-comment=string
-I, --print-info=string
-S, --print-stats=string
-s, --services=string
Uses a list of ports used by servers in the same format as of /etc/services: <service_name> <port>/<protocol> # comment
Example: http 80/tcp
-N, --nonip
By default, non-IP traffic which can not be classified as client or server is classified as "client". Specifying --nonip will reclassify non-IP traffic as "server". Note that the meaning of this flag is reversed if --reverse is used.
-R, --ratio=string
Since a given host may have both client and server traffic being sent to/from it, tcpprep uses a ratio to weigh these packets. If you would like to override the default of 2:1 server to client packets required for a host to be classified as a server, specify it as a floating point value.
-m, --minmask=number
By default, auto modes use a minimum network mask length of 30 bits to build networks containing clients and servers. This allows you to override this value. Larger values will increase performance but may provide inaccurate results.
-M, --maxmask=number
By default, auto modes use a maximum network mask length of 8 bits to build networks containing clients and servers. This allows you to override this value. Larger values will decrease performance and accuracy but will provide greater chance of success.
-v, --verbose
-A, --decode=string
When enabling verbose mode (-v) you may also specify one or more additional arguments to pass to tcpdump to modify the way packets are decoded. By default, -n and -l are used. Be sure to quote the arguments so that they are not interpreted by tcprewrite. The following arguments are valid:
[ -aAeNqRStuvxX ]
[ -E spi@ipaddr algo:secret,... ]
[ -s snaplen ]
-V, --version
-h, --less-help
-w, --suppress-warnings
-H, --help
--more-help
--save-opts[=string]
--load-opts=string, --no-load-opts
OPTION PRESETS
Any option that is not marked as not presettable may be preset by loading values from configuration ("RC" or ".INI") file(s). The homerc file is $$/, unless that is a directory; in that case .tcppreprc is searched for within it.
FILES
See OPTION PRESETS for configuration files.
EXIT STATUS
One of the following exit values will be returned:
0 (EXIT_SUCCESS)
1 (EXIT_FAILURE)
66 (EX_NOINPUT)
70 (EX_SOFTWARE)
AUTHORS
Copyright 2013-2026 Fred Klassen - AppNeta by Broadcom
Copyright 2000-2012 Aaron Turner
For support please use the <tcpreplay-users@lists.sourceforge.net> mailing list.
The latest version of this software is always available from: <http://tcpreplay.appneta.com/>
COPYRIGHT
Copyright © 2000-2026 Aaron Turner and Fred Klassen, all rights reserved. This program is released under the terms of the GNU General Public License, version 3 or later.
BUGS
Please send bug reports to: <tcpreplay-users@lists.sourceforge.net>
NOTES
This manual page was generated from the tcpprep option definitions.
| 2026-08-15 | Tcpreplay Suite |
