session-replay-tools / tcpcopy

An online request replication and TCP stream replay tool, ideal for real testing, performance testing, stability testing, stress testing, load testing, smoke testing, and more.
http://session-replay-tools.github.io/tcpcopy/
Other
4.48k stars 1.03k forks source link

部署后,tcp连接无法建立 #372

Closed Fucck closed 2 months ago

Fucck commented 4 years ago

王工你好,最近由于我们公司内网内核升级到3.10,无法使用旧架构的tcpcopy。我在用新架构tcpcopy在线下做验证的时候遇到了以下问题:

模拟线上机器A IP: 10.119.249.37 测试机器B IP:10.117.71.44 辅助机器C IP:10.117.71.45

执行的tcpcopy版本为1.2.0,intercept版本为1.0.0。三台机器的内核版本均为3.10

在机器B上配置:route add -net 10.117.70.1 netmask 255.255.255.255 gw 10.117.71.45 dev xgbe0

执行intercept:./intercept -i xgbe0 -F 'tcp and dst host 10.117.70.1' -d

执行tcpcopy:./tcpcopy -x 10.119.249.37:8999-10.117.71.44:8500 -s 10.117.71.45 -c 10.117.70.1 -d

开始之后,在A和B使用python -m SimpleHTTPServer部署一个简单服务,在网页打开A的网站,在B的服务日志里看不到访问记录。在B上抓包,发现:

从intercept的日志来看: 2020/06/16 17:43:22 +717 [notice] total resp packs:0, all:0, route:4, sock write cnt:0 2020/06/16 17:43:22 +717 [notice] cache hit:0,missed:0,lost:0 2020/06/16 17:43:22 +717 [notice] search:0,extra compared:0,all sessions:4

其中session和route正是我发送请求的次数,所以我也不大清楚到底是那一part出了问题。希望您能给个排查方向。

ps:在编译intercept,./configure的时候,我遇到了checking for pcap_set_immediate_mode() ... not found这个报错,不知道是不是和这个函数有关

wangbin579 commented 4 years ago

辅助服务器能否抓到路由过来的数据包,如果抓不到,简单的处理方式是让intercept运行在测试机器。

Fucck commented 4 years ago

辅助服务器能否抓到路由过来的数据包,如果抓不到,简单的处理方式是让intercept运行在测试机器。

我在辅助服务器上tcpdump host 测试服务器IP,在测试服务器ping辅助服务器,没办法抓到icmp报文。 王工我再请教一下,如何让intercept运行在测试机器,intercept运行在测试机器该怎么配置路由

wangbin579 commented 4 years ago

运行在测试机器 ,设置不设置路由,得看环境,有的环境自动就干掉响应数据包了