html tool

显示标签为“tcpreplay”的博文。显示所有博文
显示标签为“tcpreplay”的博文。显示所有博文

2020年10月19日星期一

修改mtu ,tcpreplay重放

 tcpreplay 提示mtu過小

Warning: Unable to send packet: Error with PF_PACKET send() [215]: Message too long (errno = 90)

查一下pcap 中 length的最大值

重設一下回放的網卡mtu

linux系統修改MTU的方法比較簡單,一個命令即可:

sudo ifconfig eth0 mtu 3000

查詢mtu值

ifconfig eth0 |grep mtu 

修改成功,再回放就可以

https://www.itread01.com/content/1550256517.html

2020年7月1日星期三

【完成】问题:两个真实主机之间,pcap回放udp server 不接收问题IIII

https://stackoverflow.com/questions/13471680/udp-multicast-client-does-not-see-udp-multicast-traffic-generated-by-tcpreplay
找到原因了,

That could happen if the machine where you run tcpdump has IP or UDP checksum offloading enabled. That means the packages you capture locally haven't their checksums calculated yet, which the hardware does before sending them out. When you then tcpreplay those packets, the checksums are not calculated, as tcpreplay works on a lower level than the socket API you used to generate the packets.

In order to verify the correctness of the checksums (both those of the dump file as well as those of the packets spit out by the subsequent tcpreplay), tcpdump -v ... will warn you about wrong checksums. wireshark also colors wrongly checksummed frames differently (unless turned off in the wireshark settings).

Did you try to tcpdump the packets only on the sending host, or also on the receiving host? The latter would remove the checksum errors, if that is indeed your problem.


处理方式:

Ya, this happened to me. I could check it with Wireshark (after I enabled proper settings in it), and also doing: "tcrpewrite --fixcsum --infille in.pcap --outfile out.pcap", and then passing out.pcap to tcpreplay (it worked then). – bingen Aug 18 '16 at 18:27 


自己测试通过使用

tcprewrite --fixcsum --infile 9999.pcap --outfile 9999_new.pcap 

之后回放 9999_new.pcap 就ok了,ok,问题终结了,mark一下。

给自己人工点个赞吧,感觉自己的udp 还真是一知半解啊:)努力:)


2020年6月8日星期一

tcpreplay 本地pcap回放,无法在对应的server端接收到的原因


问题描述:
使用tcpreplay pcap包,这个包是udp的到127.0.0.1的某个地址
问题是对应的socket 监听收不到对应的数据,但手动发送到这个端口都可以收到,why?

[go]如下答案: 

Q: Can I send packets on the same computer running tcpreplay?

Generally speaking no. When tcpreplay sends packets, it injects them between the TCP/IP stack of the system and the device driver of the network card. The result is the TCP/IP stack system running tcpreplay never sees the packets.

One suggestion that has been made is using something like VMWare, Parallels or Xen. Running tcpreplay in the virtual machine (guest) would allow packets to be seen by the host operating system.



https://www.coder.work/article/1515382

最佳答案

根据tcpreplay文档,不可能在同一台计算机上发送数据包:数据包被注入到tcp/ip堆栈和网卡的设备驱动程序之间,因此运行tcpreplay的tcp/ip堆栈永远看不到这些数据包。
尝试在同一台计算机上的虚拟化环境中运行tcpreplay,主机操作系统应该会看到这些数据包



[ps:

【next】1. tcpprep 可以跨主机生成catch ,来模拟回放,在对方的应用层使用,但自己还是没有测试成功

[next] 2.如果是导出udp的数据ascii 的,单个包wrieshark可以直接自己导出,但是批量没找到方法,倒是找到可以自己写工具的方式:

参考: https://zhuanlan.zhihu.com/p/31512066


]

2018年4月3日星期二

tcpreplay make and install


download 指定版本
https://github.com/appneta/tcpreplay/releases

Simple directions for Unix users:

./configure 
make
sudo make install

2018年1月9日星期二

tcpreplay控制速度



http://tcpreplay.synfin.net/wiki/tcpreplay

Replaying at different speeds

You can also replay the traffic at different speeds then it was originally captured. Some examples:
To replay traffic as quickly as possible:
# tcpreplay --topspeed --intf1=eth0 sample.pcap
To replay traffic at a rate of 10Mbps:
# tcpreplay --mbps=10.0 --intf1=eth0 sample.pcap
To replay traffic 7.3 times as fast as it was captured:
# tcpreplay --multiplier=7.3 --intf1=eth0 sample.pcap
To replay traffic at half-speed:
# tcpreplay --multiplier=0.5 --intf1=eth0 sample.pcap
To replay at 25 packets per second:
# tcpreplay --pps=25 --intf1=eth0 sample.pcap
To replay packets, one at a time while decoding it (useful for debugging purposes):
# tcpreplay --oneatatime --verbose --intf1=eth0 sample.pcap