### Configure, Build, and Install Tcpreplay Source: http://tcpreplay.appneta.com/wiki/installation.html Standard commands to configure the build, compile the source code, and install Tcpreplay on a Unix-like system after prerequisites are met. ```bash ./configure make sudo make install ``` -------------------------------- ### Run Tcpreplay Installation Tests Source: http://tcpreplay.appneta.com/wiki/installation.html Execute the test suite to verify that the Tcpreplay installation is functional and all components are working correctly. ```bash sudo make test ``` -------------------------------- ### Install Build Prerequisites on Debian/Ubuntu Source: http://tcpreplay.appneta.com/wiki/installation.html Install essential build tools and the libpcap development library required for compiling Tcpreplay on Debian-based systems. ```bash sudo apt-get install build-essential libpcap-dev ``` -------------------------------- ### tcpliveplay Example with Specific Source Port Source: http://tcpreplay.appneta.com/wiki/tcpliveplay Example of running tcpliveplay with a specified device, pcap file, destination IP and MAC, and a specific source port. ```bash # tcpliveplay eth0 sample2.pcap 192.168.1.5 52:51:01:12:38:02 52178 ``` -------------------------------- ### tcpliveplay Example with Random Source Port Source: http://tcpreplay.appneta.com/wiki/tcpliveplay Example of running tcpliveplay with a specified device, pcap file, destination IP and MAC, and a random source port. ```bash # tcpliveplay eth0 sample1.pcap 192.168.1.5 52:51:01:12:38:02 random ``` -------------------------------- ### Install netmap Kernel Module and Driver Source: http://tcpreplay.appneta.com/wiki/howto.html This script temporarily installs the netmap_lin kernel module and the netmap-enabled ixgbe driver. It assumes the netmap and ixgbe modules are compiled and available. ```bash #!/bin/sh ifdown eth6 ifdown eth7 rmmod ixgbe rmmod netmap_lin insmod ./netmap_lin.ko mknod /dev/netmap c 10 59 modprobe mdio insmod ./ixgbe.ko ifup eth6 ifup eth7 ``` -------------------------------- ### Configure Tcpreplay with netmap Support Source: http://tcpreplay.appneta.com/wiki/howto.html Run the configure script to check for netmap support. This step verifies if netmap is installed and accessible in the default location. ```bash ./configure ... ########################################################################## TCPREPLAY Suite Configuration Results (4.0.0) ########################################################################## libpcap: /usr (>= 0.9.6) libdnet: no () autogen: /usr/local/bin/autogen (5.16.2) Use libopts tearoff: yes 64bit counter support: yes tcpdump binary path: /usr/sbin/tcpdump fragroute support: no tcpbridge support: yes tcpliveplay support: yes Supported Packet Injection Methods (*): Linux TX_RING: no Linux PF_PACKET: yes BSD BPF: no libdnet: no pcap_inject: yes pcap_sendpacket: yes ** Linux/BSD netmap: yes /usr/src/netmap-release ``` -------------------------------- ### Reduce Flows Per Second with Tcpreplay Source: http://tcpreplay.appneta.com/wiki/howto.html Use the --mbps option to limit the traffic rate. This example sets the rate to approximately 50Kfps. ```bash tcpreplay -i eth7 -K --mbps 3500 --loop 50 --unique-ip bigFlows.pcap File Cache is enabled Actual: 39580750 packets (17770889200 bytes) sent in 40.06 seconds. Rated: 437499777.1 Bps, 3499.99 Mbps, 974434.59 pps Flows: 2034300 flows, 50082.23 fps, 39558950 flow packets, 21800 non-flow Statistics for network device: eth7 Attempted packets: 39580750 Successful packets: 39580750 Failed packets: 0 Truncated packets: 0 Retried packets (ENOBUFS): 0 Retried packets (EAGAIN): 0 ``` -------------------------------- ### Tcpreplay 10GigE Wire-Speed Replay Example Source: http://tcpreplay.appneta.com/tcpreplay/news/2014/01/05/4-0-0.html Illustrates achieving near 10GigE wire speed with Tcpreplay using the netmap driver and unique IP generation. This configuration is suitable for high-throughput packet replay scenarios. ```bash # tcpreplay --preload-pcap -i eth0 --loop 500 -t --unique-ip --netmap smallFlows.pcap Switching network driver for eth0 to netmap bypass mode... done! File Cache is enabled Actual: 7130500 packets (4608265500 bytes) sent in 3.08 seconds. Rated: 1197981408.4 Bps, 9583.85 Mbps, 1853670.63 pps Flows: 604500 flows, 157148.01 fps, 7121500 flow packets, 9000 non-flow Statistics for network device: eth0 Attempted packets: 7130500 Successful packets: 7130500 Failed packets: 0 Truncated packets: 0 Retried packets (ENOBUFS): 0 Retried packets (EAGAIN): 0 Switching network driver for eth0 to normal mode... done! ``` -------------------------------- ### Example iptables Rule Source: http://tcpreplay.appneta.com/wiki/tcpliveplay An example of suppressing kernel RST flags using iptables with specific IP addresses and a destination port. ```bash # sudo iptables -A OUTPUT -p tcp --tcp-flags RST RST -s 10.0.2.15 -d 192.168.1.10 --dport 80 -j DROP ``` -------------------------------- ### Run Tcpliveplay Example Source: http://tcpreplay.appneta.com/wiki/tcpliveplay Demonstrates how to use tcpliveplay to replay a pcap file. Requires root privileges. Specify the network interface, pcap file, target IP, target MAC address, and optionally a mode (e.g., 'random'). ```bash yhsiam:~$ sudo tcpliveplay eth0 sample1.pcap 192.168.1.5 52:51:01:12:38:02 random [sudo] password for yhsiam: new source port:: 61487 Random Local SEQ: 859480898 Packets Scheduled 11 Sending Local Packet............... [1] Receiving Packets from remote host... Received Remote Packet............... [2] Remote Pakcet Expectation met. Proceeding in replay.... Sending Local Packet............... [3] Sending Local Packet............... [4] Receiving Packets from remote host... >Received a Remote Packet >>Checking Expectations Received Remote Packet............... [5] Remote Packet Expectation met. Proceeding in replay.... Receiving Packets from remote host... >Received a Remote Packet >>Checking Expectations Received Remote Packet............... [6] Remote Packet Expectation met. Proceeding in replay.... Sending Local Packet............... [7] Sending Local Packet............... [8] Receiving Packets from remote host... >Received a Remote Packet >>Checking Expectations Received Remote Packet............... [9] Remote Packet Expectation met. Proceeding in replay.... Receiving Packets from remote host... >Received a Remote Packet >>Checking Expectations Received Remote Packet............... [10] Remote Packet Expectation met. Proceeding in replay.... Sending Local Packet............... [11] ---------------------------------------------------------------------------- - CONGRATS!!! You have successfully Replayed your pcap file ' sample1.pcap' ---------------------------------------------------------------------------- ----------------TCP Live Play Summary---------------- - Packets Scheduled to be Sent & Received: 11 - Actual Packets Sent & Received: 11 - Total Local Packet Re-Transmissions due to packet - loss and/or differing payload size than expected: 5 - Thank you for Playing, Play again! ---------------------------------------------------------- ``` -------------------------------- ### Run tcpreplay at near wire speed Source: http://tcpreplay.appneta.com/wiki/faq.html Use the --preload-pcap option for better performance. This example sends packets at near wire speed. ```bash # tcpreplay --preload-pcap -i eth0 --loop 500 -t --unique-ip --netmap smallFlows.pcap Switching network driver for eth0 to netmap bypass mode... done! File Cache is enabled Actual: 7130500 packets (4608265500 bytes) sent in 3.08 seconds. Rated: 1197981408.4 Bps, 9583.85 Mbps, 1853670.63 pps Flows: 604500 flows, 157148.01 fps, 7121500 flow packets, 9000 non-flow Statistics for network device: eth0 Attempted packets: 7130500 Successful packets: 7130500 Failed packets: 0 Truncated packets: 0 Retried packets (ENOBUFS): 0 Retried packets (EAGAIN): 0 Switching network driver for eth0 to normal mode... done! ``` -------------------------------- ### tcpcapinfo Example Output Source: http://tcpreplay.appneta.com/wiki/tcpcapinfo This example shows the output of tcpcapinfo when analyzing a pcap file, including file header details and per-packet information such as original length, captured length, timestamp, and checksum. ```bash $ tcpcapinfo smallFlows.pcap | head -n 30 file size = 9444731 bytes magic = 0xa1b2c3d4 (tcpdump) (little-endian) version = 2.4 thiszone = 0x00000000 sigfigs = 0x00000000 snaplen = 65535 linktype = 0x00000001 Packet OrigLen Caplen Timestamp Csum Note 1 997 997 4d3f1be6.76439 a413bd OK 2 440 440 4d3f1be6.7d8ca 504113 OK 3 66 66 4d3f1be6.acec4 8db5c OK 4 54 54 4d3f1be6.ae468 9c35b OK 5 66 66 4d3f1be6.b1812 8db5c OK 6 54 54 4d3f1be6.b1841 8e75c OK 7 998 998 4d3f1be6.b19a3 a036c1 OK 8 54 54 4d3f1be6.b677e 8e75c OK 9 60 60 4d3f1be6.b6bc3 7e75d OK 10 541 541 4d3f1be6.b9cf8 65fffd OK 11 54 54 4d3f1be6.b9d50 7e75d OK 12 60 60 4d3f1be6.bb339 7e75d OK 13 66 66 4d3f1be6.e2980 9ae5b OK 14 66 66 4d3f1be6.e7223 bae59 OK 15 54 54 4d3f1be6.e727c aba5a OK 16 231 231 4d3f1be6.e7577 200944 OK 17 60 60 4d3f1be6.ebe8b aba5a OK 18 1484 1484 4d3f1be6.ec419 e92376 OK 19 345 345 4d3f1be6.ec752 3b9728 OK 20 54 54 4d3f1be6.ec76f 9ba5b OK 21 329 329 4d3f1be6.ed5a1 48a71b OK 22 280 280 4d3f1be6.f27e8 3ad829 OK ``` -------------------------------- ### Replay at Specific Speed (Mbps) Source: http://tcpreplay.appneta.com/wiki/tcpreplay.html Play back a pcap file at a specific megabits per second rate. This example also shows the resulting statistics. ```bash # tcpreplay -i eth0 --mbps=510.5 smallFlows.pcap Actual: 14261 packets (9216531 bytes) sent in 0.144495 seconds. Rated: 63784428.5 Bps, 510.27 Mbps, 98695.45 pps Flows: 1209 flows, 8367.07 fps, 14243 flow packets, 18 non-flow Statistics for network device: eth0 Attempted packets: 14261 Successful packets: 14261 Failed packets: 0 Truncated packets: 0 Retried packets (ENOBUFS): 0 Retried packets (EAGAIN): 0 ``` -------------------------------- ### Tcpreplay 10GigE Wire-Speed Replay with Netmap Source: http://tcpreplay.appneta.com/tcpreplay/news/2013/12/20/4-0-beta1.html Illustrates achieving near 10GigE wire speed replay rates using the netmap network driver and the --unique-ip option for flow generation. This example is suitable for high-throughput packet replay scenarios. ```bash # tcpreplay --preload-pcap -i eth0 --loop 500 -t --unique-ip --netmap smallFlows.pcap Switching network driver for eth0 to netmap bypass mode... done! File Cache is enabled Actual: 7130500 packets (4608265500 bytes) sent in 3.08 seconds. Rated: 1197981408.4 Bps, 9583.85 Mbps, 1853670.63 pps Flows: 604500 flows, 157148.01 fps, 7121500 flow packets, 9000 non-flow Statistics for network device: eth0 Attempted packets: 7130500 Successful packets: 7130500 Failed packets: 0 Truncated packets: 0 Retried packets (ENOBUFS): 0 Retried packets (EAGAIN): 0 Switching network driver for eth0 to normal mode... done! ``` -------------------------------- ### Send Packets with Tcpreplay (Tiny Packets) Source: http://tcpreplay.appneta.com/wiki/faq.html Demonstrates sending a larger number of packets with tcpreplay, focusing on smaller packet sizes. This example highlights how packet size impacts packets per second (pps) and flows per second (fps) rates. ```bash # tcpreplay -i eth7 -K --loop 50000 -M 9000 --unique-ip tiny-packets.pcap File Cache is enabled Actual: 550000 packets (42600000 bytes) sent in 0.259064 seconds. Rated: 164438131.1 Bps, 1315.50 Mbps, 2123027.51 pps Flows: 100000 flows, 386005.00 fps, 300000 flow packets, 250000 non-flow Statistics for network device: eth7 Attempted packets: 550000 Successful packets: 550000 Failed packets: 0 Truncated packets: 0 Retried packets (ENOBUFS): 0 Retried packets (EAGAIN): 0 ``` -------------------------------- ### Add AppNeta PPA for Tcpreplay on Ubuntu Source: http://tcpreplay.appneta.com/tcpreplay/news/2017/04/19/4-2-3.html Use these commands to add the AppNeta PPA and update your package list to install the latest Tcpreplay version on Ubuntu. ```bash sudo add-apt-repository ppa:appneta/ppa sudo apt-get update ``` -------------------------------- ### Tcpreplay 9500Mbps Speed Limit Example Source: http://tcpreplay.appneta.com/tcpreplay/news/2014/01/05/4-0-0.html Demonstrates limiting Tcpreplay's replay rate to a specific Mbps value using the -M option, while still utilizing netmap for performance. This is useful for testing network devices under controlled bandwidth conditions. ```bash # tcpreplay --preload-pcap -i eth0 -l 500 -M 9500 --unique-ip --netmap smallFlows.pcap Switching network driver for eth0 to netmap bypass mode... done! File Cache is enabled Actual: 7130500 packets (4608265500 bytes) sent in 3.08 seconds. Rated: 1187498663.2 Bps, 9499.98 Mbps, 1837450.38 pps Flows: 604500 flows, 155772.91 fps, 7121500 flow packets, 9000 non-flow Statistics for network device: eth0 Attempted packets: 7130500 Successful packets: 7130500 Failed packets: 0 Truncated packets: 0 Retried packets (ENOBUFS): 0 Retried packets (EAGAIN): 0 Switching network driver for eth0 to normal mode... done! ``` -------------------------------- ### Configure Tcpreplay with Custom netmap Path Source: http://tcpreplay.appneta.com/wiki/howto.html Configure Tcpreplay, specifying a custom path for the netmap source directory. This is necessary if netmap is not installed in the default location. ```bash ./configure --with-netmap=/home/fklassen/git/netmap/ ... ########################################################################## TCPREPLAY Suite Configuration Results (4.0.0) ########################################################################## libpcap: /usr (>= 0.9.6) libdnet: no () autogen: /usr/local/bin/autogen (5.16.2) Use libopts tearoff: yes 64bit counter support: yes tcpdump binary path: /usr/sbin/tcpdump fragroute support: no tcpbridge support: yes tcpliveplay support: yes Supported Packet Injection Methods (*): Linux TX_RING: no Linux PF_PACKET: yes BSD BPF: no libdnet: no pcap_inject: yes pcap_sendpacket: yes ** Linux/BSD netmap: yes /home/fklassen/git/netmap/ ``` -------------------------------- ### Send Packets with Tcpreplay (Small Flows) Source: http://tcpreplay.appneta.com/wiki/faq.html Example of sending packets from a pcap file with tcpreplay, utilizing file caching and specific loop and rate limits. Observe the output statistics for packets sent and network throughput. ```bash # tcpreplay -i eth7 -K --loop 5000 -M 9000 --unique-ip smallFlows.pcap File Cache is enabled Actual: 71305000 packets (46082655000 bytes) sent in 40.09 seconds. Rated: 1124993518.4 Bps, 8999.94 Mbps, 1740734.40 pps Flows: 6045000 flows, 147573.65 fps, 71215000 flow packets, 90000 non-flow Statistics for network device: eth7 Attempted packets: 71305000 Successful packets: 71305000 Failed packets: 0 Truncated packets: 0 Retried packets (ENOBUFS): 0 Retried packets (EAGAIN): 0 ``` -------------------------------- ### Start nProbe with Custom Fields Source: http://tcpreplay.appneta.com/wiki/howto.html Initiates nProbe to capture traffic on a specified interface (eth7) and configure custom fields for flow data. Ensure the specified interface exists and nProbe has necessary permissions. ```bash # nprobe -T "%IPV4_SRC_ADDR %IPV4_DST_ADDR %IPV4_NEXT_HOP %INPUT_SNMP \n%OUTPUT_SNMP %IN_PKTS %IN_BYTES %FIRST_SWITCHED %LAST_SWITCHED %L4_SRC_PORT \n%L4_DST_PORT %TCP_FLAGS %PROTOCOL %SRC_TOS %SRC_AS %DST_AS %IPV4_SRC_MASK \n%IPV4_DST_MASK" -i eth7 ``` -------------------------------- ### Achieve high flows per second with tiny packets Source: http://tcpreplay.appneta.com/wiki/faq.html When replaying pcap files with tiny packets, focus on flows per second (fps). This example demonstrates achieving a high fps rate. ```bash # tcpreplay --preload-pcap -i eth0 -l50000 -t --unique-ip --netmap tiny-packets.pcap Switching network driver for eth0 to netmap bypass mode... done! File Cache is enabled Actual: 550000 packets (42600000 bytes) sent in 0.054122 seconds. Rated: 787110601.9 Bps, 6296.88 Mbps, 10162226.08 pps Flows: 100000 flows, 1847677.46 fps, 300000 flow packets, 250000 non-flow Statistics for network device: eth0 Attempted packets: 550000 Successful packets: 550000 Failed packets: 0 Truncated packets: 0 Retried packets (ENOBUFS): 0 Retried packets (EAGAIN): 0 Switching network driver for eth0 to normal mode... done! ``` -------------------------------- ### Run Tcpreplay with netmap for High Flow Rate Source: http://tcpreplay.appneta.com/wiki/howto.html Execute Tcpreplay using the --netmap option to leverage netmap bypass mode for increased packet sending rates. This example uses a pcap file with larger flows. ```bash tcpreplay -i eth7 -tK --loop 50 --unique-ip --netmap bigFlows.pcap Switching network driver for eth7 to netmap bypass mode... done! File Cache is enabled Actual: 39580750 packets (17770889200 bytes) sent in 15.00 seconds. Rated: 1182219090.4 Bps, 9457.75 Mbps, 2633133.19 pps Flows: 2034300 flows, 135333.03 fps, 39558950 flow packets, 21800 non-flow Statistics for network device: eth7 Attempted packets: 39580750 Successful packets: 39580750 Failed packets: 0 Truncated packets: 0 Retried packets (ENOBUFS): 0 Retried packets (EAGAIN): 0 Switching network driver for eth7 to normal mode... done! ``` -------------------------------- ### Directional IP Mapping with Pseudo-NAT Source: http://tcpreplay.appneta.com/wiki/tcprewrite.html Use multiple --pnat flags to apply different IP remapping rules based on packet direction. This example remaps 10.0.0.0/8 to different subnets for client and server traffic. ```bash $ tcprewrite --pnat=10.0.0.0/8:192.168.0.0/24 --pnat=10.0.0.0/8:192.168.1.0/24 --cachefile=input.cache --infile=input.pcap --outfile=output.pcap --skipbroadcast ``` -------------------------------- ### Tcpreplay High FPS with Tiny Packets Example Source: http://tcpreplay.appneta.com/tcpreplay/news/2014/01/05/4-0-0.html Shows how Tcpreplay achieves high flows per second (fps) when replaying pcap files containing tiny packets, even if the overall Mbps rate is lower. This highlights the importance of fps for certain traffic types. ```bash # tcpreplay --preload-pcap -i eth0 -l50000 -t --unique-ip --netmap tiny-packets.pcap Switching network driver for eth0 to netmap bypass mode... done! File Cache is enabled Actual: 550000 packets (42600000 bytes) sent in 0.054122 seconds. Rated: 787110601.9 Bps, 6296.88 Mbps, 10162226.08 pps Flows: 100000 flows, 1847677.46 fps, 300000 flow packets, 250000 non-flow Statistics for network device: eth0 Attempted packets: 550000 Successful packets: 550000 Failed packets: 0 Truncated packets: 0 Retried packets (ENOBUFS): 0 Retried packets (EAGAIN): 0 Switching network driver for eth0 to normal mode... done! ``` -------------------------------- ### Fix tcpedit_stub.def: Command not found Error Source: http://tcpreplay.appneta.com/wiki/faq.html This error occurs when building from GitHub without GNU Autogen installed. Install autogen or use a source tarball. ```bash Making all in tcpedit make[2]: Entering directory `/home/acferen/tcpreplay-trunk/src/tcpedit' tcpedit_stub.def make[2]: tcpedit_stub.def: Command not found make[2]: *** [tcpedit_stub.h] Error 127 make[2]: Leaving directory `/home/acferen/tcpreplay-trunk/src/tcpedit' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/acferen/tcpreplay-trunk/src' make: *** [all] Error 2 ``` -------------------------------- ### Clone Tcpreplay Repository Source: http://tcpreplay.appneta.com/wiki/contributions.html Use this command to get a local copy of the Tcpreplay source code repository from GitHub. ```bash git clone git@github.com:appneta/tcpreplay.git ``` -------------------------------- ### Limit tcpreplay speed with -M option Source: http://tcpreplay.appneta.com/wiki/faq.html Use the -M option to limit the replay speed in Mbps. This example limits the speed to 9500 Mbps. ```bash # tcpreplay --preload-pcap -i eth0 -l 500 -M 9500 --unique-ip --netmap smallFlows.pcap Switching network driver for eth0 to netmap bypass mode... done! File Cache is enabled Actual: 7130500 packets (4608265500 bytes) sent in 3.08 seconds. Rated: 1187498663.2 Bps, 9499.98 Mbps, 1837450.38 pps Flows: 604500 flows, 155772.91 fps, 7121500 flow packets, 9000 non-flow Statistics for network device: eth0 Attempted packets: 7130500 Successful packets: 7130500 Failed packets: 0 Truncated packets: 0 Retried packets (ENOBUFS): 0 Retried packets (EAGAIN): 0 Switching network driver for eth0 to normal mode... done! ``` -------------------------------- ### Use Netmap Drivers for Faster Tcpreplay Source: http://tcpreplay.appneta.com/wiki/faq.html When Tcpreplay doesn't send traffic as fast as expected, try using netmap drivers with the `--netmap` option for improved performance, especially with small packets. ```bash tcpreplay --netmap ``` -------------------------------- ### Enable dynamic linking on Fedora/RedHat Source: http://tcpreplay.appneta.com/wiki/faq.html Newer Fedora/Red Hat versions only provide dynamic libraries. Use the --enable-dynamic-link flag with configure to link against them. ```bash --enable-dynamic-link ``` -------------------------------- ### Fix Autogen/libopts compilation issues Source: http://tcpreplay.appneta.com/wiki/faq.html Problems can arise from version mismatches between your installed Autogen/libopts and the version used by Tcpreplay. Enable local libopts during configuration to resolve this. ```bash make[3]: Entering directory `/root/services_from_source/tcpreplay-3.0.beta11/src/tcpedit' if gcc -DHAVE_CONFIG_H -I. -I. -I../../src -I.. -I../common -I../.. -g -O2 -Wall -O2 -funroll-loops -std=gnu99 -MT tcpedit.o -MD -MP -MF ".deps/tcpedit.Tpo" -c -o tcpedit.o tcpedit.c; \ then mv -f ".deps/tcpedit.Tpo" ".deps/tcpedit.Po"; else rm -f ".deps/tcpedit.Tpo"; exit 1; fi In file included from tcpedit.c:46: tcpedit_stub.h:18:30: autoopts/options.h: No such file or directory In file included from tcpedit.c:46: tcpedit_stub.h:50: error: syntax error before "const" tcpedit_stub.h:50: warning: type defaults to `int' in declaration of `tcpedit_tcpedit_optDesc_p' tcpedit.c:58: error: syntax error before "const" tcpedit.c:58: warning: type defaults to `int' in declaration of `tcpedit_tcpedit_optDesc_p' make[3]: *** [tcpedit.o] Error 1 ``` ```bash ./configure --enable-local-libopts ``` -------------------------------- ### Configure IP Fragmentation with frag.cfg Source: http://tcpreplay.appneta.com/wiki/tcprewrite.html Create a configuration file to specify the fragmentation size for IP packets. This method uses the fragroute engine to break down large packets into smaller pieces that fit within the MTU. ```text ip_frag 1400 ``` -------------------------------- ### Configure Tcpreplay with Netmap Support Source: http://tcpreplay.appneta.com/wiki/installation.html Build Tcpreplay with Netmap support, specifying the Netmap source directory if it's not in a standard location. This enables bypassing the network driver for higher performance. ```bash ./configure --with-netmap=/home/fklassen/git/netmap make sudo make install ``` -------------------------------- ### Edit IPv4 TOS/DiffServ/ECN Field Source: http://tcpreplay.appneta.com/wiki/tcprewrite.html Use the --tos flag to set the Type of Service (TOS) byte in IPv4 headers. This example sets the TOS to 50. ```bash $ tcprewrite --tos=50 --infile=input.pcap --outfile=output.pcap ``` -------------------------------- ### Basic tcpreplay Usage Source: http://tcpreplay.appneta.com/wiki/tcpreplay.html Replay a pcap file on a specified interface. ```bash # tcpreplay -i eth0 sample.pcap ``` -------------------------------- ### Remap TCP/UDP Ports Source: http://tcpreplay.appneta.com/wiki/tcprewrite.html Use the --portmap flag to remap TCP or UDP ports. This example changes traffic on port 80 to 8080 and port 22 to 8022. ```bash $ tcprewrite --portmap=80:8080,22:8022 --infile=input.pcap --outfile=output.pcap ``` -------------------------------- ### Edit IPv6 Flow Label Field Source: http://tcpreplay.appneta.com/wiki/tcprewrite.html Use the --flowlabel flag to set the Flow Label field in IPv6 headers. This example sets the Flow Label to 67234. ```bash $ tcprewrite --flowlabel=67234 --infile=input.pcap --outfile=output.pcap ``` -------------------------------- ### Run Tcpreplay with netmap for Maximum FPS Source: http://tcpreplay.appneta.com/wiki/howto.html Utilize Tcpreplay with the --netmap option on a pcap file containing smaller flows to achieve higher frames per second (fps). This demonstrates the impact of flow size on maximum achievable fps. ```bash tcpreplay -i eth7 -tK --loop 50 --unique-ip --netmap smallFlows.pcap Switching network driver for eth7 to netmap bypass mode... done! File Cache is enabled Actual: 713050 packets (460826550 bytes) sent in 0.385312 seconds. ``` -------------------------------- ### Edit IPv6 Traffic Class Field Source: http://tcpreplay.appneta.com/wiki/tcprewrite.html Use the --tclass flag to modify the Traffic Class field in IPv6 headers. This example sets the Traffic Class to 33. ```bash $ tcprewrite --tclass=33 --infile=input.pcap --outfile=output.pcap ```