These days, with fast internet connections, websites load so quickly, that it looks like we have a direct connection to the website that we're trying to visit.
When you go to a website like bonkersabouttech.com, requests or information from your computer don't just arrive at the destination computer in a single hop.
In fact, it takes a number of computers and/or routers, networked together, to help you receive and transmit information. Requests go through your router initially, through your ISPs router and so on through larger and larger networks, until it finally reaches its destination.
If you want to find out the journeys that your requests take, then you can use a tool called Traceroute, which is bundled as part of your Operating System.
In this blog post I'll go into a bit more detail about what Traceroute is and how it works and then I'll show you how you can do a TraceRoute on Windows 10.
What Is Traceroute?
Put simply, Traceroute is a utility that allows you to find out the precise route that your request took through the Internet as it travelled from your computer to the destination computer. A request could be a Google search for example.
Taking the Google search as our example, Traceroute will compile a list of the routers on the Internet that are involved with your Google search.
Traceroute then identifies each computer/router on that list and also lists the amount of time it took that request to get from one computer/router to the next.
Traceroute can be used for a number of things. One thing you can use it for is for diagnosing network and connectivity issues.
Say for example that you're trying to connect to bbc.co.uk but can connect, yet you're certain the BBC is online, then it could indicate a problem on a network in between your computer and the BBC servers. Traceroute would highlight this for you.
Aside from that, it's just really interesting to look at. By looking at various routes that your requests take, you can begin to build up an understanding of the Internet and its infrastructure.
How Traceroute Works
Let's look at some of the basics.
When you make a request, each IP packet that is sent from your computer to your home router contains a "Time To Live" (TTL) field.
This field doesn't contain a time in seconds, instead it contains the maximum number of routers (hops) that the packet can travel through across the Internet without being discarded.
As the packet travels through a router, the TTL value is decremented until it reaches a value of zero. At this point, the packet is destroyed and a ICMP "time exceeded" message is returned back to the original sender.
If the packet didn't have a maximum TTL number, then the packet would travel forever from one router to another searching for it's destination. The TTL value itself is actually set the operating system.
As an example, say I want to reach google.com and my default TTL value is 30 hops, then the packet can travel through a maximum of 30 routers before the packet is dropped.
Now in order for Traceroute to identify the routers between my computer and Google, the first thing Traceroute does is send out three UDP packets with a TTL value of 1.
Now the first hop would be my home router. The packet would travel from my computer to my home router and the router would decrement the TTL by 1 and so that the TTL value will become zero. The router will then send a TTL exceeded message back to the original sender (Traceroute) and the Traceroute program will then come to know the IP Address and other details about the first hop (my home router).
Next the Traceroute program will send the same packets out again, with the same destination, but this time it will set the TTL value to 2.
It does this so that it will progress one hop further this time. So my home router will decrement it by 1 again, but it will then send it to the next router in the chain, which will be my Internet Service Provider (ISP).
This second router will decrement the TTL by 1 and so the value will be once again be reduced to zero.
Again an ICMP time exceeded message will be sent back to the Traceroute program running on my computer.
This process will continue until either Google (the destination) receives the packet or the maximum number of hops is exceeded before it reaches its destination.
Assuming that the packet reaches it's destination in less than 30 hops, then at that point Google will send back an "ICMP Destination/PORT Unreachable" message back to my computer. The Traceroute program will then stop sending out any further packets because at that point the TTL has not been exceeded and it is now actually trying to access a random port on the destination server.
The "PORT Unreachable" message will always happen because the packet contains a random port between 33434 to 33534 which the destination server won't be listening on.
How To Do A Traceroute On windows 10
Traceroute is often used in conjunction with Ping which is another command-line utility used to detect whether a host is actually present on the network or not.
Traceroute is just as easy to use and is run from a command prompt.
In Windows 10, simply press the Windows Key and start typing "Command Prompt". When you see it in the Start Menu, either click it or press Enter to launch it.
To run Traceroute, type the word tracert followed by a website address.
So, if you wanted to run Traceroute on Bonkers About Tech, you'd run the following command:
tracert bonkersabouttech.com
If you're on a Mac or Linux, then you just type traceroute bonkersabouttech.com instead.
When you run it, you'll start to see the route materialise as your computer starts to receive responses from each router that your packets go through.
Running Traceroute on different websites will give you different results, because each website will be hosted somewhere different in the world.
The first few hops will be the same however as your packet goes through your router and your ISP's routers.
Take a look at my example:
What you can see above is the route that my packets take when they leave my computer and eventually reach my server at bonkersabouttech.com.
So the first line is my home router and the next few lines will be my ISP.
Each line has the following format:
Hop RTT1 RTT2 RTT3 Domain Name [IP Address]
The "Hop" as mentioned above is whenever a packet is passed between routers. So you can see from my example, it took 12 hops to reach the Bonkers About Tech server from my home computer.
The RTT1, RTT2 and RTT3 fields stand for "Round Trip Time" which is the time (in milliseconds) it takes for a packet to travel to a router and back to your computer.
There are three RTT fields because Traceroute actually sends three packets to each hop and therefore you get three Round Trip Times. If you see an asterisk in any one of these columns, that means that you didn't receive a response, which could mean that the packet was lost.
The last bit is the "Domain Name" which will be displayed if it's available, if not, you just get the IP address of the router.
Wrapping Up
Traceroute is great tool and very useful for troubleshooting networks and gaining visibility of Internet providers. So you can actually see who supplies the Internet to your ISP and so on further up the chain.
It's certainly fascinating to what happens to your packets when they leave your computer and traverse the Internet.
I hope this has helped you guys and I hope that you have learnt something. If you've found it useful, let me know in the comments!
Cheers!