What is Traceroute? What to use it for?

81
What is traceroute

When using the Internet, it’s easy to forget that there are many moving parts and servers that help maintain the World Wide Web. Every packet you send, from chat messages to cat photos, must pass through exchanges and servers to reach its destination.

Unfortunately, nothing reminds you of this setup better than when you can’t connect to a website anymore. The cause could be somewhere on your end, on the website’s end, or somewhere in between. And the best way to find out where the problem lies is to use Traceroute.

What is traceroute?

Traceroute is a way to track the routes your data packets take as they move across the Internet. Every modern operating system can track routes.

When you start Traceroute, you tell it which website or server you want to trace the route to. Usually, this is the URL of the website you’re trying to access, but you can also give it an IP address if you want.

Once you have started Traceroute, it will send packets to the destination you set. It will then record the packet’s journey and send the information back to your PC, which will then tell you where they went.

This is really useful if you are trying to find errors online. If the server or exchange is down, Traceroute will crash and report back that something is not working correctly. You can then use this information to more accurately diagnose what’s going on.

How does traceroute work?

Traceroute is a handy way to diagnose network errors. However, Traceroute’s invention is entirely thanks to a clever exploit using the package’s “Time-to-Live” variable.

What is the “Time-to-Live” of the package?
Ideally, when a computer sends a packet from one place to another, it should get there without any problems. It follows the fastest possible path from point A to point B and doesn’t get stuck or obstructed.

Unfortunately, networks can be confusing things. If an engineer makes a mistake setting up a server, packets can be sent in an infinite loop between servers. And if that happens too often, the network can get stuffed with packets that keep cycling around forever.

The clever minds behind data bundling have come up with a solution to fix this, called “Time-to-Live” or “TTL”. Each packet, before being sent to the large unknown region, is given a number greater than 0 for its TTL value. If this value reaches 0, the packet is considered “dead” and dropped.

As the packet is sent on its journey, it stops at many different servers. Every time it reaches the server, it subtracts a TTL value. Typically, this TTL value is set to a number where the packet has enough time to reach its destination before hitting 0. However, if the packet enters a loop, the TTL will eventually decrease until the packet expires.

When a packet expires, the server that terminated the packet sends an “ICMP Time Exceeded” message back to the point of origin. This is essentially a notification that the package has stopped working at the wrong time and tells the user where the package has expired to assist in troubleshooting.

How does the Time-to-Live of the Traceroute enable package work?

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

The server that processes the packet then sends an ICMP Time Exceeded message back to your PC along with its location. The PC will then record the server’s location as the first step towards your goal.

It will then send a packet with the TTL set to 2, 3, etc. until it reaches your destination. Each packet will expire at the next step of its journey, and each server along the way will report the packet as expired, giving your PC the information it needs to know where your packets are going.

What is traceroute used for?

At a basic level, Traceroute allows you to see at a glance how packets move around the network. Whether you’re a network engineer double-checking to see that everything goes as it should, or you’re just interested in how your packets move when you go to Google, Traceroute is the way to go.

However, it is also useful in detecting errors in the system. If Traceroute tries to contact an unresponsive server, it will notice that the packet it sent has not triggered a response for some time. When enough time has passed, Traceroute declares that “Request timed out,” meaning the response did not arrive on time.

Of course, a Request 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 server in the chain will block Traceroute, it’s a good way to diagnose a website or server that’s not responding when you try to connect to it.

What is the difference between Traceroute and Ping?

Technically savvy readers will realize that Traceroute sounds a lot like another handy network tool, Ping. However, although these two features overlap a bit, people use them for different reasons.

As shown above, Traceroute helps you figure out where a packet goes after it leaves your PC. Meanwhile, Ping will tell you whether your PC can reach a specific server and how long it will take to get there.

So if you want to see every part of the network chain, Traceroute is the place to go. Meanwhile, if you just want to see if the server is responding, you can Ping it. It’s true that you can do that with Traceroute too, but you’ll have to wait a while for it to finally reach your server before you get the answer you’re looking for.

How to do Traceroute

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

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

On Windows operating systems, it works the same way, except the function is called “tracert”. 4pcworld.com mentioned tracert and other commands in its guide to wireless network management commands on Windows, so check out the article if you want to learn about the tools.