linux netstat -an命令,linux netstat 总结

linux netstat -an命令,linux netstat 总结一 netstat 不加参数输出如下 列出所有活动的链接 root test netstatActiv w oservers ProtoRecv QSend QLocalAddres 45

一、netstat 不加参数输出如下(列出所有活动的链接)[root@test ~]# netstat

Active Internet connections (w/o servers)

Proto Recv-Q Send-Q Local Address               Foreign Address             State

tcp        0      1 test:45785                  162.221.13.80:301           SYN_SENT

tcp        0      0 test:ssh                    localhost:sdclient         ESTABLISHED

tcp        0      0 test:ssh                    localhost:starbot           ESTABLISHED

二、netstat -n  输出如下 (以数字ip形式显示主机,默认只显示ESTABLISHED以及系统socket)[root@test ~]# netstat -n

Active Internet connections (w/o servers)

Proto Recv-Q Send-Q Local Address               Foreign Address             State

tcp        0      0 ::ffff:192.168.2.150:22     ::ffff:192.168.2.153:2310   ESTABLISHED

tcp        0      0 ::ffff:192.168.2.150:9000   ::ffff:192.168.2.153:4279   TIME_WAIT

tcp        0      1 192.168.2.150:34336         162.221.13.80:301           SYN_SENT

tcp        0      0 192.168.2.150:33119         192.168.2.142:3306          TIME_WAITtcp        0      0 ::ffff:192.168.2.150:9000   ::ffff:192.168.2.1:1065     ESTABLISHED

tcp        0      0 ::ffff:192.168.2.150:9000   ::ffff:192.168.2.153:4275   TIME_WAIT

三、netstat -an  输出如下(列出所有活动的和在监听的链接)[root@test ~]# netstat -an

Active Internet connections (w/o servers)

Proto Recv-Q Send-Q Local Address               Foreign Address             State

tcp        0      0 ::ffff:192.168.2.150:22     ::ffff:192.168.2.153:2310   ESTABLISHED

tcp        0      0 192.168.2.150:45245         192.168.2.142:3306TIME_WAITtcp        0      0 :::8800                     :::*LISTENtcp        0      1 192.168.2.150:45157         162.221.13.80:301           SYN_SENT

四、netstat -p  (列出所对应的程序)[root@test ~]# netstat -np

Active Internet connections (w/o servers)

Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name

tcp        0      0 192.168.2.150:43380         192.168.2.142:3306          TIME_WAIT   –

tcp        0      0 192.168.2.150:43379         192.168.2.142:3306          TIME_WAIT   –

tcp        0      0 192.168.2.150:43378         192.168.2.142:3306          TIME_WAIT   –

tcp        0      0 192.168.2.150:43377         192.168.2.142:3306          TIME_WAIT   –

tcp        0      1 192.168.2.150:57533         162.221.13.80:301           SYN_SENT    24891/.IptabLex

tcp        0      0 ::ffff:192.168.2.150:22     ::ffff:192.168.2.153:2310   ESTABLISHED 23377/sshd: root@no

tcp        0      0 ::ffff:192.168.2.150:9000   ::ffff:192.168.2.153:4385   TIME_WAIT   –

tcp        0      0 ::ffff:192.168.2.150:22     ::ffff:192.168.2.153:2838   ESTABLISHED 23538/sshd: root@no

五、netstat -l (只显示当前正在监听的端口,一般配合 -np)[root@test ~]# netstat -npl

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name

tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      3470/mysqld

tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      13066/portmap

tcp        0      0 0.0.0.0:690                 0.0.0.0:*                   LISTEN     2204/rpc.statd

tcp        0      0 0.0.0.0:21                  0.0.0.0:*                   LISTEN      2543/vsftpd

tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      2511/cupsd

tcp        0      0 127.0.0.1:2207              0.0.0.0:*                   LISTEN      2467/python

tcp        0      0 :::8800                     :::*                        LISTEN      5433/httpd

tcp        0      0 :::8130                     :::*                       LISTEN     5433/httpd

六、netstat -s (显示统计信息)[root@test ~]# netstat -s

Ip:

total packets received

36 with invalid headers

1900 with invalid addresses

0 forwarded

0 incoming packets discarded

incoming packets delivered

requests sent out

77938 outgoing packets dropped

218 dropped because of missing route

Icmp:

16308 ICMP messages received

2 input ICMP message failed.

ICMP input histogram:

destination unreachable: 16281

echo requests: 4

echo replies: 23

17897 ICMP messages sent

0 ICMP messages failed

ICMP output histogram:

destination unreachable: 17853

echo request: 40

echo replies: 4

IcmpMsg:

InType0: 23

InType3: 16281

InType8: 4

OutType0: 4

OutType3: 17853

OutType8: 40

Tcp:

active connections openings

37216 passive connection openings

20861 failed connection attempts

1250 connection resets received

12 connections established

segments received

segments send out

9036 segments retransmited

0 bad segments received.

34626 resets sent

Udp:

packets received

17787 packets to unknown port received.

0 packet receive errors

packets sent

TcpExt:

132 invalid SYN cookies received

107 resets received for embryonic SYN_RECV sockets

30 ICMP packets dropped because they were out-of-window

TCP sockets finished time wait in fast timer

11 time wait sockets recycled by time stamp

delayed acks sent

171 delayed acks further delayed because of locked socket

Quick ack mode was activated 857 times

packets directly queued to recvmsg prequeue.

packets directly received from backlog

packets directly received from prequeue

packets header predicted

packets header predicted and directly queued to user

acknowledgments not containing data received

predicted acknowledgments

269 times recovered from packet loss due to SACK data

3 bad SACKs received

Detected reordering 1 times using FACK

Detected reordering 3 times using time stamp

2 congestion windows fully recovered

11 congestion windows partially recovered using Hoe heuristic

TCPDSACKUndo: 11

225 congestion windows recovered after partial ack

1184 TCP data loss events

112 timeouts after SACK recovery

25 timeouts in loss state

1138 fast retransmits

97 forward retransmits

743 retransmits in slow start

other TCP timeouts

79 sack retransmits failed

4 times receiver scheduled too late for direct processing

1167 DSACKs sent for old packets

148 DSACKs received

19 connections reset due to unexpected data

16 connections reset due to early user close

550 connections aborted due to timeout

IpExt:

InMcastPkts: 10144

OutMcastPkts: 44

InBcastPkts:

七、netstat -c (动态显示每秒钟刷新,持续管擦链接状况。可配合-t  -u 持续观察tcp  udp的链接状况)

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/177184.html原文链接:https://javaforall.net

(0)
上一篇 2026年3月26日 下午8:06
下一篇 2026年3月26日 下午8:07


相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号