Ping Command in Linux
The ping command the most used utilities for troubleshooting, examination, and identifying community connectivity dilemmas.
Ping works by sending one or more ICMP (net Control content Protocol) Echo consult solutions to a specific resort internet protocol address throughout the community and waits for a reply. If the destination obtains the plan, it will respond back once again with an ICMP echo response.
With all the ping order, you’ll be able to see whether a destination that is actually remote is productive or sedentary. There are also the round-trip wait in communicating with the destination and check whether there can be a packet loss.
The ping energy was a part of this iputils (or iputils-ping) bundle, and is pre-installed on almost all Linux distributions. ping is also offered on Windows, macOS, and FreeBSD.
Strategies for the Ping Demand
The syntax for your ping command is really as employs:
ping [OPTIONS] DESTINATION
To illustrate that is best just how to ping a server order works let’s ping google.com:
The output will seem something like this:
PING google.com (18.104.22.168) 56(84) bytes of data.
64 bytes from muc11s01-in-f14.1e100.net (22.214.171.124): icmp_seq=1 ttl=53 time=40.2 ms
64 bytes from muc11s01-in-f14.1e100.net (126.96.36.199): icmp_seq=2 ttl=53 time=41.8 ms
64 bytes from muc11s01-in-f14.1e100.net (188.8.131.52): icmp_seq=3 ttl=53 time=47.4 ms
64 bytes from muc11s01-in-f14.1e100.net (184.108.40.206): icmp_seq=4 ttl=53 time=41.4 ms
— google.com ping data —
4 boxes sent, 4 obtained, 0% packet reduction, time 7ms
rtt min/avg/max/mdev = 40.163/42.700/47.408/2.790 ms
The ping order resolves the domain into an internet protocol address and starts giving ICMP solutions on the resort IP. In the event that destination IP is actually reachable it’s going to respond as well as the ping order designs a line that also includes the following sphere:
The number of information bytes. The standard are 56, which results in 64 ICMP data bytes – 64 bytes
The ip on the resort – from muc11s01-in-f14.1e100.net (220.127.116.11)
The ICMP series numbers for each packet. icmp_seq=1
The full time to call home. – ttl=53 – how can TTL services?
The ping energy, sized in milliseconds and that is the trip that is round for any package to reach the number, and for the reaction to come back to the sender. – time=41.4 ms
By standard, the period between sending a new packet is actually one second.
The ping demand shall continue steadily to send ICMP packages to your Destination ip until it receives an interrupt. To cease the demand, merely hit the Ctrl+C trick combination.
When the command puts a stop to, it shows a statistic such as the percentage of package control. The packet loss suggests the information was dropped somewhere in the community, indicating an presssing issue inside the network. If there’s a packet reduction, you can make use of the traceroute demand to spot in which the package reduction takes place.
If ping will not come back an answer, it indicates that the community communication isn’t established. When this happens, it does not constantly indicate that the location internet protocol address isn’t productive. Some hosts might have a firewall that will be blocking the ICMP visitors or put never to respond to ping requests.
On achievements, the ping command exits with code 0. If not it shall leave with rule 1 or 2. This might be of good use while using the ping power in a cover script.
For the next areas, we’ll go within the most frequently utilized ping demand choice.