Traceroute summary come from CSDN Author:houdong

Source: Internet
Author: User

The Traceroute program allows us to see the routes that the IP datagram passes from one host to another, and can use the IP Source Station routing option.

Traceroute the reason for replacing IP RR 1 not all routers support the IP RR option, while the Traceroute program does not require any special or optional functionality from the intermediate routers. 2 record routing is generally a one-way option. The sending side sets this option, and the receiving side has to extract all the information from the received IP header and then return it all to the sending side. This makes the recorded IP address one more time (one back). The traceroute program only needs to run one UDP module on the destination side, and the other does not require any special server applications. The 3 IP header leaves the RR option in a limited space, not enough to store most of the current paths. traceroute principleTraceroute routes through the ICMP "timeout" and "Port unreachable" messages. Use a "time-out" message to record a routed route: The datagram header of the Traceroute program the TTL field is set by the send side to a 8bit field. Each router that processes datagrams needs to reduce the TTL value by 1 or subtract the number of seconds the datagram stays in the router. Since most routers forward datagrams have a delay of less than 1 seconds, the TTL eventually becomes a hop counter, minus 1 of its value per router. When the router receives a copy of the IP datagram, if its TTL field is 0 or 1, the router does not forward the datagram. Typically, the system does not receive datagrams with a TTL value of 0. 1 The host receiving this datagram is the destination host, which is delivered directly to the application. 2 The receiving host is not the destination host, discards it directly, and sends an ICMP timeout message to the sending end. The key to the route that the Traceroute program records is that the source address of the IP message that contains the ICMP information is the IP address of the inbound interface of the router. Use the "Port unreachable" message to determine if the destination host is reached: The Traceroute program sends a UDP datagram to the destination host. However, it chooses an impossible value as the UDP port number (greater than 30000), which is unlikely to be used by any application of the destination host. Therefore, when the datagram arrives, it causes the UDP module of the destination host to generate a "Port unreachable" error ICMP message. The traceroute program is to distinguish whether the received ICMP error message is "timed out" or "Port unreachable" to determine when the time is over. traceroute Example  R1#traceroute 10.0.0.2 type escape sequence to abort. Tracing the route to 10.0.0.2 1 172.16.0.2 msec msec 144 msec2 192.168.1.2 144 msec 288 msec msec3 10.0.0.2 msec * 288 MSEC    1 R1 sends an IP datagram with a TTL field of 1 to the destination host R4. The first router that handles this datagram R2 decrements the TTL value by 1, discards the datagram, and returns a time-out ICMP message. The sender then obtains the address 172.16.0.2 (inbound interface address) of the first router in the path R2, and marks the R2 as the first hop of the path. 2 R1 sends an IP datagram with a TTL field of 2 to the destination host R4, which, after R2, forwards the TTL field to R3 when it is reduced by 1. R3 receives an IP datagram that drops the TTL field by 1 and returns a time-out ICMP message. This gets the address 192.168.1.2 of the second router in the path, R3, and marks the R3 as the second hop of the path. 3  continue this process, R1 send a TTL field of 3 IP datagram to the destination host R4, when the R4 is reached, the IP datagram causes the R4 module to generate an ICMP "Port unreachable" error message sent to the source. The traceroute process ends at this point.  svr4% traceroute Sliptraceroute to slip (140.252.13.65), Hops max,40byte packets1 bsdi (140.252.13.35) 20ms  10ms 10ms2 slip (140.252.13.65) 120ms 120ms 120ms//  host name, IP address, The 1th non-marking line of the round-trip time output of 3 datagrams gives the destination hostname and its IP address, indicating that the maximum TTL value is 30. The 40-byte datagram contains a 20-byte IP header, a 8-byte UDP header and 12 bytes of user data (serial number, TTL copy, time to send datagrams), and the next two lines of output begin with the TTL, followed by the host or router name and its IP address. For each TTL value, 3 datagrams are sent. The round trip time is computed and printed for each ICMP message received. If theNo response from 3 datagrams has been received within 5 seconds, A * number is printed and the next datagram is sent. The port number of the destination host is initially set to 33435, with one datagram per send plus 1. You can change the starting port number by using command-line options. When the router decrements the TTL value to 0 o'clock, it sends back the ICMP message "Transmit timeout". Even if the discarded IP message is sent to the destination, the router sends back the ICMP message.   ICMP super-times Text FormatThere are two different ICMP hyper-times, and the code fields in their ICMP messages are different. The format of the ICMP error message is as follows: The ICMP message we are discussing is generated when the TTL value is 0 and its code field is 0. The host may have timed out when assembling shards. It will then send an ICMP message with the "assembly message timeout". This error message resets the Code field to 1. traceroute PrecautionsFor cases where the traceroute program is run multiple times on the same host, each process looks at the source port number of the UDP header returned by ICMP and handles only those messages that send an answer to itself. 1 There is no guarantee that the current route is also the future route to be adopted. Even two consecutive IP datagrams may have different routes. 2 There is no guarantee that the routing of ICMP packets takes the same route as the UDP datagram sent by the traceroute program. This indicates that the printed round-trip time may not really reflect the timing of the datagram issue and return. (If the UDP datagram is 1 seconds from the source to the router, and the ICMP message returns the source with another route for 3 seconds, the printed round trip time is 4 seconds.) 3 The source IP address in the returned ICMP message is the IP address of the router interface to which the UDP datagram arrives. This differs from the IP RR option in that the logged IP address refers to the inbound interface address. Because each defined router has more than one interface, the results from A to B and from B to a may be different from the Traceroute program. IP Source Station Routing optionsUsually IP routing is dynamic, that is, each router must determine which router the datagram is forwarded to. The application does not control this, and usually does not care about routing. The idea of source station routing is that the sender specifies the route. It can be used in the following two ways: The 1 strict source routing (LSRR) sender indicates the exact route that the IP datagram must take. If a router discovers that the next router specified by the source route is not on its directly connected network, it returns an ICMP message with "Source Station routing Failure". 2 Loose Source Station routing (SSRR) The sender indicates a list of IP addresses passed by the datagram, but the datagram can be routed through other routers between any two addresses indicated on the list. Source Station Routing option format: This format is basically the same as the IP RR option format. The difference is that for source station routing, we must populate the IP address list before sending the IP datagram. For the Record routing option, you need to allocate and empty some space for the IP address list and have the router populate the items in that list. The value of the Code field for the loose source station routing is 0x83; the strict source station routing value is 0x89. Extended traceroute OptionsR1#tracerouteprotocol [ip]://Specifies the protocol type target IP address://the destination address associated with the specified protocol source address://Specifies the source address numeric display [n]:// The number shows the timeout in seconds [3]://setting time-out. The default is 3 seconds probe count [3]://sends the number of UDP packets. The default is 3 minimum time to Live [1]://sets a minimum TTL value. The default is 1Maximum time to Live [30]://sets the maximum TTL value. The default is 30Port number [the destination port used by the 33434]://UDP message. The default is 33434Loose, Strict, Record, Timestamp, verbose[none]://option function. You can specify any combination.

Traceroute summary come from CSDN Author:houdong

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.