欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

Linux系统下查看网络接口数据信息的命令总结

程序员文章站 2022-06-03 14:07:21
这篇文章主要介绍了Linux系统下查看网络接口数据信息的命令总结,需要的朋友可以参考下... 15-12-18...

监视网络接口tcp状态信息数据有多种工具或命令。下面举例一些:
nstat命令

复制代码
代码如下:

# nstat
#kernel
ipinreceives 9733104 0.0
ipindelivers 9733102 0.0
ipoutrequests 9058593 0.0
icmpinerrors 2147 0.0
icmpincsumerrors 1143 0.0
icmpindestunreachs 2 0.0
icmpintimeexcds 1361 0.0
icmpinparmprobs 56 0.0
icmpinredirects 1 0.0
icmpinechoreps 701 0.0
icmpintimestamps 26 0.0
icmpouterrors 750 0.0
icmpouttimeexcds 23 0.0
icmpoutechoreps 26 0.0
icmpouttimestamps 701 0.0
icmpmsgintype0 26 0.0
icmpmsgintype3 1361 0.0
icmpmsgintype4 1 0.0
icmpmsgintype8 701 0.0
icmpmsgintype11 56 0.0
icmpmsgouttype0 701 0.0
icmpmsgouttype3 23 0.0
icmpmsgouttype8 26 0.0
tcpactiveopens 678940 0.0
tcppassiveopens 910289 0.0
tcpattemptfails 58018 0.0
tcpestabresets 14608 0.0
tcpinsegs 9686518 0.0
tcpoutsegs 9038288 0.0
tcpretranssegs 6700 0.0
tcpinerrs 47 0.0
tcpoutrsts 67249 0.0
udpindatagrams 44409 0.0
udpnoports 23 0.0
udpoutdatagrams 44441 0.0
ip6inreceives 6 0.0
ip6innoroutes 6 0.0
ip6outrequests 9 0.0
ip6outnoroutes 3948 0.0
ip6outmcastpkts 14 0.0
ip6inoctets 432 0.0
ip6outoctets 612 0.0
ip6outmcastoctets 992 0.0
ip6innoectpkts 6 0.0
icmp6outmsgs 9 0.0
icmp6outroutersolicits 3 0.0
icmp6outneighborsolicits 1 0.0
icmp6outmldv2reports 5 0.0
icmp6outtype133 3 0.0
icmp6outtype135 1 0.0
icmp6outtype143 5 0.0
tcpextsyncookiesfailed 140 0.0
tcpextembryonicrsts 704 0.0
tcpextprunecalled 23 0.0
tcpexttw 615681 0.0
tcpextpawsestab 20 0.0
tcpextdelayedacks 52123 0.0
tcpextdelayedacklocked 44 0.0
tcpextdelayedacklost 1518 0.0
tcpextlistendrops 32 0.0
tcpexttcpprequeued 19258 0.0
tcpexttcpdirectcopyfrombacklog 45185 0.0
tcpexttcpdirectcopyfromprequeue 394312 0.0
tcpexttcphphits 943072 0.0
tcpexttcphphitstouser 3478 0.0
tcpexttcppureacks 3242625 0.0
tcpexttcphpacks 547259 0.0
tcpexttcpsackrecovery 650 0.0
tcpexttcpfackreorder 1 0.0
tcpexttcpsackreorder 8 0.0
tcpexttcptsreorder 23 0.0
tcpexttcpfullundo 1 0.0
tcpexttcppartialundo 23 0.0
tcpexttcpdsackundo 1 0.0
tcpexttcplossundo 854 0.0
tcpexttcplostretransmit 162 0.0
tcpexttcpsackfailures 135 0.0
tcpexttcplossfailures 18 0.0
tcpexttcpfastretrans 1517 0.0
tcpexttcpforwardretrans 104 0.0
tcpexttcpslowstartretrans 172 0.0
tcpexttcptimeouts 2764 0.0
tcpexttcplossprobes 5201 0.0
tcpexttcplossproberecovery 2858 0.0
tcpexttcpsackrecoveryfail 74 0.0
tcpexttcprcvcollapsed 460 0.0
tcpexttcpdsackoldsent 1645 0.0
tcpexttcpdsackofosent 21 0.0
tcpexttcpdsackrecv 879 0.0
tcpexttcpabortondata 4314 0.0
tcpexttcpabortonclose 346 0.0
tcpexttcpabortontimeout 186 0.0
tcpexttcpdsackignorednoundo 615 0.0
tcpexttcpspuriousrtos 95 0.0
tcpexttcpsackshifted 402 0.0
tcpexttcpsackmerged 2048 0.0
tcpexttcpsackshiftfallback 2592 0.0
tcpexttcprcvcoalesce 145162 0.0
tcpexttcpofoqueue 36672 0.0
tcpexttcpofomerge 21 0.0
tcpexttcpchallengeack 329 0.0
tcpexttcpsynchallenge 47 0.0
ipextinnoroutes 2 0.0
ipextinoctets 1568628267 0.0
ipextoutoctets 1158526375 0.0
ipextinnoectpkts 9828130 0.0
ipextinect0pkts 10 0.0
ipextincepkts 3 0.0

ss命令

复制代码
代码如下:

# ss -s
total: 319 (kernel 752)
tcp: 187 (estab 114, closed 58, orphaned 0, synrecv 0, timewait 58/0), ports 0

transport total ip ipv6
* 752 - -
raw 0 0 0
udp 3 2 1
tcp 129 113 16
inet 132 115 17
frag 0 0 0

netstat命令

复制代码
代码如下:

# netstat -i
kernel interface table
iface mtu met rx-ok rx-err rx-drp rx-ovr tx-ok tx-err tx-drp tx-ovr flg
eth0 9001 0 2194916 0 0 0 1424609 0 0 0 bmru
lo 65536 0 7670598 0 0 0 7670598 0 0 0 lru</p> <p># netstat -s
ip:
9743496 total packets received
0 forwarded
0 incoming packets discarded
9743494 incoming packets delivered
9068146 requests sent out
icmp:
2147 icmp messages received
1143 input icmp message failed.
incsumerrors: 2
icmp input histogram:
destination unreachable: 1361
timeout in transit: 56
source quenches: 1
echo requests: 701
echo replies: 26
750 icmp messages sent
0 icmp messages failed
icmp output histogram:
destination unreachable: 23
echo request: 26
echo replies: 701
icmpmsg:
intype0: 26
intype3: 1361
intype4: 1
intype8: 701
intype11: 56
outtype0: 701
outtype3: 23
outtype8: 26
tcp:
679665 active connections openings
911387 passive connection openings
58018 failed connection attempts
14608 connection resets received
118 connections established
9696894 segments received
9047825 segments send out
6700 segments retransmited
47 bad segments received.
67249 resets sent
udp:
44425 packets received
23 packets to unknown port received.
0 packet receive errors
44457 packets sent
udplite:
tcpext:
140 invalid syn cookies received
704 resets received for embryonic syn_recv sockets
23 packets pruned from receive queue because of socket buffer overrun
616402 tcp sockets finished time wait in fast timer
20 packets rejects in established connections because of timestamp
52124 delayed acks sent
45 delayed acks further delayed because of locked socket
quick ack mode was activated 1519 times
32 syns to listen sockets dropped
19258 packets directly queued to recvmsg prequeue.
45185 bytes directly in process context from backlog
394312 bytes directly received in process context from prequeue
943942 packet headers predicted
3478 packets header predicted and directly queued to user
3246338 acknowledgments not containing data payload received
547737 predicted acknowledgments
650 times recovered from packet loss by selective acknowledgements
detected reordering 1 times using fack
detected reordering 8 times using sack
detected reordering 23 times using time stamp
1 congestion windows fully recovered without slow start
23 congestion windows partially recovered using hoe heuristic
1 congestion windows recovered without slow start by dsack
854 congestion windows recovered without slow start after partial ack
tcplostretransmit: 162
135 timeouts after sack recovery
18 timeouts in loss state
1517 fast retransmits
104 forward retransmits
172 retransmits in slow start
2764 other tcp timeouts
tcplossprobes: 5202
tcplossproberecovery: 2859
74 sack retransmits failed
460 packets collapsed in receive queue due to low socket buffer
1646 dsacks sent for old packets
21 dsacks sent for out of order packets
879 dsacks received
4314 connections reset due to unexpected data
346 connections reset due to early user close
186 connections aborted due to timeout
tcpdsackignorednoundo: 615
tcpspuriousrtos: 95
tcpsackshifted: 402
tcpsackmerged: 2048
tcpsackshiftfallback: 2592
tcprcvcoalesce: 145187
tcpofoqueue: 36673
tcpofomerge: 21
tcpchallengeack: 329
tcpsynchallenge: 47
ipext:
innoroutes: 2
inoctets: 1570012766
outoctets: 1159491497
innoectpkts: 9838700
inect0pkts: 10
incepkts: 3

ip命令

复制代码
代码如下:

# ip -s link
1: lo: <loopback,up,lower_up> mtu 65536 qdisc noqueue state unknown mode default group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
rx: bytes packets errors dropped overrun mcast
883395575 7672258 0 0 0 0
tx: bytes packets errors dropped carrier collsns
883395575 7672258 0 0 0 0
2: eth0: <broadcast,multicast,up,lower_up> mtu 9001 qdisc pfifo_fast state up mode default group default qlen 1000
link/ether 02:7a:7d:d2:f7:21 brd ff:ff:ff:ff:ff:ff
rx: bytes packets errors dropped overrun mcast
694754381 2197268 0 0 0 0
tx: bytes packets errors dropped carrier collsns
296980409 1425257 0 0 0 0

sar命令

复制代码
代码如下:

# sar -n dev 1
linux 3.13.0-48-generic (beta) 2015年08月17日 _x86_64_ (4 cpu)

14时46分54秒 iface rxpck/s txpck/s rxkb/s txkb/s rxcmp/s txcmp/s rxmcst/s %ifutil
14时46分55秒 eth0 12.00 5.00 0.97 1.18 0.00 0.00 0.00 0.00
14时46分55秒 lo 10.00 10.00 1.00 1.00 0.00 0.00 0.00 0.00

14时46分55秒 iface rxpck/s txpck/s rxkb/s txkb/s rxcmp/s txcmp/s rxmcst/s %ifutil
14时46分56秒 eth0 1.00 1.00 0.05 0.47 0.00 0.00 0.00 0.00
14时46分56秒 lo 16.00 16.00 2.17 2.17 0.00 0.00 0.00 0.00

14时46分56秒 iface rxpck/s txpck/s rxkb/s txkb/s rxcmp/s txcmp/s rxmcst/s %ifutil
14时46分57秒 eth0 5.00 3.00 0.26 0.61 0.00 0.00 0.00 0.00
14时46分57秒 lo 10.00 10.00 1.00 1.00 0.00 0.00 0.00 0.00

还有其它工具如nload,iftop等等,不一一列举了。