From Hackepedia
Jump to: navigation, search

Traceroute is a program to trace the routers between two computers on the Internet. The original program was written by Van Jacobson. It uses raw sockets to output and receive UDP and ICMP packets. It is prone to faulty data and should not be trusted completely.

In Windows: Start - Run -> Command and the in the terminal you can use "tracert" which is close as you'll get to equivalent.

In detail and in the default mode traceroute outputs UDP packets on a high UDP port (starting at 32768 + 666) and incrementing the port number by one per packet sent. The packet includes a timestamp (obscured in OpenBSD) and the IP Time-to-live starts at 1 and increments by one every three packets. At each router that the packets reach with the Time-to-live of 1 an ICMP Time Exceeded (type 11) message is sent back (see RFC 791 page 6).

Another mode for traceroute is to use the ICMP protocol instead of the UDP packets. The ICMP type used is 8 (ECHO REQUEST) (see ping). In ICMP mode no ports are used since the protocol does not support it.

A sample traceroute:

$ traceroute
traceroute to (, 64 hops max, 40 byte packets
1  * * *
2 (  46.601 ms  46.218 ms  47.653 ms
3 (  46.621 ms  45.928 ms  46.692 ms
4 (  45.956 ms  47.142 ms  46.439 ms
5 (  68.83 ms  66.141 ms  66.159 ms
6 (  67.817 ms  66.317 ms  65.847 ms
7 (  142.317 ms  140.801 ms  142.35 ms
8 (  139.271 ms  139.238 ms  141.776 ms
9 (  139.534 ms  140.229 ms  141.74 ms

Routers which firewall traceroute packets (either by protocol or by Time-to-live) appear as a *. In FreeBSD a STEALTH mode can be turned on which prevents a forwarded packets TTL to be decremented by one causing no ICMP Time Exceeded message to be sent causing the computer to be omitted in a traceroute.

mtr combines the functionality of the traceroute and ping programs in a single network diagnostic tool. There are also several GUI versions of traceroute available that will include the geographic position of each host (although the accuracy of that feature is questionable).

In IPv6 the BSD traceroute the concept is exactly the same, with the UDP port numbers, as the IPv4 implementation. The main difference is that the protocol uses a 'hop limit' instead of a time to live (ttl). A sample traceroute6 looks like this:

margaret$ traceroute6 
traceroute6 to (2001:4860:a003::68) from 2001:a60:f074::2, 64 
hops max, 12 byte packets
1  * uranus  0.392 ms  0.214 ms
2  63.686 ms  44.845 ms  44.629 ms
3  2001:a60:0:30::1  45.105 ms  45.199 ms  45.668 ms
4  2001:4860::23  67.845 ms  54.864 ms  55.502 ms
5  2001:4860:a003::68  52.851 ms  54.862 ms  54.491 ms