Ping Command in Linux
The ping demand the most made use of utilities for troubleshooting, examination, and network that is diagnosing issues.
Ping functions by delivering several ICMP (websites regulation content method) Echo demand packages to a specific resort internet protocol address from the circle and waits for a reply. When the resort receives the plan, it will react straight back with an ICMP echo reply.
Making use of the ping order, you can easily determine whether a remote location internet protocol address is active or inactive. There are also the round-trip wait in communicating with the destination and look whether you will find a packet control.
The ping electricity are a part regarding the iputils (or iputils-ping) plan, and is pre-installed on nearly all Linux distributions. ping is also offered on Windows, macOS, and FreeBSD.
Strategies for the Ping Demand
The syntax for any ping order is as follows:
ping [OPTIONS] DESTINATION
To greatest illustrate how to ping a server order operates let’s ping google.com:
The result will hunt something similar to this:
PING google.com (184.108.40.206) 56(84) bytes of information.
64 bytes from muc11s01-in-f14.1e100.net (220.127.116.11): icmp_seq=1 ttl=53 time=40.2 ms
64 bytes from muc11s01-in-f14.1e100.net (18.104.22.168): icmp_seq=2 ttl=53 time=41.8 ms
64 bytes from muc11s01-in-f14.1e100.net (22.214.171.124): icmp_seq=3 ttl=53 time=47.4 ms
64 bytes from muc11s01-in-f14.1e100.net (126.96.36.199): icmp_seq=4 ttl=53 time=41.4 ms
4 packets sent, 4 gotten, 0% package control, times 7ms
rtt min/avg/max/mdev = 40.163/42.700/47.408/2.790 ms
The ping order resolves the domain into an IP address and begins sending ICMP packages into the location IP. A line that includes the following fields if the destination IP is reachable it will respond back and the ping command prints
The number of data bytes. The default is 56, which means 64 ICMP data bytes – 64 bytes
The ip of this location – from muc11s01-in-f14.1e100.net (188.8.131.52)
The ICMP sequence amounts for each package. icmp_seq=1
The amount of time to live on. – ttl=53 – so how exactly does TTL operate?
The ping time, calculated in milliseconds in fact it is the trip that is round for your package to reach the variety, and for the a reaction to go back to the transmitter. – time=41.4 ms
By default, the period between sending a packet that is new one next.
The ping demand shall continue steadily to send ICMP packages towards the resort ip until it receives an interrupt. To eliminate the order, simply smack the Ctrl+C secret collection.
When the demand prevents, it displays a statistic like the portion of package reduction. The package loss means the info was dropped somewhere in the circle, indicating an presssing issue in the circle. If you have a packet loss, you are able to the traceroute order to determine where in actuality the packet reduction happens.
If ping doesn’t come back an answer, this means that the community communications is not demonstrated. At these times, it doesn’t constantly signify the resort internet protocol address is certainly not productive. A firewall may be had by some hosts that is stopping the ICMP site visitors or ready never to respond to ping requests.
On success, the ping command exits with code 0. If not it shall exit with laws 1 or 2. This might be of good use when using the ping energy in a cover software.
During the next areas, we’ll get across the most often used command that is ping.