In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces the link test through mtr command line tool in Linux environment, which has a certain reference value and can be used for reference by friends who need it. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.
High packet loss delay when visiting Linux instance website
When the website access is slow or unreachable, if other significant problems are eliminated and obvious packet loss is detected in ping, it is recommended that you do a link test. In the Linux environment, you can determine the source of the problem by link testing with the mtr command line tool (preferred) or the traceroute command line tool.
In general, follow these steps:
Use link testing tools to detect network status and server status.
Analyze and process according to the link test results.
Mtr command line tool (preferred)
Mtr (My traceroute) is a network testing tool pre-installed in almost all Linux distributions, which integrates the graphical interface of tracert and ping commands, and is very powerful.
Ping and tracert are usually used to detect the status of the network and the server, as described below:
By default, mtr sends ICMP packets for link probing, and the-u parameter specifies UDP packets for probing. Compared with traceroute, which makes only one link tracking test, mtr will continuously detect the relevant nodes on the link and give the corresponding statistical information. Mtr can avoid the impact of node fluctuations on the test results, so its test results are more correct, so it is recommended to give priority to use.
Usage instruction
Mtr [- hvrctglspni46] [--help] [--version] [--report] [--report-cycles=COUNT] [--curses] [--gtk] [--raw] [--split] [--no-dns] [--address interface] [--psize=bytes/-s bytes] [--interval=SECONDS] HOSTNAME [PACKETSIZE]
Sample output
[root@centos ~] # mtr 223.5.5.5 My traceroute [v0.75] mycentos6.6 (0.0.0.0) Wed Jun 15 23:16:27 2016Keys: Help Display mode Restart statistics Order of fields quit Packets Pings Host Loss% Snt Last Avg Best Wrst StDev 1. 2. 192.168.17.20 0.0% 7 13.1 5.6 2.1 14.7 5.7 3. 111.1.20.41 0% 7 3.0 99.2 2 7 632.1 235.4 4. 111.1.34.197 0% 7 1.8 2.0 1.2 2.9 0.6 5. 211.138.114.25 0.0% 6 0.9 4.7 0.9 13.9 5.8 6.211.138.114.70 0.0% 6 1.8 22.8 50.8 23.6 211.138.138.134 211.138.114.2 211.138.114.66 7.42.120.244.186 0.0% 61.4 1. 6 1.3 1.8 0.2 42.120.244.198 8. 42.120.244.246 0.0% 6 2.8 2.9 2.6 3.2 0.2 42.120.244.242 9.? 10. 223.5.5.5 0.0% 6 2.7 2.7 2.5 3.2 0.3
Description of common optional parameters
-r or-report: displays the output in report mode.
-p or-split: list the results of each track separately, rather than counting the entire result as-report.
-s or-psize: specifies the size of the ping packet.
-n or-no-dns: do not do domain name resolution for IP addresses.
-an or-address: sets the IP address where the packet is sent. Used when the host has more than one IP.
-4: only IPv4 protocol is used.
-6: only IPv6 protocol is used.
During the operation of mtr, you can also enter the corresponding letters to quickly switch modes. The meanings of each letter are as follows:
? Or h: displays the help menu.
D: toggle display mode.
N: toggle enables or disables DNS domain name resolution.
U: switch to probe using ICMP or UDP packets.
Return the result description
In the default configuration, the data columns in the returned results are described as follows:
The first column (Host): node IP address and domain name. As shown earlier, press the n key to toggle the display.
The second column (Loss%): node packet loss rate.
Third column (Snt): the number of packets sent per second. The default value is 10, which can be specified by the parameter-c.
The fourth column (Last): the last probe delay value.
The fifth, sixth and seventh columns (Avg, Best, Wrst) are the average, minimum and maximum values of the detection delay, respectively.
Column 8 (StDev): standard deviation. The larger the node is, the more unstable the node is.
Traceroute command line tool
Traceroute is a network testing tool pre-installed with almost all Linux distributions to track the path that Internet Protocol (IP) packets take when they are delivered to the destination address.
Traceroute first sends UDP probe packets with a small maximum time-to-live value (Max_TTL), and then listens for ICMP TIME_EXCEEDED responses over the entire link starting from the gateway. The probe starts with TTL=1 and the TTL value increases gradually until an ICMP PORT_UNREACHABLE message is received. The ICMP PORT_UNREACHABLE message is used to identify that the target host has been located or that the command has reached the maximum TTL value allowed to trace.
By default, traceroute sends UDP packets for link probing. You can specify that ICMP packets are sent for probing through the-I parameter.
Usage instruction
Traceroute [- I] [- m Max_ttl] [- n] [- p Port] [- Q Nqueries] [- r] [- s SRC_Addr] [- t TypeOfService] [- f flow] [- v] [- w WaitTime] Host [PacketSize]
Sample output
[root@centos] # traceroute-I 223.5.5.5traceroute to 223.5.5.5 (223.5.5.5), 30 hops max 60 byte packets 1 * 2 192.168.17.20 (192.168.17.20) 3.965 ms 4.252 ms 4.531 ms 3 111.20.41 (111.20.41) 6.109 ms 6.574 ms 6.996 ms 4 111.34.197 (111.34.197) 2.407 ms 2.451 ms 2.533 ms 5 211.138.114.25 (211.138.114.25) 1. 321 ms 1.285 ms 1.304 ms 6 211.138.114.70 (211.138.114.70) 2.417 ms 211.138.114.66 (211.138.114.66) 1.857 ms 211.138.114.70 (211.138.114.70) 2.002 ms 7 42.120.244.194 (42.120.244.194) 2.570 ms 2.536 ms 42.120.244.186 (42.120.244.186) 1.585 Ms 8 42.120.244.246 (42.120.244.246) 2.706 ms 2.666 ms 2.437 ms 9 * 10 public1.alidns.com (223.5.5.5) 2.817 ms 2.676 ms 2.401 ms
Description of common optional parameters
-d uses Socket-level troubleshooting capabilities.
-f sets the size of the survival value TTL of the first detection packet.
-F sets not to identify segments.
-g set source routing gateways. A maximum of 8 can be set.
-I use the specified network card to send the packet. Used when the host has multiple network cards.
-I use ICMP packets instead of UDP packets for probing.
-m sets the size of the maximum survival value TTL of the detection packet.
-n directly use the IP address instead of the host name (disable DNS backchecking).
-p sets the communication port of the UDP transport protocol.
-r ignores the normal Routing Table and sends the packet directly to the remote host.
-s sets the IP address of the packet sent by the local host.
-t sets the TOS value of the detection packet.
-v shows the execution of the instruction in detail.
-w sets the time to wait for the return packet of the remote host.
-x turns on or off the correctness check of the packet.
Analyze link test results
It is based on the following sample diagram of link test results:
Operation steps
Judge whether there are anomalies in each area, and deal with them separately according to the situation of each region.
Area A: client local network, that is, local local area network and local network provider network. In view of the exception in this area and the node problems related to the client local network, please troubleshoot and analyze the local network; for the node problems related to the network of the local network provider, please feedback to the local operator.
Area B: operator backbone network. For an exception in this area, you can query the ownership of the operator according to the exception node IP, and then report the problem to the corresponding operator directly or through Aliyun's after-sales technical support.
Area C: the target server local network, that is, the target host belongs to the network provider network. In view of the exception in this area, the problem needs to be reported to the target host belonging to the network provider.
Combined with Avg (average) and StDev (standard deviation), we can judge whether there are abnormalities in each node.
If the StDev is very high, then synchronously observe the Best and Wrst of the corresponding node to determine whether there is an anomaly in the corresponding node.
If the StDev is not high, the Avg is used to determine whether there is an exception in the corresponding node.
Note: the above StDev is high or not high, and there is no specific time range standard. The relative evaluation needs to be carried out according to the delay value of other columns of the same node. For example, if the Avg is 30 ms, then when the StDev is 25 ms, it is considered a high deviation. If the Avg is 325 ms, then the same StDev (25 ms) is considered to be a low deviation.
Check the packet loss rate of the node. If the Loss% is not zero, there may be a problem with this hop network.
There are usually two reasons for node packet loss:
The ICMP sending rate of the node is artificially limited, resulting in packet loss.
There is indeed an exception on the node, resulting in packet loss.
Determine the cause of packet loss of the current exception node.
If there is no packet loss in the subsequent node, it means that the packet loss of the current node is due to the limitation of the operator policy and can be ignored. As shown in the example diagram of the previous link test results, hop 2.
If packet loss also occurs in the node, it means that there is a network anomaly in the current node, which leads to packet loss. As shown in the example diagram of the previous link test results, hop 5.
Note: the above two situations may occur at the same time, that is, there are both policy speed limits and network anomalies in the corresponding nodes. In this case, if the packet loss occurs continuously on the current node and its subsequent nodes, and the packet loss rate of each node is different, then the packet loss rate of the last few hops usually prevails. As shown in the example diagram of the previous link test results, packet loss occurred at hops 5, 6, and 7. So, in the end, 40% of hop 7 is used as a reference for packet loss.
Confirm whether there is an exception in the node by checking to see if there is a significant delay. Through the following two aspects of analysis:
If the delay increases sharply after a hop, it is usually judged that there is a network anomaly in the node. As shown in the example diagram of the previous link test results, from the subsequent node delay after hop 5, it is inferred that there is a network anomaly on the node of hop 5.
Note: high delay does not necessarily mean that there is an exception in the corresponding node, and large delay may also be caused in the data packet link. It is recommended to analyze it in conjunction with reverse link testing.
The speed limit of ICMP policy may also lead to a sharp increase in latency of the corresponding nodes, but subsequent nodes usually return to normal. As shown in the example diagram of the previous link test results, hop 3 has a 100% packet loss rate and a significant increase in latency. But then the delay of the node immediately returned to normal. Therefore, it is judged that the sharp increase in delay and packet loss of the node is due to the policy speed limit.
Thank you for reading this article carefully. I hope it will be helpful for everyone to share the link testing content through the mtr command line tool under the Linux environment. At the same time, I also hope that you will support more, pay attention to the industry information channel, and find out if you encounter problems. Detailed solutions are waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.