smartsub.co

Learn everything about the Tech World!

Tag Archive : Ping command

MTR command – A network diagnostic tool for Linux

Many network diagnostic tools are already a part of Linux. For example, Nslookup command, Host command, Dig command, Traceroute command, and more. But, sometime in the past, there was a guy called Matt Kimball. He was just not satisfied with the traceroute command in the 90s, so he decided to make a new one – the MTR command.

What is the MTR command?

The MTR command is a great small tool to trace the route to a target and get information for the round-trip. It is an alternative to the common traceroute command and was written by Matt Kimball created in 1997 to perform functions both from traceroute command and ping command. It provides more information in comparison with the other two commands and is just as easy to use on Linux. Roger Wolff further improved the software in 1998, and the name was changed to My Traceroute. 

On Linux, you can use the MTR command straight through the Terminal application. If you don’t have it installed on your Linux distro, you first need to install it.

On Ubuntu, you can do it by typing: sudo apt update. Then press Enter and write your password. After that, type: sudo apt -y install mtr. Again press Enter.

How does it work?

The MTR command sends ICMP (Internet Control Message Protocol) data packets to the target you set. The target that you decide could be a hostname/domain name or an IP address (IPv4 or IPv6). 

You can use it using the following syntax:

mtr option value target

Mtr – shows which command you are using.

Option – it can use one of the following options to improve your probe further:

-h – help.

-v – version.

-r – report. You need to stop it by pressing the “C” key, and after that, you get a report.

-w – extended report.

-c – number of ICMP messages to be sent.

-s – the size of ICMP data packages.

-t – Curses-based terminal interface.

-n – don’t resolve the hostnames.

-g – GTK+ interface.

-p – split – Split-user interface.

-l – Raw output.

-a – address.

-i – seconds between the ICMP messages.

-u –use UDP.

-4 – IPv4 addresses only.

-6 – IPv6 addresses only.

Value – the value of the option, if it applies. An example of this is a number after the “-i” that indicates seconds between the ICMP messages.

When the command sends the pings, it will wait for them to return. The MTR command will show statistics – round-trip time, lost packets if any, and time to reach the hop)

So, the MTR command is a Linux diagnostic tool used to trace the route and see if you have a connection with the target.

​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.