Using traceroute

If you're trying to diagnose a misbehaving network or you're just plain curious about what machines handle your requests to the internet, you might be interested in a tool called traceroute.

The traceroute tool is built into almost all Linux systems, and if it doesn't ship by default you can usually install it by simply heading to your package manager and finding the traceroute package.

It's really easy to use. Simply run traceroute with the hostname or IP address you want to trace the route to. Try it with fosswire.com.

$ traceroute fosswire.com

You should get an output something like this (obviously yours will be different because of your local network and/or ISP setup):

1 192.168.1.1 (192.168.1.1) 0.729 ms 1.369 ms 1.352 ms
2 he-0-llu.as9105.net (212.74.111.195) 50.434 ms 52.946 ms 55.861 ms
3 ge4-3-34.he-lon1.as9105.net (212.74.106.142) 59.389 ms 61.495 ms 64.932 ms
4 * * *
5 so-6-1-0.ams22.ip.tiscali.net (213.200.81.94) 83.176 ms 85.754 ms so-1-0-0.ams22.ip.tiscali.net (213.200.80.18) 89.267 ms
6 ge3-12-1000M.ar2.AMS1.gblx.net (64.215.195.209) 101.859 ms 39.486 ms 39.631 ms
7 146.82.32.58 (146.82.32.58) 170.763 ms 173.981 ms 176.658 ms
8 apache2-zoo.bart.dreamhost.com (208.113.149.33) 181.201 ms 184.019 ms 187.185 ms

Each entry in the list is one of the machines your packet bounced through to get to the final destination. As you can see, for me it starts off with a local IP address, 192.168.1.1, which is the router on my LAN. Then it goes out through my ISP and bounces through a couple more locations before arriving at the destination server at the bottom.

You may notice that line 4 has no information. The way traceroute works is sort of hacky - I think it involves setting the time-to-live for packets to really low values in order to get a response back from the machines in between. It doesn't always work for every one however.

If you do get blank rows, you could always try running traceroute again a couple of times if you're desperate for the information.

There are numerous occasions where the traceroute tool can come in really handy, so it's always a good thing to have in your CLI troubleshooting toolbox when your network starts playing up!

Avatar for peter Peter Upfold - http://peter.upfold.org.uk/

Peter Upfold is a technology enthusiast from the UK. Peter’s interest in Linux stems back to 2003, when curiosity got the better of him and he began using SUSE 9.0. Now he runs Linux Mint 9 on the desktop, runs a CentOS-based web server from home for his personal website and dabbles in all sorts of technology things across the Windows, Mac and open source worlds.

Home » Articles »

Discussion: Using traceroute

Home » Articles » Using traceroute