Network troubleshooting always begins with a few command line techniques. Traceroute is one of the basic utilities to learn. In this document, I will go over how to do this.
Troubleshooting a network issue almost always begins with the ping utility. The reason for this is that it tells you if there is a path to begin with. The path is your system to some remote system.
Next, you will usually run traceroute to see how packets are arriving. You are looking to see what path they take. This is important and can give you important information. While traceroute is an old utility, it works very well. It requires root permissions, so make sure you have those available for your experiments.
Traceroute is very flexible, and you can use several protocols with it. It is very easy to get started using it. You can send TCP, UDP, and ICMP packets.
Using traceroute is straightforward. The following command is the most basic usage.
Each line in its output is a distinct hop or router to pass through. You want to make sure it has as few hops as possible. If you are connecting to something a few miles away, your hops should not be all over the country. This means there is something down and you are not being routed correctly.
On these same lines, you will also see the names of routers along its path and the time it took data to arrive.
Now, let us try the command again.
There will be a lot of output this time. Each line is numbered and represents the number of hops it has to take to reach its destination. The next column says how long each hop took. At the end of each line, you get the IP address of each router.
When using traceroute, know that it has many options. You can customize your tests with all these options to suit your needs.
This is the first option you should use to get familiar with this nice command.
You can use the -4 option to specify only IPv4.
Traceroute -4 18.104.22.168
The -v option is another one that is very useful. It just gives you extra information, and that is always nice.
Traceroute -v 22.214.171.124
Traceroute is a great tool. I say this because it has been around for a long time and it is very functional. With all the options it has, you can customize your network tests a lot. We find it in all major operating systems and is one of the first tools you should look to when you have network issues.