天天看点

测试linux tcp频繁握手,linux tcp三次握手慢的问题 - 网站服务器 - LinuxTone | 运维专家网论坛 - 最棒的Linux运维与开源架构技术交流社区! - Powered...

192.168.1.15是web服务器,192.168.0.5是pc,从192.168.0.5访问192.168.1.15,访问192.168.1.15的80和22端口都比较慢,在192.168.1.15用命令tcpdump 'tcp[13] & 2 ==2' and \(dst or src 192.168.0.5\)抓取SYN 数据包,其结果如下:

访问80端口时:

server00:~# tcpdump 'tcp[13] & 2 ==2' and \(dst or src 192.168.0.5\)

tcpdump: verbose output suppressed, use -v or -vv for full protocol decode

listening on eth1, link-type EN10MB (Ethernet), capture size 96 bytes

16:39:36.243562 IP asian.14113 > 192.168.1.15.www: S 2091566485:2091566485(0) win 5840

16:39:39.242799 IP asian.14113 > 192.168.1.15.www: S 2091566485:2091566485(0) win 5840

16:39:43.437260 IP asian.13157 > 192.168.1.15.www: S 2504765917:2504765917(0) win 5840

16:39:43.438127 IP asian.12810 > 192.168.1.15.www: S 2506370553:2506370553(0) win 5840

16:39:45.240581 IP asian.14113 > 192.168.1.15.www: S 2091566485:2091566485(0) win 5840

16:39:46.434731 IP asian.13157 > 192.168.1.15.www: S 2504765917:2504765917(0) win 5840

16:39:46.435098 IP asian.12810 > 192.168.1.15.www: S 2506370553:2506370553(0) win 5840

16:39:57.237904 IP asian.14113 > 192.168.1.15.www: S 2091566485:2091566485(0) win 5840

16:40:18.637297 IP asian.13665 > 192.168.1.15.www: S 1399271655:1399271655(0) win 65535

16:40:18.637316 IP 192.168.1.15.www > asian.13665: S 3375036930:3375036930(0) ack 1399271656 win 5840

访问22端口时:

server00:~# tcpdump 'tcp[13] & 2 ==2' and \(dst or src 192.168.0.5\)

tcpdump: verbose output suppressed, use -v or -vv for full protocol decode

listening on eth1, link-type EN10MB (Ethernet), capture size 96 bytes

17:11:15.961614 IP asian.12813 > 192.168.1.15.22: S 4107113827:4107113827(0) win 5840

17:11:18.959110 IP asian.12813 > 192.168.1.15.22: S 4107113827:4107113827(0) win 5840

17:11:24.957810 IP asian.12813 > 192.168.1.15.22: S 4107113827:4107113827(0) win 5840

17:11:24.957836 IP 192.168.1.15.22 > asian.12813: S 1067633263:1067633263(0) ack 4107113828 win 5792

192.168.1.15在处理192.168.0.5的SYN请求时为什么那么慢?所以192.168.0.5经常出现连接超时,但是一旦建立好了tcp连接,后面访问就很正常了,再过几分钟后又会连接超时,所以是在建立tcp连接的时候存在问题,这不仅仅是处理http请求。连ssh的请求都慢,系统内存充足,负载还不到1,netstat -tn看到的才130个tcp连接,192.168.1.15是debian系统;这问题已经缠着我两个星期了,请问各位遇到过类似问题吗 ?