How to install tcpreplay on Linux

Tcpreplay is a suite of command-line utilities that are used to "replay" previously captured packet dumps in a real network. In order to use tcpreplay, you first need to capture live network traffic using packet capture tools such as tcpdump, rewrite TCP/IP packet headers of the captured packets appropriately (usually MAC and IP addresses), and then re-inject the packets on to any arbitrary network under consideration.

tcpreplay is useful when you are testing network devices and middleware, such as routers, switches, firewalls and intrusion detection/prevention systems, because it allows you to test the devices under a controlled environment using reproducible scenarios.

If you would like to install tcpreplay on Linux, you can refer to the following distro-specific instructions.

To install tcpreplay on Ubuntu or Debian, run the following:

$ sudo apt-get install tcpreplay

To install tcpreplay on Fedora, simply run:

$ sudo yum install tcpreplay

To install tcpreplay on CentOS or RHEL 5 or earlier, first set up RPMforge repository on your system. Then, install tcpreplay using yum.

$ sudo yum install tcpreplay

To install tcpreplay on CentOS or RHEL 6 or higher, build tcpreplay from the source, and install it manually as follows.

$ sudo yum groupinstall "Development Tools"
$ sudo yum install libpcap-devel
$ wget
$ tar xvfvz tcpreplay-3.4.4.tar.gz
$ cd tcpreplay-3.4.4
$ ./configure --enable-dynamic-link
$ make
$ sudo make install

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.

One thought on “How to install tcpreplay on Linux

Leave a comment

Your email address will not be published. Required fields are marked *