Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Fucck opened this issue Jun 16, 2020 · 3 comments
Closed

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

Fucck opened this issue Jun 16, 2020 · 3 comments

Comments

@Fucck
Copy link

Fucck commented Jun 16, 2020

王工你好,最近由于我们公司内网内核升级到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上抓包,发现:

  • 测试机器收到了线上机器发过来的syn包,源IP为10.117.70.1
  • 测试机器回syn+ack包,目的IP为10.117.70.1,二层mac地址就是辅助机器的mac地址(我认为这样就说明路由是配置成功的)
  • 测试机器没有收到ack包,只能再次发送tcp retransmission

从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
Copy link
Member

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

@Fucck
Copy link
Author

Fucck commented Jun 16, 2020

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

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

@wangbin579
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants