[实践OK]Linux/linux centos下的SS/ss查看源端和目标端口Linux的Http端口命令完成情况,相当方便简单。

jackxiang 2017-9-8 10:13 | |
背景:TCP高并发时用 netstat反应不过来,用ss,ss --help查不到下面的参数,得用 man ss查看。



Linux下的SS查看Linux的Http端口完成情况


Netid  Recv-Q Send-Q Local Address:Port                 Peer Address:Port                
tcp    0      0      101.200.228.135:http                 61.150.114.230:32331                
tcp    0      0      101.200.228.135:http                 61.150.114.230:32329                
tcp    0      0      101.200.228.135:http                 61.150.114.230:32347                
tcp    0      0      101.200.228.135:http                 61.150.114.230:32322                
tcp    0      0      101.200.228.135:http                 61.150.114.230:32346                
tcp    0      0      101.200.228.135:http                 61.150.114.230:32321                
tcp    0      0      101.200.228.135:http                 61.150.114.230:32327                
tcp    0      0      101.200.228.135:http                 61.150.114.230:32328                
tcp    0      0      101.200.228.135:http                 61.150.114.230:23159                
tcp    0      0      101.200.228.135:http                 1.85.216.135:50864                
tcp    0      0      101.200.228.135:http                 140.205.205.4:63844  



#ss dst  10.51.77.34
Netid State      Recv-Q Send-Q          Local Address:Port                           Peer Address:Port                
tcp   ESTAB      0      0                 10.51.77.34:6379                            10.51.77.34:53590                
tcp   ESTAB      0      0                 10.51.77.34:6379                            10.51.77.34:53586                
tcp   ESTAB      0      0                 10.51.77.34:53586                           10.51.77.34:6379                
tcp   CLOSE-WAIT 1      0                 10.51.77.34:43714                           10.51.77.34:6379                
tcp   ESTAB      0      0                 10.51.77.34:53590                           10.51.77.34:6379                
tcp   CLOSE-WAIT 1      0                 10.51.77.34:43718                           10.51.77.34:6379


加个源端口过滤一下(sport = 6379,等号之间得有空格):

Netid State      Recv-Q Send-Q          Local Address:Port                           Peer Address:Port                
tcp   ESTAB      0      0                 10.51.77.34:6379                            10.51.77.34:53590                
tcp   ESTAB      0      0                 10.51.77.34:6379                            10.51.77.34:53586


查看源地址Http端口的一个情况:

tcp   ESTAB      0      0             101.200.228.135:http                         101.81.172.212:41352                
tcp   ESTAB      0      0             101.200.228.135:http                           36.110.2.171:35007                
tcp   ESTAB      0      0             101.200.228.135:http                        115.236.174.162:55497                
tcp   ESTAB      0      0             101.200.228.135:http                           36.110.2.171:33458

作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/9450/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!


最后编辑: jackxiang 编辑于2018-7-15 09:31
评论列表
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]