Ping Command and tracert command

Source: Internet
Author: User
Ping Command
When we use the ping command to test whether the network is connected, the last output item is generally in the form of TTL = XX. What exactly does TTL represent? TTL is a value in the IP protocol package. It tells the network router package whether the time in the network is too long and should be discarded. There are many reasons that the package cannot be delivered to the destination within a certain period of time. For example, an incorrect route table may cause an infinite loop of packets. Therefore, you need to set such a value in the package. After each packet passes through a node, this value is reduced by 1 and this operation is repeated, which may eventually result in two results: the package reaches the destination when the value is positive or after a certain number of nodes, the value is reduced to 0. The former means that a normal transmission is completed, and the latter means that the package may have chosen a very long path or even a loop. This is obviously not what we expected, therefore, when the value is 0, the network device will not pass the packet, but directly discard it and send a notification to the source address of the packet, saying that the packet has failed to be transmitted. Each operating system may have different TTL initial values. If you want to view the initial values, you can use the ping command to simplify the process:
Ping 127.0.0.1
Ping your own loop address. In this case, the ping packet will return directly, so the TTL value will not be reduced, so the initial value of TTL will be obtained.

Tracert command
The tracert command is used as a routing tracking and diagnosis utility in both dos and Unix systems. It sends Internet Control Message Protocol (ICMP) the echo request and the echo response message generate the command line report output for each vro to trace the path. This program is one of the necessary TCP/IP tools for network management. It is often used to test network connectivity and determine the fault location. This command outputs the router address passing through the packet. When a datagram is transmitted from your computer through multiple gateways to the destination, the tracert command can be used to track the route (PATH) used by the datagram ). The path tracked by this utility is a path from the source computer to the destination. It cannot be guaranteed or considered that the datagram always follows this path.
The diagnostic utility sends an Internet Control Message Protocol (ICMP) ECHO packet containing different TTL values to the target to determine the route used to reach the target. To reduce the TTL value by at least 1 before the data packet is forwarded, each vro on the path is required. Therefore, TTL is a valid hop count. When the TTL on the data packet reaches 0, the router should send the "ICMP timeout" message back to the source system. Tracert first sends an ECHO packet whose TTL is 1, and increases TTL by 1 in each subsequent sending process until the target response or TTL reaches the maximum value to determine the route. The route determines the route by checking the ICMP timeout message sent back by the Intermediate router. However, some routers quietly upload data packets that contain the expired TTL value, but tracert does not.
However, when I perform a test at home, I use the following commands:
Ping www.baidu.com
The returned TTL is 54, and the TTL start value of my computer is 64, that is, the data is forwarded 64-54 = 10 times in the middle.
Use tracert www.baidu.com
The returned address is only the address of the router table. This is very strange..., which means that the first packet sent by the tracert command with TTL = 1 will reach the destination! That is to say, my router repented Of A ICMP-ECHO and not returned ICMP has timed out, so my PC thought the packet has reached the destination address. The reason for this is that I am using a TP-link router, which does not support the tracert command. The router itself does not parse the tracert packet. Therefore, the number of hops in the middle cannot be seen.

Ping Command and tracert command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.