The Traceroute program allows us to see the route that an IP datagram passes from one host to another, and can use the IP source routing option. Traceroute replaces IP RR 1 not all routers support the IP RR option, and traceroute programs do not require intermediate routers to have any special or optional features. 2 logging routing is generally a one-way option. The sender sets this option, and the receiving end has to extract all the information from the received IP header and return it all to the sending end. This makes the recorded IP address one more times (one at a time). The Traceroute program only requires the destination to run a UDP module, others do not require any special server applications. The 3 IP header has limited space for the RR option, not enough to store the current majority of the path.traceroute principleTraceroute records the route of the path through ICMP "timeout" and "Port unreachable" messages. Use the timeout message to record the routed route: The datagram Header TTL field sent by the Traceroute program is set to a 8bit field by the sender. Each router that processes datagrams needs to reduce the value of the TTL by 1 or less 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-counting counter, reducing its value by 1 per router. When the router receives an 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 that receives this datagram is the destination host, which is directly handed over to the application. 2 The receiving host is not the destination host, discards it directly, and sends an ICMP timeout message to the sender. The key to the routing of the Traceroute program record is that the source address of the IP message containing the ICMP information is the IP address of the inbound interface of the router. Use the "Port unreachable" message to determine whether to reach the destination host: 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 cannot be used by any of the applications of the destination host. Therefore, when the datagram arrives, the UDP module of the destination host is produced with a "Port unreachable" error ICMP message. Traceroute program to do is to distinguish between the received ICMP error message is "timeout" or "Port unreachable" to determine when the end of the time.traceroute Sample 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 msec 2 192.168.1.2 144 msec msec 160 msec 3 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 processed the datagram R2 the TTL value by 1, then discards the datagram and returns a timeout ICMP message. The sender then obtains the address 172.16.0.2 (inbound interface address) of the first router R2 in the path, and marks the R2 as the first hop of the path. 2 R1 sends a TTL field of 2 IP datagram to the destination host R4, after R2, the TTL field is reduced by 1 and forwarded to R3. R3 received an IP datagram to reduce the TTL field by 1 and then return a timeout ICMP message. This gives the address 192.168.1.2 of the second router R3 in the path and marks 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 arrival of R4, the IP datagram to the R4 module produced an ICMP "Port unreachable" error message sent to the source. The traceroute process ends at this time. SVR4% traceroute slip traceroute to Slip (140.252.13.65), hops max, 40byte packets 1 bsdi (140.252.13.3 5 20ms 10ms 10ms 2 slip (140.252.13.65) 120ms 120ms 120ms//host name, IP address, 3 datagram round-trip time output 1th No label line gives the destination host name and its IP address, indicating that the maximum TTL value is 30. 40-byte datagram contains 20-byte IP header, 8-byte UDP Header and 12-byte user data (serial number, TTL copy, time to send datagram) 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. Each time an ICMP message is received, it calculates and prints a round-trip. If you have not received any of the 3 datagrams in 5 seconds, print a * number and send the next datagram. The destination host's port number is initially set to 33435, each sending a datagram plus 1. You can change the starting port number by using command-line options. When the router minimizes the TTL value to 0 o'clock, it sends back the ICMP message "Delivery 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, which have different code fields in their ICMP messages. ICMP error messages are formatted as follows: The ICMP message we are discussing is generated when the TTL value is 0, and its code field is 0. A timeout may occur when the host is assembling a fragment. At this point it will send a "assembly message timeout" ICMP message. This error message adds the Code field to 1.traceroute Attention MattersFor situations 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 only processes the messages that send the answer to itself. 1 does not guarantee that the current route is the route to be used in the future. Even two consecutive IP datagrams may take a different route. 2 The routing of ICMP packets is not guaranteed to be the same route as the UDP datagram sent by the traceroute program. This indicates that the round-trip time that is printed may not really reflect the timing of the datagram's issuance and return. (If the UDP datagram is 1 seconds from the source to the router, and the ICMP message uses another route to return the source in 3 seconds, the round-trip time is 4 seconds.) 3 The source IP address in the ICMP message returned is the IP address of the router interface to which the UDP datagram arrives. This is different from the IP RR option, where the recorded IP address refers to the inbound interface address. Because each defined router has multiple interfaces, the results of running the Traceroute program from A to B and from B to A may be different.IP Source Station route optionsTypically, IP routing is dynamic, that is, each router has to decide which router to forward to under the datagram. Applications do not control this, and often do not care about routing. The idea of source station selection is that the sender specifies the route. It can take two ways: 1 strict source Routing (LSRR) senders indicate the exact route that IP datagrams must take. If a router discovers that the next router specified by the source route is not on its directly connected network, it returns a "source station routing Failure" ICMP message. 2 the Loose source station routing (SSRR) sender indicates the list of IP addresses that a datagram passes through, but the datagram can pass through another router between any of the two addresses indicated on the list. Source Station Routing Options format: This format is basically consistent with the IP RR option format. The difference is that we have to populate the IP address list before sending an IP datagram for the source station route. For record routing options, you need to allocate and empty some space for the IP address manifest, and have the router populate the items in that list. The value of the Code field of the relaxed source-station route is 0x83; the value of the strict source-station route is 0x89.Extended traceroute OptionsR1#traceroute Protocol [IP]://Specify protocol type target IP address://///////////Specify Source address Numeric display [n]:// Digital display Timeout in seconds [3]://Set timeout time. The default is 3 seconds Probe count [3]://number of UDP packets sent. The default is 3 Minimum time to Live [1]://Set minimum TTL value. The default is 1 Maximum time to Live [30]://Set maximum TTL value. The default is port number [33434]: The destination port for the//UDP message. Defaults to 33434 Loose, Strict, Record, Timestamp, Verbose[none]://option function. You can specify any combination.