Ping Demand in Linux
The ping order is one of the most used resources for troubleshooting, examination, and network that is diagnosing problem.
Ping functions by delivering several ICMP (Web controls Message method) Echo demand products to a specified destination internet protocol address regarding the circle and waits for a reply. As soon as the location get the package, it will reply right back with an ICMP echo reply.
With the ping order, you’ll see whether a remote resort internet protocol address is active or inactive. You can also find the delay that is round-trip chatting with the destination and check whether there is certainly a packet reduction.
The ping energy are a right part associated with the iputils (or iputils-ping) package, in fact it is pre-installed on nearly all Linux distributions. ping can be offered on screens, macOS, and FreeBSD.
How to ping a server
The syntax for any ping order is just as observe:
ping [OPTIONS] DESTINATION
To finest illustrate exactly the ping command works let’s ping google.com:
The production shall appear something such as this:
PING google.com (220.127.116.11) 56(84) bytes of information.
64 bytes from muc11s01-in-f14.1e100.net (18.104.22.168): icmp_seq=1 ttl=53 time=40.2 ms
64 bytes from muc11s01-in-f14.1e100.net (22.214.171.124): icmp_seq=2 ttl=53 time=41.8 ms
64 bytes from muc11s01-in-f14.1e100.net (126.96.36.199): icmp_seq=3 ttl=53 time=47.4 ms
64 bytes from muc11s01-in-f14.1e100.net (188.8.131.52): icmp_seq=4 ttl=53 time=41.4 ms
4 boxes carried, 4 gotten, 0% package reduction, opportunity 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 begins delivering ICMP bundles on the resort IP. In the event the location IP is actually reachable it’ll answer as well as the ping command images a line that also includes the subsequent sphere:
How many facts bytes. The standard try 56, which means 64 ICMP data bytes – 64 bytes
The ip from the location – from muc11s01-in-f14.1e100.net (184.108.40.206)
The ICMP series amounts for each packet. icmp_seq=1
The full time to Live. – ttl=53 – how can TTL work?
The ping energy, calculated in milliseconds which is the round-trip energy for the packet to reach the number, and also for the response to go back to the transmitter. – time=41.4 ms
By standard, the interval between sending a new package is one second.
The ping order will continue steadily to send ICMP solutions for the resort ip until it obtains an interrupt. To end the demand, only hit the Ctrl+C trick combo.
As soon as the command puts a stop to, it shows a statistic such as the percentage of package loss. The package control means the information was actually fell someplace in the circle, suggesting an issue around the system. If there’s a packet loss, you need to use the traceroute demand to identify the spot where the package loss happens.
If ping will not get back an answer, it means that the system communication just isn’t developed. At these times, it doesn’t constantly indicate that the destination internet protocol address isn’t active. A firewall may be had by some hosts this is certainly stopping the ICMP traffic or put to not respond to ping demands.
On achievements, the ping command exits with code 0. If not it shall leave with signal 1 or 2. This can be of good use with all the ping power in a shell program.
Inside the preceding sections, we’ll get over the most commonly made use of ping order options.