Tcpip (8) Traceroute

Source: Internet
Author: User

1. traceroute can be used to query routes from one host to another.

2. Principles

PingProgramA record routing option is provided, but not all hosts support this option, and the IP header option field can only store up to nine IP addresses. Therefore, it is necessary to develop traceroute.
Traceroute uses the TTL fields of the ICMP message and IP header. TTL is an 8-bit field, which is the router's hop counter and also indicates the datagram lifecycle. Each router that processes the data packet needs to reduce the TTL by one. If TTL is 0 or 1, the router does not forward the datagram. If TTL is 1, the router discards the packet and sends an ICMP timeout packet to the source address (if the host receives a datagram with TTL of 1, the packet can be sent to the upper-layer application ).

At the beginning of the traceroute program, a UDP datagram with the TTL field 1 is sent (an impossible value is selected as the UDP port number), and the TTL is added to 1 each time to determine each vro in the path. Each router returns an ICMP timeout packet (for example, ICMP time exceeded in-transit, length 36) when discarding the UDP datagram ), the host generates an ICMP port inaccessible packet (for example, ICMP 74.125.128.103 UDP port 33492 unreachable, length ).

Send 3 data packets for each TTL and calculate and print the round-trip time. If no response is received within five seconds, an asterisk is printed.

Note that:

(1) The current route cannot be used in the future;
(2) The ICMP packet routing cannot be the same as the UDP datagram sent by the traceroute program;
(3) The source IP address of the returned ICMP packet is the IP address of the router interface that the UDP datagram arrives.

3. Example

# Traceroute 192.168.10.15
Traceroute to 192.168.10.15 (192.168.10.15), 30 hops Max, 60 byte packets
1 192.168.10.15 (192.168.10.15) 5.656 MS 5.662 MS 5.660 MS
# Traceroute www.google.com
Traceroute to www.google.com (74.125.128.103), 30 hops Max, 60 byte packets
1 192.168.0.11 (192.168.0.11) 0.149 MS 0.123 MS 0.104 MS
2 211.101.1.252 (211.101.1.252) 0.477 MS 0.555 MS 0.673 MS
3 124.202.128.89 (124.202.128.89) 0.297 MS 0.282 MS 0.268 MS
4 124.202.11.29 (124.202.11.29) 0.978 MS 1.157 MS 1.276 MS
5 124.202.11.9 (124.202.11.9) 1.486 MS 1.629 MS 1.744 MS
6 219.239.92.193 (219.239.92.193) 1.200 MS 1.164 MS 1.216 MS
7*14.197.246.217 (14.197.246.217) 104.973 MS *
8 221.4.0.162 (221.4.0.162) 106.755 MS 116.940 MS 106.763 MS
9 221.4.0.161 (221.4.0.161) 103.989 MS 114.443 MS 114.565 MS
10 120.80.7.153 (120.80.7.153) 117.309 MS 117.970 MS 118.753 MS
11 120.80.0.61 (120.80.0.61) 117.138 MS 117.105 MS 117.034 MS
12 219.158.14.241 (219.158.14.241) 114.114 MS 114.099 MS *
13 219.158.11.206 (219.158.11.206) 112.492 MS 112.350 MS 112.356 MS
14 219.158.97.2 (219.158.97.2) 113.497 MS 102.978 MS 102.965 MS
15 219.158.3.238 (219.158.3.238) 135.272 MS 146.019 MS 146.003 MS
16 72.14.215.130 (72.14.215.130) 50.959 MS 50.947 MS 50.926 MS
17 209.85.248.60 (209.85.248.60) 70.952 MS 209.85.248.62 (209.85.248.62) 40.450 MS 209.85.248.60 (209.85.248.60) 51.192 MS
18 216.239.43.17 (216.239.43.17) 50.559 MS 39.525 MS 209.85.253.71 (209.85.253.71) 51.180 MS
19 ***
20 hg-in-f103.1e100.net (74.125.128.103) 50.472 MS 50.837 MS 50.605 MS

4. IP Origin Site Selection

This option is set by the sender in two ways:
(1) Strict routing options: only the specified addresses can pass through, not other addresses
(2) loose routing options: specify a list of routes that pass through the datagram.

Example:

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.