Test schematic diagram:
System version: Ubuntu16.04
Tcpreplay installation: apt-get install tcpreplay
(This version of the NIC name is not called eth0 and eth1, the following configuration changes)
eth0 corresponds to ens33 NIC: IP: 172.20.60.166 MAC: ec:a8:6b:82:32:c1
eth1 corresponds to the ens32 NIC: IP: 172.20.60.165 MAC: 00:13:3b:0f:6a:fb
Test the first step: Preprocess the Cache, the command is:
tcpprep -a client -i rzxSJ.pcap -o rzx.cach
This command divides the PCAP file into client and server, with client by default. When sent, the packet is sent from both the client and server.
Test step 2: Rewrite the IP address and MAC address, the command is:
Tcprewrite – e 172.20.60.166:172.20.60.165 — enet – 10-channel dmac = 00:13:3 b: 0 f: 6 a: fb, ec, a8:6 b: 82-32: c1 – enet – smac = ec: a8:6 b: 82-32: c1, 00:13:3 b: 0 f: 6 a: fb – c RZX. Cach -i rzxSJ. Pcap – o 111. Pcap
This command overwrites the IP and MAC addresses. You can use a tool such as wireshark to open 111.pcap and check whether the modification is successful.
Test step 3: Replay packet with the following command:
tcpreplay -i ens33 -I ens32 -l 100 -t -c rzx.cach 111.pcap
ens33 port corresponds to eth0. ens32 port corresponds to eth1
The above is Shenzhen HDV Phoelectron Technology Ltd. bring customers about the “tcpreplay current test method” introduction article, and our company is a specialized production of optical network manufacturers, the products involved are ONU series (OLT ONU/AC ONU/CATV ONU/GPON ONU/XPON ONU), Optical module series (optical fiber module/Ethernet optical fiber module /SFP optical module), OLT series (OLT equipment /OLT switch/optical cat OLT), etc., there are various specifications of communication products for the needs of different scenarios for network support, welcome to consult.