Measure the test taker's knowledge about network performance tools in Linux.
There are a lot of Network Tools on Linux. How can I select a name-filling tool based on actual needs? Here is a brief introduction:
Observe the network traffic:
"Sar-n DEV 1 5" can calculate the network flow rate on each NIC:
# Sar-n DEV 2 5
...
02:47:12 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s
02:47:14 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00
02:47:14 eth0 2.51 0.00 0.17 0.00 0.00 0.00 0.00
...
Ptraf is a powerful tool for observing the network flow rate. It allows you to observe the network flow rate step by step, from the hardware layer (NIC), to the network layer (IPv4, IPv6), to the transmission layer (TCP, UDP etc .), until each pair of socket pair.
Iptraf-d
Observe the network connection status:
"Netstat-a"
This is a traditional tool, but it cannot handle massive network connections. Therefore, we recommend that you use ss for hosts with large-scale network connections.
1
2
3
4
5
6
7 # netstat-
Active Internet connections (servers andestablished)
Proto Recv-QSend-QLocal Address Foreign Address State
Tcp 0 0 *: mysql *: * LISTEN
Tcp 0 0 *: 5901 *: * LISTEN
...
Tcp 0 Protocol bj71s060.chn.hp.com: ssh 16.169.16.67: 52681 ESTABLISHED
"Ss-a" lists all network connections. Ss is especially suitable for hosts with massive connections.
If the "-p" option is added, the corresponding process number can be displayed.
# Ss-
State Recv-QSend-Q Local Address: Port Peer Address: Port
LISTEN 0 50 *: mysql *:*
LISTEN 0 5 *: 5901 *:*
...
LISTEN 0 128: 38246 :::*
ESTAB 0 184 16.187.252.58: ssh 16.169.16.67: 52681
Observe the static statistical value:
"Netstat-I"
# Netstat-I
Kernel Interfacetable
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR Flg
Eth0 1500 0572421962 0 0 016831237 0 0 0 BMRU
Lo 16436 0 556534 0 0 556534 0 0 0 0LRU
Ifconfig shows a small number of statistics at the NIC level, including the number of packages, collision, and errors:
# Ifconfig eth0
Eth0 Link encap: Ethernet HWaddr00: 19: BB: 5B: 07: 34
Inet addr: 16.187.252.58 Bcast: 16.187.255.255 Mask: 255.255.252.0
Inet6 addr: fe80: 219: bbff: fe5b: 734/64 Scope: Link
Up broadcast running multicast mtu: 1500 Metric: 1
RX packets: 572422657 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 16831252 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 FIG: 1000
RX bytes: 50512945748 (47366gib) TX bytes: 11194760435 (10.4GiB)
Interrupt: 19 Memory: f0500000-f0520000
The information displayed in "ip-s link" is similar to the following:
# Ip-s link
1: lo: <LOOPBACK, UP, LOWER_UP> mtu16436qdisc noqueue state UNKNOWN
Link/loopback00: 00: 00: 00: 00: 00brd00: 00: 00: 00: 00: 00
RX: bytes packets errors dropped overrun mcast
2255610398556534 0 0 0 0
TX: bytes packets errors dropped carrier collsns
2255610398556534 0 0 0 0
2: eth0: <BROADCAST, MULTICAST, UP, LOWER_UP> mtu1500qdisc pfifo_fast state UP qlen1000
Link/ether00: 19: bb: 5b: 07: 34brd ff: ff
RX: bytes packets errors dropped overrun mcast
32683320875724229790 0 0 16733497
TX: bytes packets errors dropped carrier collsns
2604833405168312850 0 0 0
"Netstat-s" provides statistics under various protocols. Some statistical values such as retransmit are very useful. Only "netstat-s" can see:
# Netstat-s
...
Tcp:
71479 active connections openings
7181 passive connection openings
13723 failed connection attempts
407 connection resets committed ed
1 connections established
18969163 segments received
11210435 segments send out
85883 segments retransmited
0bad segments received.
80162 resets sent
...
475 fast retransmits
30 forward retransmits
110 retransmits inslow start
22772 other TCP timeouts
5 sack retransmits failed
...
This article permanently updates the link address: