network tracert tracerout - ghdrako/doc_snipets GitHub Wiki

tracert nazwadomeny.pl

Linux:

traceroute www.blarneycastle.ie
traceroute -n blarneycastle.ie  # Hiding Device Names
traceroute -w 7.0 blarneycastle.ie # extend the default timeout period (five seconds) to 7s
traceroute -q 1 blarneycastle.ie #  To speed up the traceroute test - reduce the number of UDP probe packets we send to one

Setting the Initial TTL Value

We can set the initial value of TTL to something other than one, and skip some hops. Usually, the TTL values are set to one for the first set of tests, two for the next set of tests, and so on. If we set it to five, the first test will attempt to get to hop five and skip hops one through four.

Because we know the Blarney Castle website is 11 hops from this computer, we type the following to go straight to Hop 11:

traceroute -f 11 blarneycastle.ie

traceroute uses the TCP/IP suite of protocols, and sends User Datagram Protocol packets. The header contains the Time to Live (TTL) field, which contains an eight-bit integer value. Despite what the name suggests, it represents a count, not a duration.

A packet travels from its origin to its destination via a router. Each time the packet arrives at a router, it decrements the TTL counter. If the TTL value ever reaches one, the router that receives the packet decrements the value and notices it’s now zero. The packet is then discarded and not forwarded to the next hop of its journey because it has “timed out.”

The router sends an Internet Message Control Protocol (ICMP) Time Exceeded message back to the origin of the packet to let it know the packet timed out. The Time Exceeded message contains the original header and the first 64 bits of the original packet’s data. This is defined on page six of Request for Comments 792.

So, if traceroute sends a packet out, but then sets the TTL value to one, the packet will only get as far as the first router before it’s discarded. It will receive an ICMP time exceeded message from the router, and it can record the time it took for the round trip.

It then repeats the exercise with TTL set to 2, which will fail after two hops. traceroute increases the TTL to three and tries again. This process repeats until the destination is reached or the maximum number of hops (30, by default) is tested.