What Is Traceroute and What Do You Use It For?

What Is Traceroute and What Do You Use It For?

As you use the internet, it’s really easy to forget that there are a lot of working parts and servers that help keep the World Wide Web alive. Every packet you send, from a chat message to a cat photo, has to travel through exchanges and servers to reach its destination.

Unfortunately, nothing better reminds you of this setup than when you can no longer connect to a website. The cause may be somewhere on your side, on the website’s side, or somewhere in-between. And the best way to figure out where the problem sits is by using Traceroute.


What Is Traceroute?


A visual traceroute map
Image Credit: Distrait cognizance/Wikimedia Commons

Traceroute is a way to, well, trace the route your data packets take as they make their way through the internet. Every modern operating system can trace a route.

When you start a Traceroute, you tell it which website or server you want to trace a route to. Normally, this is a website URL that you’re trying to reach, but you can also feed it an IP address if you like.

Once you’ve initiated Traceroute, your system sends packets towards your set destination. It then logs the packet’s travels and sends the information back to your PC, which then shows you where they are going.

This is really handy if you’re trying to find a fault on the network. If a server or exchange is down, Traceroute will encounter the issue and report back that something isn’t working correctly. You can then use this information to better diagnose what’s going wrong.

MAKEUSEOF VIDEO OF THE DAY

How Does Traceroute Work?

Traceroute is a handy way to diagnose network errors. However, did you know that the internet was initially designed without Traceroute in mind?

In fact, Traceroute’s invention is all thanks to a clever exploit. And to better understand how this exploit works, we need to look at a network packet’s “time-to-live.”

What Is a Packet’s “Time-to-Live”?

Ideally, when a computer sends a packet from one place to another, it gets there without any issue. It takes the quickest route it can from point A to point B and doesn’t get stuck or held up.

Unfortunately, networks can be finicky things. If an engineer makes a mistake while setting up a server, it’s possible for packets to be sent in an infinite loop between servers. And if that happens too often, a network can be stuffed full of packets going round and round forever.

The smart minds behind the data packet came up with a solution to fix this, called “time-to-live” or “TTL.” Every packet, before it’s sent off into the great unknown, is given a number greater than 0 for its TTL value. If this value ever hits 0, the packet is deemed “dead” and is destroyed.

When the packet is sent off on its journey, it will make multiple stops across different servers. Every time it arrives at a server, it subtracts one off of its TTL value. Usually, this TTL value is set to a number where the packet has more than enough time to reach its destination before it hits 0. However, if the packet does enter a loop, the TTL will eventually decrement until the packet expires.


When a packet expires, the server it ended in sends what’s called an “ICMP Time Exceeded” message back home. This is essentially a notice that the packet has met its untimely demise and tells the user where the packet expired to aid with troubleshooting.

How a Packet’s Time-to-Live Allowed Traceroute to Work

This ICMP Time Exceeded message is the key to making Traceroute work. To start, Traceroute sends out a packet with a TTL set to 1. This means it leaves your PC, arrives at the first server, subtracts one from its TTL, notices it has a TTL of 0, and expires.

The server handling the packet at the time then sends an ICMP Time Exceeded message back to your PC, along with its location. Your PC then logs the server’s location as the first step toward your target.

It then sends a packet with a TTL set to 2, 3, and so on until the packet arrives at your destination. Each packet will expire on the next step of the passage, and each server along the way will report the expired packet, giving your PC the information it needs to clue in where your packets are going.

What Is Traceroute Used For?

At a basic level, Traceroute lets you take a peek at how packets move around a network. Whether you’re a network engineer double-checking to see everything flows as it should, or you’re just interested in how your packets travel when you visit Google, Traceroute is the way to go.

However, it’s also useful for spotting errors in the system. If Traceroute tries to contact an unresponsive server, it will notice that the packet it sent off hasn’t triggered a reply for a while. Once enough time has passed, Traceroute declares that the “Request timed out,” meaning that the reply failed to arrive in the allotted time.

Of course, a timed-out request doesn’t always mean the server is down; sometimes the server doesn’t like Traceroute requests and blocks them as they come through. But if you’re relatively certain that no servers on the chain should block a Traceroute, it’s a good way to diagnose a website or server that fails to respond when you try to connect to it.


What’s the Difference Between Traceroute and Ping?

Technically adept readers will spot that Traceroute sounds very similar to another handy networking tool, Ping. However, while the two features do overlap a little bit, people use them for different reasons.

As we covered above, Traceroute helps you figure out where a packet goes once it leaves your PC. Meanwhile, Ping tells you if your PC can reach a specific server, and how long it takes to get there.

As such, if you want to see every part of the network chain, Traceroute is where it’s at. Meanwhile, if you just want to see if a server is responding, you can Ping it. Granted, you can do that with Traceroute too, but you’ll have to wait a while for it to finally get to your server before you get the answer you’re looking for.

How to Perform a Traceroute


An example of Traceroute
Image Credit: Michel Bakni/Wikimedia Commons

As we said earlier, all major operating systems can perform a Traceroute. It’s as easy as opening a command terminal and entering the Traceroute command.

For macOS, you just need to open up Terminal and type in “traceroute,” followed by the URL or IP address of the destination. It’s the same on Linux, but you may need to install Traceroute first before you can run it.

On Windows operating systems, it works the same way, except the function is called “tracert” instead of traceroute. We covered tracert and more in our guide on commands to manage wireless networks on Windows, so be sure to give it a read if you’d like to learn about the tools at your disposal.

Tracking Your Packets With Traceroute

If you want to see where your packets go after they leave your PC, Traceroute is the way to go. Whether you want to diagnose a network issue or you’re just curious to see where your packets venture off to, it’s easy to set one up and watch the data go.


Two women looking at a laptop
How to Access Websites That Won’t Load: 5 Methods to Try

It’s frustrating when a site won’t load. Here are some of the reasons, plus a few tricks to access downed websites.

Read Next


About The Author

Original Link

Leave a Comment

Your email address will not be published.

Scroll to Top