When your web site or app is down or running particularly slowly, it sometimes helps to know if there is a bottleneck along the path from your device to the server where the site or app resides. This can be done pretty quickly on many operating systems, such as Linux and Windows, using the traceroute command from a terminal console on the operating system.
What does traceroute do?
The traceroute command can be run on a source device such as a computer or a host. Once run, traceroute will send IP (Internet Protocol) packets toward the specified destination host. These packets will contain TTL (Time To Live) values. These start at 1 and increment up, unless a router in the path decrements it.
When a route in the path finds that the TTL value in the packet is 1, it will send a response with a “time exceeded” message. If traceroute receives a “time exceeded” message, it knows that this router is in the middle of the path to the destination host, and thus this router is passed through as a “hop” on the way to the specified destination.
The goal is to eventually find a router that continues to increment the TTL value, which will finally result in an attempt to access an invalid port on the destination host. When this happens, traceroute will receive “port unreachable” messages, which indicate that the destination has been reached.
As traceroute moves along each hop, it records the address of each router and the time it took to traverse the hop. If one of these hops is really slow or fails to respond, you can determine that the bottleneck is located at the slow or down hop, which means the destination host is most likely operating as expected. This can be helpful in determining how you need to respond to such an incident, as there may actually be no problems with your site or app directly.
How to use traceroute
The command can vary between operating systems, so you may need to check your OS to be sure what command to type. For example, Linux systems use traceroute, while Windows uses a shorter version, tracert.
To use the command, you simply open a terminal in the operating system you are using, such as a Windows Command Window. Once open, you type the traceroute command followed by the address of the host you are trying to reach. The command will then go through each hop, displaying the key host address and amount of time taken as it goes through each hop.
As an example, here is an example of what this might look like if the command is run on a Windows system:
C:>tracert wikipedia.com
Tracing route to wikipedia.com [208.80.153.224] over a maximum of 30 hops:
1 324 ms 3 ms 3 ms 192.168.43.1
2 54 ms 43 ms 35 ms 10.160.169.176
3 67 ms 39 ms 36 ms 10.170.207.5
4 66 ms 40 ms * 10.170.207.11
5 77 ms 33 ms 33 ms 10.164.163.20
6 81 ms 26 ms 40 ms 10.164.165.123
7 83 ms 28 ms 48 ms ae0.mpr1.iah4.us.above.net [208.185.107.9]
8 67 ms 35 ms 40 ms ae7.cr1.iah1.us.zip.zayo.com [64.125.31.136]
9 102 ms 46 ms 56 ms ae27.cs1.iah1.us.eth.zayo.com [64.125.30.238]
10 84 ms 59 ms * ae5.cs1.dfw2.us.eth.zayo.com [64.125.28.99]
11 51 ms 55 ms 62 ms ae27.cr1.dfw2.us.zip.zayo.com [64.125.30.181]
12 72 ms 39 ms 61 ms xe-0-1-0.mpr1.dfw78.us.zip.zayo.com [64.125.27.229]
13 81 ms 59 ms 60 ms 64.125.129.70.IPYX-125449-003-ZYO.zip.zayo.com [64.125.129.70]
14 103 ms 59 ms 58 ms text-lb.codfw.wikimedia.org [208.80.153.224]
Trace complete.
Monitoring with Morpheus
Do you want to be notified when your site or app is having issues? If you are looking for a monitoring system with excellent data logging and analysis reports, you should give Morpheus a try. With Morpheus, data logging is automatic as you provision servers and apps. Using the available tools, you can monitor the various parts of your system to keep track of uptime, response time, and to be alerted if an issue does arise.
The Morpheus interface is clean and easy to use. Source: Morpheus.
Morpheus allows you to provision apps in a single click, and provides ease of use for developers with APIs and a CLI. In addition, backups are also automatic, and you can have redundancy as needed to avoid potentially long waits for disaster recovery to take place. So, why not register an account or try out Morpheus for free today?