TCPREPLAY(1)
π TCPREPLAY(1) π β the Tcpreplay Suite, bestie edition
okay so you're looking at tcpreplay(1) from the Tcpreplay Suite and honestly? she's a whole vibe. let's get into it π
β¨ NAME β¨
tcpreplay β replay network traffic stored in pcap files. that's it. that's the gig π«Ά
πΈ SYNOPSIS πΈ
tcpreplay [OPTION]... <pcap_file(s)> | <pcap_dir(s)>
π¦ DESCRIPTION π¦
so tcpreplay is literally the tool that replays network traffic from files that were saved with tcpdump or any other tool that writes pcap(3) files. iconic behavior honestly.
the basic operation is simple bestie: tcpreplay resends all the packets from the input file(s) at the speed they were recorded at, or at a data rate you specify, up to as fast as the hardware can actually handle. no cap. π₯
optionally, the traffic can be split between two interfaces, written to files, filtered and edited in various ways β which gives you the means to test firewalls, NIDS and other network devices. main character energy for network testing π
on Linux, raw IP (layer 3 only) interfaces such as WireGuard and tun are supported automatically: any layer 2 header in the input file (Ethernet including VLAN tags, Linux SLL, loopback, ...) is stripped and packets are sent as bare IPv4/IPv6. so cute of her. π§ non-IP packets such as ARP cannot be sent on these interfaces and are reported as failed. sad but true π
for more details, please see the Tcpreplay Manual at: http://tcpreplay.appneta.com
π OPTIONS π
-d,--dbug=numberβ turn on debugging output. Range:0to5. Default:0.
if you configured with --enable-debug, then you can specify a verbosity level for debugging output. higher numbers = more verbosity, more chaos, more lore π
-q,--quietβ quiet mode, bestie. print nothing except the statistics at the end of the run. minimalism slay β¨-T,--timer=stringβ pick your packet timing mode:select,ioport,gtod,nano. Default:gtod.
lets you select the packet timing method to use:
nanoβ use thenanosleep()APIselectβ use theselect()APIioportβ write to the i386 IO Port0x80gtod[default] β use agettimeofday()loop
--maxsleep=numberβ sleep for no more than X milliseconds between packets. Default:0.
sets a limit for the maximum number of milliseconds that tcpreplay will sleep between packets. effectively prevents long delays between packets without affecting the majority of packets. default is disabled. π
-v,--verboseβ print decoded packets viatcpdumpto STDOUT. yes she's chatty and we love her for it π¬-A,--decode=stringβ arguments passed to thetcpdumpdecoder. Requires:--verbose.
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 like: -A "-axxx" so that they are not interpreted by tcpreplay. please see the tcpdump(1) man page for a complete list of options. π
-K,--preload_pcapβ preloads packets into RAM before sending. π§ β¨
this option loads the specified pcap(s) into RAM before starting to send, in order to improve replay performance while introducing a startup performance hit. preloading can be used with or without --loop. this option also suppresses flow statistics collection for every iteration, which can significantly reduce memory usage. flow statistics are predicted based on options supplied and statistics collected from the first loop iteration. ngl that's kind of a big brain move.
-c,--cachefile=stringβ split traffic via atcpprepcache file. Requires:--intf2. Cannot be combined with:--dualfile.
if you have a pcap file you would like to use to send bi-directional traffic through a device (firewall, router, IDS, etc) then using tcpprep you can create a cachefile which tcpreplay will use to split the traffic across two network interfaces. two interfaces, one girlboss π«Ά
-2,--dualfileβ replay two files at a time from a network tap. Requires:--intf2. Cannot be combined with:--cachefile.
if you captured network traffic using a network tap, then you can end up with two pcap files β one for each direction. this option will replay these two files at the same time, one on each interface, and inter-mix them using the timestamps in each. synchronized besties fr fr β
-i,--intf1=stringβ client to server / RX / primary traffic output interface. This option is required.
the required network interface used to send either all traffic or traffic which is marked as 'primary' via tcpprep. primary traffic is usually client-to-server or inbound (RX) on khial virtual interfaces. she's mandatory, she's the moment π
-I,--intf2=stringβ server to client / TX / secondary traffic output interface.
optional network interface used to send traffic which is marked as 'secondary' via tcpprep. secondary traffic is usually server-to-client or outbound (TX) on khial virtual interfaces. generally, it only makes sense to use this option with --cachefile. iykyk π
-w,--write=stringβ pcap file to receive traffic outputs. Cannot be combined with:--intf2.
optional pcap file name used to receive traffic. write it down, keep the receipts π
--include=stringβ send only selected packet numbers. Cannot be combined with:--exclude.
override the default of processing all packets stored in the capture file and only send packets that are part of a supplied list of packet numbers. π―
-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.
--exclude=stringβ send all but selected packet numbers. Cannot be combined with:--include.
override the default of processing all packets stored in the capture file and only send packets that are NOT part of a supplied list of packet numbers. π ββοΈ
-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.
--listnicsβ list available network interfaces and exit. little peek at the menu, then she's out π¦-l,--loop=numberβ loop through the capture file X times. Range:0to any. Default:1. round and round we go π--loopdelay-ms=numberβ delay between loops in milliseconds. Range:0to any. Default:0. Requires:--loop. Cannot be combined with:--loopdelay-ns.--loopdelay-ns=numberβ delay between loops in nanoseconds. Range:0to any. Default:0. Requires:--loop. Cannot be combined with:--loopdelay-ms.
by default, tcpreplay will use loop delay with microsecond accuracy (loopdelay-ms). in order to use loop delay with nanosecond accuracy you need to use nano packet timing mode. precision queen β±οΈπ
--pktlenβ override the snaplen and use the actual packet len.
by default, tcpreplay will send packets based on the size of the "snaplen" stored in the pcap file, which is usually the correct thing to do. however, occasionally, tools will store more bytes than told to. by specifying this option, tcpreplay will ignore the snaplen field and instead try to send packets based on the original packet length.
β οΈ bad things may happen if you specify this option. like, actually. she said what she said. π
-L,--limit=numberβ limit the number of packets to send. Range:1to any. Default:-1.
by default, tcpreplay will send all the packets. alternatively, you can specify a maximum number of packets to send. setting boundaries, we love to see it β¨
--duration=numberβ limit the number of seconds to send. Range:1to any. Default:-1.
by default, tcpreplay will send all the packets. alternatively, you can specify a maximum number of seconds to transmit. β³
-x,--multiplier=stringβ modify replay speed to a given multiple. Cannot be combined with:--pps,--mbps,--oneatatime,--topspeed.
specify a value to modify the packet replay speed. examples:
2.0 will replay traffic at twice the speed captured
0.7 will replay traffic at 70% the speed captured
-p,--pps=stringβ replay packets at a given packets/sec. Cannot be combined with:--multiplier,--mbps,--oneatatime,--topspeed.
specify a value to regulate the packet replay to a specific packet-per-second rate. examples:
200 will replay traffic at 200 packets per second
0.25 will replay traffic at 15 packets per minute
-M,--mbps=stringβ replay packets at a given Mbps. Cannot be combined with:--multiplier,--pps,--oneatatime,--topspeed.
specify a floating point value for the Mbps rate that tcpreplay should send packets at. floating point, because accuracy matters π
-t,--topspeedβ replay packets as fast as possible. Cannot be combined with:--mbps,--multiplier,--pps,--oneatatime. full send, no brakes π₯π₯-o,--oneatatimeβ replay one packet at a time for each user input. Cannot be combined with:--mbps,--pps,--multiplier,--topspeed.
allows you to step through one or more packets at a time. manual mode, like a little packet inspector π΅οΈββοΈ
--pps-multi=numberβ number of packets to send for each time interval. Range:1to any. Default:1. Requires:--pps.
when trying to send packets at very high rates, the time between each packet can be so short that it is impossible to accurately sleep for the required period of time. this option allows you to send multiple packets at a time, thus allowing for longer sleep times which can be more accurately implemented. loophole queen π
--loss=stringβ simulate random percent packet loss (0-100).
set to a percentage between 0 and 100 to simulate packet loss at send. loss is random: each packet is independently dropped with the given probability, not on a fixed pattern (e.g. not every Nth packet), so the actual number dropped will vary slightly run to run. dropped packets are not sent and are not counted as failed. π
examples:
25 will drop approximately one quarter of packets, chosen at random
100 will drop every packet (nothing will be sent)
--unique-ipβ modify IP addresses each loop iteration to generate unique flows. Requires:--loop.
ensure IPv4 and IPv6 packets will be unique for each --loop iteration. this is done in a way that will not alter packet CRC, and therefore will generally not affect performance. this option will significantly increase the flows/sec generated over multiple loop iterations. glow up every single loop β¨π¦
--unique-ip-loops=stringβ number of times to loop before assigning new unique ip. Requires:--unique-ip.
number of --loop iterations before a new unique IP is assigned. default is 1. assumes both --loop and --unique-ip. π’
--netmapβ write packets directly to netmap enabled network adapter. straight to the hardware, no detours π
Like, this next bit is still all about the netmap glow-up β¨ β it snoops around for netmap-capable network drivers on Linux and BSD systems. If it finds one, the network driver gets fully bypassed for the whole execution duration and network buffers get written to directly. That's how you hit full line rates on commodity network adapters, the same kind of rates the fancy commercial network traffic generators brag about. π
Heads up bestie: bypassing the network driver will disrupt other applications connected through the test interface. See INSTALL for more info. π
You can also turn this whole thing on by specifying an interface as 'netmap:<intf>' or 'vale:<intf>'. For example, 'netmap:eth0' specifies netmap over interface eth0. π¦
--nm-delay=numberβ Netmap startup delay. Default:10.- Number of seconds to delay after netmap is loaded. Required to make sure interfaces are fully up before netmap transmit.
- Requires the netmap option. Default is
10seconds.
--no-flow-statsβ Suppress printing and tracking of flow count, rates and expirations.- Suppresses the collection and printing of flow statistics. This option may improve performance when you're not using the
--preload-pcapoption β otherwise its only function is to suppress printing. - The flow feature will track and print statistics of the flows being sent. A flow is loosely defined as a unique combination of a 5-tuple, i.e. source IP, destination IP, source port, destination port and protocol.
- If
--loopis specified, the flows from one iteration to the next will not be unique, unless the packets are altered. Use--unique-iportcpreplay-editto alter packets between iterations. π
- Suppresses the collection and printing of flow statistics. This option may improve performance when you're not using the
--flow-expiry=numberβ Number of inactive seconds before a flow is considered expired. Range:0to any. Default:0. Cannot be combined with:--no-flow-stats.- This option will track and report flow expirations based on the flow idle times. The timestamps within the pcap file are used to determine the expiry, not the actual timestamp of when the packets are replayed. So like, a value of
30suggests that if no traffic is seen on a flow for 30 seconds, any subsequent traffic would be considered a new flow, and thereby will increment the flows and flows per second (fps) statistics. π - This option can be used to optimize flow timeout settings for flow products. Setting the timeout low may lead to flows being dropped when in fact the flow is simply slow to respond. Configuring your flow timeouts too high may increase resources required by your flow product.
- Note that using this option while replaying at higher than original speeds can lead to inflated flows and fps counts. π
- Default is
0(no expiry) and a typical value is30-120seconds.
- This option will track and report flow expirations based on the flow idle times. The timestamps within the pcap file are used to determine the expiry, not the actual timestamp of when the packets are replayed. So like, a value of
-P,--pidβ Print the PID oftcpreplayat startup. π·οΈ--stats=numberβ Print statistics every X seconds, or every loop if'0'. Range:0to any.- Note that timed delays are a "best effort" and long delays between sending packets may cause equally long delays between printing statistics. β³
-W,--suppress-warningsβ suppress printing warning messages. π€«--xdpβ Write packets directly to an AF_XDP enabled network adapter.- This feature will detect AF_XDP capable network drivers on Linux systems that have
'libxdp-dev'and'libbpf-dev'installed. If detected, the network stack is bypassed and packets are sent directly to an eBPF enabled driver directly. This will allow you to achieve full line rates on commodity network adapters, similar to rates achieved by commercial network traffic generators. π₯
- This feature will detect AF_XDP capable network drivers on Linux systems that have
--xdp-queue=numberβ Which of the adapter's queues to bind the AF_XDP socket to. Range:0to4095. Default:0. Requires:--xdp.- An AF_XDP socket is bound to a single hardware queue. Queue
0is used by default; on a multi-queue adapter you may need a different one, since the queue must exist on the adapter and traffic steering may not use queue0. If the queue does not exist the socket cannot be created. π―
- An AF_XDP socket is bound to a single hardware queue. Queue
--xdp-no-fallbackβ Fail instead of falling back when AF_XDP is unavailable. Requires:--xdp.- By default, if an AF_XDP socket cannot be set up on the interface β the driver has no XDP support at all, or the requested queue does not exist β
tcpreplaywarns and replays using its default injection method instead of failing. Use this to make that case a hard error, which is what you want when benchmarking: a silent change of injection method would change what is being measured. π
- By default, if an AF_XDP socket cannot be set up on the interface β the driver has no XDP support at all, or the requested queue does not exist β
--io-uringβ Send packets asynchronously via Linuxio_uring.- This feature is available on Linux systems with a kernel that supports
io_uringand'liburing-dev'installed. Packets are still sent through aPF_PACKETraw socket, but sends are submitted asynchronously through anio_uringsubmission queue, which reduces per-packet syscall overhead and lets the kernel process transmissions whiletcpreplayprepares the next packet. β‘
- This feature is available on Linux systems with a kernel that supports
--rawβ Send packets via aPF_INETraw IP socket instead ofPF_PACKET.- By default,
tcpreplayinjects packets withPF_PACKET, which writes directly to the network driver below the IP stack. This means locally-generated netfilter/iptables rules (and anything else hooked into the normal Linux IP stack) never see the traffic, even when replaying it on the same host that has those rules configured. π± - This option instead sends each packet's IP header and payload through a
PF_INETraw IP (SOCK_RAW) socket bound to the interface given by--intf1/--intf2, so the kernel's normal IP stack β including netfilter/iptables β processes it like any other locally-generated packet. - The trade-off is L2 fidelity: the kernel builds its own Ethernet framing for the outgoing packet, so the source/destination MAC addresses from the capture are not reproduced, and only IPv4 packets are currently supported. This option is Linux-only and requires appropriate privileges to open a raw socket (typically root or
CAP_NET_RAW). π
- By default,
-V,--versionβ Print version information. π-h,--less-helpβ Display less usage information and exit.-H,--helpβ Display usage information and exit. π«Ά--more-helpβ Pass the extended usage information through a pager.--save-opts[=string]β Save the current option state to a config file. πΎ--load-opts=string,--no-load-optsβ Load options from a config file;--no-load-optsdisables this.
π OPTION PRESETS π
Any option that isn't 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 .tcpreplayrc 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) β Successful program execution. π1(EXIT_FAILURE) β The operation failed or the command syntax was not valid. π66(EX_NOINPUT) β A specified configuration file could not be loaded.70(EX_SOFTWARE) βliboptshad an internal operational error. Please report it toautogen-users@lists.sourceforge.net. Thank you. π
π 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 tcpreplay option definitions.
And that's a wrap, bestie!! π¬β¨ This page is from the Tcpreplay Suite, dated 2026-10-25 β go forth and replay responsibly, mwah ππ
π¦ where this page comes from
- epel 9: tcpreplay 4.6.2-1.el9 Β· GPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms