使用netstat查看tcp连接、udp连接

本文详细解析了通过netstat命令查看Linux系统中TCP和UDP连接的状态,包括Recv-Q和Send-Q字段的意义,以及如何理解Established和Listening状态。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

[root@dbserver ~]# netstat -nt  --->>>查看tcp连接,注意看第二列和第三列
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0     52 192.168.80.187:22       192.168.80.1:54458      ESTABLISHED
tcp        0      0 192.168.80.187:22       192.168.80.1:54455      ESTABLISHED
tcp        0      0 192.168.80.187:22       192.168.80.1:52256      ESTABLISHED
tcp        0      0 192.168.80.187:22       192.168.80.1:52264      ESTABLISHED
tcp        0      0 192.168.80.187:7432     192.168.80.1:54515      ESTABLISHED
[root@dbserver ~]# netstat -nua  --->>>查看udp连接,注意看第二列和第三列
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
udp        0      0 0.0.0.0:5353            0.0.0.0:*                          
udp        0      0 0.0.0.0:41277           0.0.0.0:*                          
udp        0      0 127.0.0.1:323           0.0.0.0:*                          
udp        0      0 0.0.0.0:978             0.0.0.0:*                          
udp        0      0 192.168.122.1:53        0.0.0.0:*                          
udp        0      0 0.0.0.0:67              0.0.0.0:*                          
udp        0      0 0.0.0.0:111             0.0.0.0:*                          
udp6       0      0 ::1:323                 :::*                               
udp6       0      0 ::1:61020               ::1:61020               ESTABLISHED
udp6       0      0 :::978                  :::*                               
udp6       0      0 :::111                  :::*                               
[root@dbserver ~]# 

如下取自man netstat的结果:
   Recv-Q
       Established: The count of bytes not copied by the user program connected to this socket.  
       Listening: Since Kernel 2.6.18 this column contains the current syn backlog.

   Send-Q
       Established: The count of bytes not acknowledged by the remote host.  
       Listening: Since Kernel 2.6.18 this column contains the maximum size of the syn backlog.

相关参考:
https://access.redhat.com/solutions/170713

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值