# Like ‹ping›, ‹traceroute› sends out ICMP echo request packets. # However, unlike ‹ping›, it also sets the TTL field in the IP # header -- short for Time To Live. This number is decremented by # each router along the way, and the packet is thrown away when its # TTL drops to 0. The router doing the dropping also helpfully sends # back an ICMP ‘time to live exceeded’ packet. # Someone clever noticed that you can send ICMP echo request with # TTL set to 1 to learn the address of the first router along the # way to the destination, then set TTL to 2 to learn about the # second closest one, and so on. This is what ‹traceroute› does, and # it prints information about each of the hosts it encounters. Let's # try it on the trio of computers we pinged earlier: # By default, ‹traceroute› tries to find a hostname for each IP # address. But we don't know enough about DNS to worry about that # yet. So we just ask it to print numeric addresses, using ‹-n›. traceroute -n 1.1.1.1 traceroute -n 8.8.8.8 traceroute -n 4.2.2.2 # Now that we tried both ‹ping› and ‹traceroute›, let's try some DNS # queries. See ‹host.sh›.