Open-source project
appneta/tcpreplay avatar
appneta/tcpreplay

Tcpreplay 4.6.1 for Packet Capture Editing and Network Replay

Edit and replay captured network traffic at arbitrary speeds — a suite of pcap tools for *NIX and Windows.

1,353 stars297 forksCGPL-3.0

At a glance

What is it?
Tcpreplay is a C-based suite for editing pcap traffic and replaying it onto test networks at controlled speeds. It fits firewall, IDS, IPS, NetFlow and appliance testing, but requires appropriate capture files, interfaces and operating-system privileges.
Who is it for?
Tcpreplay is appropriate for network engineers and testing laboratories that already have representative pcap files and controlled interfaces. It is less suitable for users who need an application-level traffic generator, because plain tcpreplay normally stays at Layer 2.
Can I use it commercially?
Yes, with conditions. GPL-3.0 is a copyleft licence: if you distribute software that includes it, you must release that software's source code under the same licence. Running it internally without distributing it does not trigger that obligation.
Is it still maintained?
Yes. The repository last received commits 69 days ago.
What is it written in?
Mainly C, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.

Editorial analysis

Tcpreplay's Packet Replay Problem and Test Audience

Tcpreplay addresses a specific network testing problem: a captured packet trace is available, but the team needs to put that traffic back onto a network under controlled conditions. The suite is aimed at engineers working with firewalls, intrusion detection systems, intrusion prevention systems, routers, switches, NetFlow appliances and other network infrastructure. It can replay traffic from a trickle to full wire rate, according to the README. That range matters because a replay tool used for functional checks may need slow, observable packets, while a performance test may require sustained high-rate injection. Tcpreplay also supports single-NIC and dual-NIC modes, which correspond to tests involving sniffing devices and inline devices.

The suite is not limited to putting frames on a wire. It classifies traffic as client or server traffic, and it can rewrite Layer 2, Layer 3 and Layer 4 headers. Since version 4.0, its documentation also positions it for IP Flow and NetFlow appliance testing, including playback timing, results reporting, Flows Per Second statistics and flow-expiry analysis. The README describes throughput of up to hundreds of thousands of flows per second depending on flow sizes in the pcap file. That statement describes the project target, not a guaranteed result for every capture or interface.

This makes Tcpreplay more relevant to a laboratory or device-validation workflow than to ordinary application debugging. A team can use a recorded trace as repeatable input, alter selected packet fields, and observe how the device handles timing, classification, state and expiry. The repository lists enterprises, universities, labs and open source projects as users, but it does not provide a detailed customer list or a formal support matrix in the README.

The Tool Suite and Packet Data Flow

The repository organizes Tcpreplay as several cooperating utilities rather than one binary. The `tcpreplay` command replays pcap files at arbitrary speeds and can randomize IP addresses. The `tcpreplay-edit` variant performs packet editing while replaying. Before playback, `tcpprep` can classify packets as client or server packets and write a cache file consumed by `tcpreplay` and `tcprewrite`. `tcprewrite` edits TCP/IP and Layer 2 headers in a pcap file, while `tcpbridge` uses the same rewriting logic to bridge two network segments. `tcpcapinfo` acts as a pcap decoder and debugging tool.

The basic flow is therefore capture, preparation, optional rewriting, and network injection. A capture produced by tools such as `tcpdump` or Wireshark can enter the workflow. `tcpprep` supplies classification data, `tcprewrite` can alter stored packet headers, and `tcpreplay` sends the resulting traffic through an interface. `tcpcapinfo` is useful when the capture itself needs inspection or debugging before it reaches the replay stage. The README does not document a single mandatory command pipeline, so the exact sequence depends on whether classification, file rewriting or on-the-fly editing is required.

There is a separate `tcpliveplay` utility for replaying a captured TCP session in a way intended to obtain a response from a remote server. The distinction is important. Plain `tcpreplay` normally remains at Layer 2, so it does not by itself reproduce a complete application-level TCP conversation. Tcpreplay 4.6 also adds a static `libtcpreplay` C library, allowing another program to embed the replay engine. The documented fast-path choices are netmap, AF_XDP and io_uring. The README says AF_XDP and io_uring require less setup than netmap and no patched drivers, which may simplify deployment on supported Linux systems.

Installing Tcpreplay 4.6.1 with CMake

For a release tarball, the README gives a shorter Autotools installation route. It ships generated CLI parsers and man pages, so the documented prerequisites are a C compiler and `libpcap`. The following commands are taken directly from the release instructions:

bash
tar xf tcpreplay-*.tar.xz && cd tcpreplay-*
./configure && make && sudo make install

The first command extracts the downloaded archive and changes into its directory. The remaining commands configure, compile and install the suite. The `sudo` step is part of the documented installation procedure, so installation may require administrator privileges or an alternative system package layout.

For a git checkout, the project requires `python3` and `asciidoctor` to generate CLI option parsers and man pages from the `*_opts.def` files. CMake 3.16 or newer is the recommended build system as of version 4.6. The documented build commands are:

bash
cmake -B build
cmake --build build
sudo cmake --install build

`cmake -B build` configures the build directory. `cmake --build build` compiles the project, and the final command installs the built files. The README also provides a debug configuration example using `ENABLE_DEBUG`, which should be selected only when that option is relevant:

bash
cmake -B build -DENABLE_DEBUG=ON

A project using CMake for packaging should target it rather than relying on Autotools, because the README says Autotools remains available for release tarballs but is expected to eventually be retired. A source build also adds dependency and generation work that is absent from the release tarball route.

A First Replay Workflow and Its Operating-System Constraints

The README does not provide a complete command example for selecting an interface, setting a replay speed or choosing a prepared cache file. It instead points to the full documentation site, the tool pages and the man pages. That omission matters for a first-use tutorial: installing the binaries does not tell a new user which interface syntax applies on their system or whether a pcap needs classification before it is sent. The safe first step is therefore to use the installed `tcpreplay` documentation and confirm the capture and interface before injecting traffic.

The documentation states that Tcpreplay supports UNIX and Windows under Cygwin. Packet injection can depend on the network device, operating-system permissions and the selected performance backend. Netmap, AF_XDP and io_uring are separate supported paths, not interchangeable labels for the same setup. A tester should not assume that a build with one backend behaves identically to a build using another. The README also describes raw IP, or Layer 3, replay support for interfaces such as WireGuard and `tun` devices. That feature changes the interface requirements and packet treatment, so it should be selected only when the target setup actually uses a raw IP interface.

The repository contains a test directory, example files and build-system hooks, but the README does not document a small, self-contained sample capture that can be replayed safely on a user's network. It would be wrong to invent a file name or interface name. Before the first real replay, inspect the available capture with `tcpcapinfo`, decide whether `tcpprep` classification is needed, and use `tcprewrite` if the test requires changed headers. Then consult the `tcpreplay` man page for the exact interface and timing syntax supported by the installed build.

Where Tcpreplay Is the Wrong Tool

Tcpreplay has several boundaries that can make it the wrong choice. Plain `tcpreplay` normally stays at Layer 2, so a test that requires a remote server to generate a meaningful application response may need `tcpliveplay` instead. Tcpreplay does not turn every pcap into a complete modern application workload. The captured file must contain the frames, timing and packet relationships required by the device under test. A sparse or poorly classified capture can produce an uninformative replay regardless of the tool's available options.

It is also a network packet replay suite, not a general-purpose endpoint simulator. The README does not claim that Tcpreplay synthesizes arbitrary TCP sessions, models application behavior or provides protocol fuzzing. `tcpbridge` can connect two network segments using rewriting logic, but that is distinct from building a complete test topology. The operator remains responsible for placing interfaces and addresses in a lab that will not accidentally expose production systems to replayed traffic.

The performance backends introduce another operational constraint. The README names netmap, AF_XDP and io_uring as fast-path injection options, but it does not claim universal support across every NIC, driver and operating system. A failed replay can therefore result from interface configuration or packet-injection permissions rather than from the pcap itself. The documentation does not define a rollback procedure, capture cleanup procedure or guaranteed behavior when an interface cannot transmit. Those cases should be treated as deployment questions that require the platform-specific documentation and a controlled test environment.

Alternative Approaches and Maintenance Boundaries

A real alternative is to use a live network workload generator or an application-level traffic tool instead of replaying a stored pcap. Tcpreplay's defining approach is injection from captured packet files, with optional classification and header rewriting. A live generator creates traffic as the test runs, which can be useful when the test needs changing endpoints or dynamic behavior. The trade-off is that it does not provide the same direct relationship to a known capture. Tcpreplay is therefore better when repeatability and a recorded trace matter; a live generator is conceptually better when the traffic must change in response to the system under test.

Another alternative is to use `tcpliveplay` within Tcpreplay when the captured TCP session needs a remote server response. That is not a separate project, but it is a different operating mode from ordinary `tcpreplay`. The choice depends on whether the test stops at packet transmission and device classification, or whether it needs the network stack and application path to continue.

Tcpreplay is licensed under GPLv3. The README identifies the suite as GPLv3 licensed and points to the repository license file. That has implications for distributing modified binaries or incorporating the code into another project, but this review does not provide legal advice. Version 4.6 adds CMake as the primary build route, a static `libtcpreplay` library and faster injection paths. The README also says the suite targets hundreds of thousands of flows per second depending on flow sizes. Actual maintenance and upgrade cost still includes checking native dependencies, backend support and compatibility with the capture and interface used by the lab. The repository is not archived, and its last push was on 2026-08-15. Releases v4.6.1, v4.6.0 and v4.5.5 were published on August 15, July 28 and July 24, 2026, respectively.

Editorial conclusion

Tcpreplay is appropriate for network engineers and testing laboratories that already have representative pcap files and controlled interfaces. It is less suitable for users who need an application-level traffic generator, because plain tcpreplay normally stays at Layer 2. Verify first that the capture contains the traffic you need, that the target interface and addressing match the test, and whether your platform requires raw packet access. For version 4.6.1, the repository records its last push on 2026-08-15, so the project is not archived and has recent activity, but upgrade planning should still account for native build dependencies and platform-specific packet injection requirements.

Frequently asked questions

What is Tcpreplay used for?

Tcpreplay is a GPLv3 suite for editing and replaying captured network traffic on UNIX systems and Windows under Cygwin. It supports replay at arbitrary speeds and can target switches, routers, firewalls, NIDS, IPS systems and flow appliances.

How do I install Tcpreplay from a release tarball?

Extract the release archive, run `./configure`, compile with `make`, and install with `sudo make install`. The release tarball ships generated parsers and man pages, and the README lists a C compiler and `libpcap` as the required basic dependencies.

What is the difference between Tcpreplay and tcpliveplay?

Plain `tcpreplay` normally stays at Layer 2 and injects captured packets. `tcpliveplay` is intended to replay a captured TCP session on a live network so that a remote server can respond, which makes it suitable for testing further into the network and application stack.

Official sources

  1. appneta/tcpreplay on GitHub
  2. License: GPL-3.0
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/appneta-tcpreplay.svg)](https://hysenlabs.com/projects/appneta-tcpreplay)

Was this useful?