Traceroute Working principle

Source: Internet
Author: User
The simplest basic usage of traceroute is that the traceroute hostname traceroute program is designed to utilize the TTL (Time to Live) field of ICMP and IP headers. First, Traceroute sends out a TTL is 1 IP datagram (in fact, each send out for 3 40 bytes of packets, including the source address, the destination address and packet issued by the time tag) to the destination, when the path of the first router (router) received this datagram, It will reduce the TTL by 1. At this point, the TTL becomes 0, so the router discards this datagram and sends back a "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, Know that this router exists on this path, then traceroute another TTL is 2 datagram, found the 2nd router ... traceroute each time you send a datagram TTL plus one to find another router, This repetitive movement continues until a datagram arrives at the destination.   When datagram arrives at the destination, the host does not send back the ICMP Time exceeded message, as it is already the destination, so traceroute how to know the destination arrived. Traceroute when sending a UDP datagrams to a destination, the port number that it chooses to deliver is one that the general application will not use (more than 30000), so when the UDP datagram arrives at the destination, the host sends back a "ICMP The message of Port unreachable", and when Traceroute received the news, he knew the destination had arrived.   So there is no daemon program on the server side of Traceroute. traceroute extracts the IP address of the ICMP TTL expiration message device and makes a domain name resolution.   Each time, the traceroute prints out a series of data, including the domain name and IP address of the routed device it passes through, and the three packets take time to go back and forth every time. Traceroute has a fixed time wait response (ICMP TTL expiration message). If this time elapses, it will print out a series of * numbers indicating that, on this path, the device cannot emit the response of an ICMP TTL expiration message within a given time. Traceroute then adds 1 to the TTL register and continues.

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.