smartsub.co

Learn everything about the Tech World!

Category Archive : Commands

How to use the Traceroute command to diagnose IP routing problems?

Among the many commands you have built-in in your operating system (OS), there is one that helps you see each point of the path of the data packets from your device to its destination, and it is called the Traceroute command. It is a useful diagnostic tool for checking IP routing problems.

​What is the Traceroute command?

The Traceroute command is software with a command-line interface, and you can use it to troubleshoot network problems. You can use it for these specific purposes: 

  • To see the complete route of data packets from your device to the target that you have chosen. That will open your eyes to each router/hop that the packets pass through. 
  • To see the time it takes for a complete route from your device to the target. You could see if it is within the norms. 
  • Identify the devices that your packets pass through. Most of them will be visible with their IP address and hostname. 
  • To find the bottleneck. You can see a particular hop that is responding too slow, or it is not responding at all. The Traceroute command can serve you to show you this problematic spot. That step could have a problem that you can further check by other tools.

​Understanding the Traceroute command

The Traceroute command has the following syntax:

traceroute [options] host_Address [pathlength] (Linux)

1. First, you start with the name of the command that you want to use. In our case, it is the “traceroute”.

2. Second, we can add an option for a more specific query. You have many choices like using IPv6, use another protocol for the data packets, change the waiting period, change the total number of packets sent, forbid fragmentation, maximum hops, and more. You can see the whole list of options with the following command, written inside the Terminal:

traceroute -help

3. The third will be the target of your query. You can use a hostname like your site’s domain name, or you can use an IP address like the address of your server.

​How to use the Traceroute command and to read the results

So, let’s just trace the route to Google.com

traceroute google.com

What you will see is an answer that is devised in a few columns. The first will show the hops it takes to reach the target. The second will show the IP addresses of those hops. And the last part will show each of the ping messages that the traceroute have sent, with the time they took. 

Now you have a good picture of all the hops that the query takes. You can see if there are any particular delays on the route, and you know between which two devices the problem is occurring. 

​Problems with the Traceroute command that you could experience. 

Sometimes you could have some problems with the command and have some data missing. 

​Request timed out.

This message could appear because: 

  • the target that you are checking is down and can’t respond. 
  • The command is disabled on a gateway.
  • The firewall is blocking the request. 
  • A connection problem. 

​An asterisk sign (*) in the result. 

  • A packet has been lost.
  • The particular router is discarding the packet on purpose. 

​Abnormal round trip time.

You can see an abnormal round trip time between different hops, where there is a very low number on one and higher on another. Repeat the command a few times to see if these numbers are consistent. The routers treat the ping messages as a low-priority process, and sometimes they process it later. This might be the reason. You can investigate further to see what the problem is. 

​Ping command basics for testing your network

The ping command might seams too basic for many people, but it is still around, and there is a reason for that. It is one of the fastest and easiest ways to find out if a particular device is connected. Just ping it, and in a matter of moments, you will see a clear answer. 

​What is the Ping command? 

The Ping command is a command that you can find on various Oses, including Windows, Linux, macOS, FreeBSD, and more. It serves to check if there is a direct connection between your device (the origin of the command) and the target (the IP address or domain name of the one you want to check). It uses Internet Control Message Protocol (ICMP) packets that it sends to the target. The target should receive them and answer back with echo messages. The echo message travels back to the origin and shows a statistic that includes the time it took to reach the target and if there were any lost packets. 

​How to use it? 

On Windows devices, there are two ways to use the Ping command – through the Command Prompt or through the Windows PowerShell. 

On macOS and Linux, you can use it through the Terminal application. 

​What can you test with the Ping command? 

  • See if a particular device like your server is connected at the moment. If it is reachable, that means there is a connection between you and the target.
  • See if the target responds fast enough. You can check the target on a regular basis and write it down. If the target responds slower than usual, there might be a problem that you can further explore. 
  • You can check different parts of the network and see if there is a bottleneck. 
  • Keep the Ping command constantly on so you can monitor the target constantly. This can be used with your server so you can be sure it is working normally. 

​Examples of the Ping command

No matter the OS and the Software you are using (Command Prompt, Terminal, etc.), you can ping a target using their domain name or their IP address. 

ping www.google.com

ping 172.217.169.142

​How to get additional options for the Ping command? 

There are many more options that you can use with this command. You can adjust the number of the pings sent, set an interval between them, extend or shorten the TTL, and more. 

On Windows, you can write the following in the Command Prompt and see all the options: 

ping -?

On macOS, you can write the following in the Terminal and see all the options: 

ping -h

On Linux, you can write the following in the Terminal and see all the options: 

ping -h

​Conclusion. 

So, the Ping command is a basic tool for testing devices on your network. It can be found on almost any OS and works almost the same on them. Send ICMP messages and see how long it takes them to return the echo. Simple and perfect.