How the ping Command Works

What is Ping (Packet Internet Gopher)
Ping (Packet Internet Gopher) is a computer network tool used to test whether a particular host (host is a computer connected to the Internet/Network) is reachable across an IP network. In short Ping tests the basic connectivity from your computer to the target computer
Mike Muuss wrote the program for Unix and later it was adapted in most of the operating systems. The famous program Trace rout is evolved from Ping.
How ping works
Ping works as it sends ICMP (Internet Control Message Protocol) echo requests to the target or Host and listening for ICMP echo response replies.
What is the output ping gives
Ping calculates the round trip time to send and receive data packets, is there any data packet loss and gives a statistical summary about the time.
How ping helps
Ping result allow as to decide, on which layer we should do the further testing Lower layer (Network layer) or upper layer (Application layer). If the ping gives the positive results we can ensure the problem is with the application layer and network connectivity is working fine.
Basic Format of Ping command
Basic format
ping [host] [packet size] [count]
[host] :- The host name or IP address of the remote host being tested.
[packet size] :- Defines the size in bytes of the test packets. This field is only required if the count field is going to be used. Default packet size is 56 bytes.
[count] :-The number of packets to be sent in the test. Default number is usually 5.

This is how we can read the results shown above
Reply from 209.85.153.104: bytes=32 time=44ms TTL=245
Reply from :- 209.85.153.104 ((Host IP here Google)
bytes :- Number of Bytes send to the Host
time :- time taken for the round trip
TTL :- Packet life (Time-to-live (TTL) is a value in an Internet Protocol (IP) packet, which tells a network router how long the packet has been in the network, too long and should be discarded.)
Ping statistics for 209.85.153.104:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
It tells the number of packets sent to the host (echo requests) and packets received (echo response reply) and number of packets lost in transmission.
Approximate round trip times in mille-seconds:
Minimum = 44ms, Maximum = 45ms, Average = 44ms
Gives a statistical data about the time taken for the round trip .
Example for Ping with switches
We are going to issue following command ping -n 3 -l 64 www.google.com
Here switch -n specifies number of packets to be sent and -l specifies the size of the packet to be sent to the host
You can use switches before or after the host name/address.

Comments

Popular Posts