What is TraceRoute?
The TraceRoute command uses the ICMP protocol to locate all routers between your computer and the target computer. The TTL value can reflect the number of routers or gateways that the data packet passes through, by manipulating the number of independent ICMP call messages. TTL value and return information to observe that the packet was discarded.
TraceRoute principle
The simplest basic usage of Traceroute is: traceroute hostname
The Traceroute program is designed to use the TTL (Time) of ICMP and IP header To Live field. First, traceroute sends an IP datagram with a TTL of 1 (actually, three 40-byte packets are sent each time, including the source address, destination address and time stamp of the packet sent) to the destination. When the first packet on the path When a router receives this datagram, it decrements the TTL by 1. At this time, the TTL becomes 0, so the router will discard this datagram and send back an "ICMP time exceeded" message (including the source address of the IP packet, all the contents of the IP packet and the IP address of the router), traceroute After receiving this message, we know that this router exists on this path, and then traceroute sends another datagram with a TTL of 2, and finds the second router... traceroute adds 1 to the TTL of the datagram sent each time. to discover another router, and this repeated action continues until a certain datagram reaches its destination. When the datagram reaches the destination, the host will not send back the ICMP time exceeded message because it is already the destination. So how does traceroute know that the destination has been reached?
When Traceroute sends UDP datagrams to the destination, the port number it chooses to deliver is a number that is not used by general applications (above 30000), so when the UDP datagram reaches the destination, it The host will send back an "ICMP port unreachable" message, and when traceroute receives this message, it will know that the destination has been reached. Therefore, traceroute does not have a so-called Daemon program on the server side.
Traceroute extracts the IP address of the device that sent the ICMP TTL expiration message and performs domain name resolution. Each time, Traceroute prints out a series of data, including the domain name and IP address of the routing device it passes through, and the time it takes for each of the three packets to go back and forth.
Traceroute has a fixed time to wait for a response (ICMP TTL expiry message). If this time has passed, it will print a series of * signs to indicate that the device on this path cannot respond with an ICMP TTL Expired message within the given time. Traceroute then adds 1 to the TTL counter and continues.
Gateway
Generally, Traceroute (or Tracert) is based on a host, but usually you can only know to use the host at hand as the source address to any online server on the Internet. The host's routing connection quality and data transmission efficiency. Using the WEB-based method, as long as a host has a specific CGI program installed, users can run related programs through this host to perform Traceroute functions. We call this host the Traceroute gateway. Traceroute gateway can help users understand the topology of the network's physical and logical connections and the efficiency of data transmission. If there are enough such gateways, we can easily understand the connections between hosts.
Function
Traceroute was originally a small program written by Van Jacobson in 1988. At that time, it was mainly to solve some network problems that he encountered. Traceroute is an important tool for correctly understanding IP networks and understanding routing principles. Their Webmaster, which is responsible for network engineering technology and system management, is an easy-to-use program.
For ISPs, setting up Traceroute gateways will enable network service providers to help users establish and maintain confidence in the service quality of service providers. ISPs with high service quality can set up Traceroute gateways to let users understand the efficiency of their network connections and data transmission. Of course, ISPs with poor infrastructure and low service quality are afraid of providing this kind of service. Because, users can use this tool to understand the service provider's network connection status.
After installing the relevant Traceroute CGI program on a host, you can enter the IP address or name of the corresponding destination host to get the relevant data.
Recommended tutorial: "PHP Tutorial"
The above is the detailed content of What is TraceRoute?. For more information, please follow other related articles on the PHP Chinese website!