1.ping
The ping uses an ICMP echo request and a loopback reply message. The packet sent out by the Ping tool does not pass the TCP/UDP protocol, but goes through the IP protocol. The time that the ping command calculates is the total round-trip time of the packet.
The common options for the ping command are as follows:
[Plain]View PlainCopy
- -C num--indicates that NUM packets are sent out using a ping
- -n--indicates that the output of the ping contains the host information in the IP representation, not the mapping between IP and host name, so that the ping responds faster
- -S packetsize--Specifies the size of the packet that the ping sends out, in units B. If you do not configure this option, the default is 56B
- -T ttl--set the Time to Live (TTL) life cycle of packets transmitted over the network
- -f--Fast Ping,flood Ping, sending receive ICMP Echo messages much faster
Examples are as follows:
[Plain]View PlainCopy
- Ping-c 3-s www.baidu.com #表示向www. baidu.com Send 3 512B-size packets for network probing
- Ping-f www.baidu.com #快速ping
2.traceroute
Traceroute also uses the ICMP protocol, which uses ICMP for more time than error-Error reporting and ICMP endpoint unreachable messages. For the ICMP protocol, the principle is:
Important options for traceroute are:
[Plain]View PlainCopy
- -u--uses the UDP protocol to detect, which is the default detection protocol.
- -i--uses the ICMP protocol to detect
- -t--uses the TCP protocol to detect
Examples of use are:
[Plain]View PlainCopy
- Traceroute www.baidu.com
Note that there are three time values in each line of information returned using traceroute, because the source has three probe requests per node or router.
3.mtr
There is a better network connectivity judgment tool in Linux, which can be combined with ping | nslookup | Tracert to determine the relevant characteristics of the network, this command is the MTR
Use format:
[Plain]View PlainCopy
- mtr [Options] hostname
Common options:
[Plain]View PlainCopy
- The-r--sets the MTR to reporting mode, tracing the results to report the mode output. If the-R is not present, it will enter the real-time interactive mode of MTR.
- -C num--defines the number of traces, each of which is 1s, and-c must be used with-R, by default 10 times.
Examples of Use:
(1) Real-time display mode of MTR
[Plain]View PlainCopy
- MTR 202.108.33.94
(2) MTR's reporting model
[Plain]View PlainCopy
- [Email protected] ~]# mtr-r 202.108.33.94
- FOCUS9097 snt:10 loss% last AVG best Wrst StDev
- 220.181.61.252 0% 6.8 3.3 1.8 7.4 2.2
- 220.181.17.217 0% 0.4 0.5 0.4 0.7 0.1
- 220.181.16.17 0% 0.6 0.5 0.5 0.6 0.0
- 202.97.53.14 10% 0.7 0.7 0.7 0.8 0.0
- 219.158.35.1 0% 0.8 0.8 0.8 0.9 0.0
- 219.158.5.81 0% 1.2 1.3 1.2 1.6 0.1
- 123.126.0.138 0% 1.2 1.1 1.1 1.3 0.1
- 61.148.153.126 0% 1.9 10.5 1.5 89.9 27.9
- 61.148.143.22 0% 1.5 1.6 1.5 1.7 0.0
- 210.74.178.198 0% 1.6 1.6 1.5 1.9 0.1
- 202.108.33.94 0% 1.5 1.5 1.4 1.5 0.0
Output Explanation:
First column: The IP address and the native domain name are displayed, which is like tracert
Second column: Snt:10 set the number of traces, the default value is 10 can be customized by the parameter-C, such as Mtr-r-C 15 202.108.33.94
Third column Loss: is the packet loss rate for each corresponding IP displayed
Fourth column last: The most recent return delay shown
Fifth Column avg: Is average this should be the average delay in sending ping packets
Best of the Sixth column: the shortest delay
Seventh column Wrst: is the worst or the most frequent delay
Eighth Column StDev: is the standard deviation
PING|TRACEROUTE|MTR tool for network troubleshooting under Linux (ZZ)