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: 0 to 5. 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 the nanosleep() API
  • select β€” use the select() API
  • ioport β€” write to the i386 IO Port 0x80
  • gtod [default] β€” use a gettimeofday() 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 via tcpdump to STDOUT. yes she's chatty and we love her for it πŸ’¬
  • -A, --decode=string β€” arguments passed to the tcpdump decoder. 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 a tcpprep cache 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: 0 to any. Default: 1. round and round we go πŸ”
  • --loopdelay-ms=number β€” delay between loops in milliseconds. Range: 0 to any. Default: 0. Requires: --loop. Cannot be combined with: --loopdelay-ns.
  • --loopdelay-ns=number β€” delay between loops in nanoseconds. Range: 0 to 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: 1 to 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: 1 to 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: 1 to 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 10 seconds.
  • --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-pcap option β€” 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 --loop is specified, the flows from one iteration to the next will not be unique, unless the packets are altered. Use --unique-ip or tcpreplay-edit to alter packets between iterations. πŸŒ€
  • --flow-expiry=number β€” Number of inactive seconds before a flow is considered expired. Range: 0 to 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 30 suggests 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 is 30-120 seconds.
  • -P, --pid β€” Print the PID of tcpreplay at startup. 🏷️
  • --stats=number β€” Print statistics every X seconds, or every loop if '0'. Range: 0 to 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. πŸ”₯
  • --xdp-queue=number β€” Which of the adapter's queues to bind the AF_XDP socket to. Range: 0 to 4095. Default: 0. Requires: --xdp.
    • An AF_XDP socket is bound to a single hardware queue. Queue 0 is 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 queue 0. If the queue does not exist the socket cannot be created. 🎯
  • --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 β€” tcpreplay warns 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. πŸ“
  • --io-uring β€” Send packets asynchronously via Linux io_uring.
    • This feature is available on Linux systems with a kernel that supports io_uring and 'liburing-dev' installed. Packets are still sent through a PF_PACKET raw socket, but sends are submitted asynchronously through an io_uring submission queue, which reduces per-packet syscall overhead and lets the kernel process transmissions while tcpreplay prepares the next packet. ⚑
  • --raw β€” Send packets via a PF_INET raw IP socket instead of PF_PACKET.
    • By default, tcpreplay injects packets with PF_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_INET raw 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). πŸ”
  • -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-opts disables 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) β€” libopts had an internal operational error. Please report it to autogen-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 Β© 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