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:
To install tcpreplay on Fedora, simply run:
To install tcpreplay on CentOS or RHEL 5 or earlier, first set up RPMforge repository on your system. Then, install tcpreplay using yum.
To install tcpreplay on CentOS or RHEL 6 or higher, build tcpreplay from the source, and install it manually as follows.
$ sudo yum install libpcap-devel
$ wget http://downloads.sourceforge.net/project/tcpreplay/tcpreplay/3.4.4/tcpreplay-3.4.4.tar.gz
$ tar xvfvz tcpreplay-3.4.4.tar.gz
$ cd tcpreplay-3.4.4
$ ./configure --enable-dynamic-link
$ 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.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!
Latest posts by Dan Nanni (see all)
- How to back up a WordPress website to remote cloud storage from the Linux command line - November 24, 2015
- How to access Dropbox from the command line in Linux - November 22, 2015
- How to send email notifications using Gmail SMTP server on Linux - November 9, 2015