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

时间:2025-03-23 20:51:33
[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.