Skip to main content

Ping command in networking

Ping is a computer network administration software utility used to test the reachability of a host on  network. (means you are reachable to that host or not by using ping command)

when you are pinging any host what actually happen.

it will send normally 4 packets to other host which you want to ping .

if your are using ipv4 then packet is as below.

IPv4 Datagram
 Bits 0–7Bits 8–15Bits 16–23Bits 24–31
Header
(20 bytes)
Version/IHLType of serviceLength
Identificationflags and offset
Time To Live (TTL)ProtocolHeader Checksum
Source IP address
Destination IP address
ICMP Header
(8 bytes)
Type of messageCodeChecksum
Header Data
ICMP Payload
(optional)
Payload Data
Source: wikipedia.com
If you are using ipv6 then packet is as below.





IPv6 Datagram
 Bits 0–3Bits 4–7Bits 8–11Bits 12–15Bits 16–23Bits 24–31
Header
(40 bytes)
VersionTraffic ClassFlow Label
Payload LengthNext HeaderHop Limit
Source Address
Destination Address
ICMP6 Header
(8 bytes)
Type of messageCodeChecksum
Header Data
ICMP6 Payload
(optional)
Payload Data
























Source:Wikipedia.com


Function: Send ICMP ECHO_REQUEST to network hosts




Protocol used : ICMP ( ICMP protocol should allowed in Firewall)

ICMP : UseInternet Control Message Protocol

Example:



Ping IPAdress or web address

ping 10.0.0.1


$ ping -c 5 www.example.com
PING www.example.com (93.184.216.34): 56 data bytes
64 bytes from 93.184.216.34: icmp_seq=0 ttl=56 time=11.632 ms
64 bytes from 93.184.216.34: icmp_seq=1 ttl=56 time=11.726 ms
64 bytes from 93.184.216.34: icmp_seq=2 ttl=56 time=10.683 ms
64 bytes from 93.184.216.34: icmp_seq=3 ttl=56 time=9.674 ms
64 bytes from 93.184.216.34: icmp_seq=4 ttl=56 time=11.127 ms

--- www.example.com ping statistics ---
5 packets transmitted, 5 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 9.674/10.968/11.726/0.748 ms                                               

The ping utility was written by Mike Muuss in December 1983 as a tool to troubleshoot problems in an IP network.

Ping is a very essential command to troubleshooting and diagnosis

Error indications 

In cases of no response from the target host, most implementations display either nothing or periodically print notifications about timing out. Possible ping results indicating a problem include the following:
H, !N or !P – host, network or protocol unreachable S – source route failed F – fragmentation needed U or !W – destination network/host unknown I – source host is isolated A – communication with destination network administratively prohibited Z – communication with destination host administratively prohibited Q – for this ToS the destination network is unreachable T – for this ToS the destination host is unreachable X – communication administratively prohibited V – host precedence violation C – precedence cutoff in effect

In case of error, the target host or an intermediate router sends back an ICMP error message, for example "host unreachable" or "TTL exceeded in transit". In addition, these messages include the first eight bytes of the original message (in this case header of the ICMP echo request, including the quench value), so the ping utility can match responses to originating queries.
 
References:
https://en.wikipedia.org/wiki/Ping_(networking_utility)
https://www.lifewire.com/ping-command-2618099

Comments

Post a Comment

Popular posts from this blog

Windows Very Important Command

 Robocopy also is known as Robust File Copy Command. By using Robocopy Windows Command  Line utility we can copy files, directories and even drives too from one location to another location. Robocopy is a Windows command-line tool used for file and folder Replication. In details

Practical Robocopy Examples

  Master Robocopy with these real-world examples that solve common file management challenges. These practical robocopy examples will help you copy, backup, and synchronize files efficiently. Basic File Copy robocopy C:\Documents D:\Backup Copies all files from Documents to Backup folder. Mirror Directory (Exact Backup) robocopy C:\ProjectFiles D:\Backup\ProjectFiles /MIR Creates an exact replica, deleting extra files in destination. Copy Only New Files robocopy C:\Source D:\Destination /XO /E Copies only newer files, including all subdirectories. Fast Multi-threaded Copy robocopy C:\LargeFiles D:\Backup /MT:16 /R:3 /W:5 Uses 16 threads with 3 retries and 5-second waits for speed. Copy Specific File Types robocopy C:\Photos D:\PhotoBackup *.jpg *.png *.raw /S Copies only image files from all subdirectories. Network Backup with Logging robocopy C:\Data \\Server\Backup /MIR /LOG:backup.log /R:5 Mirrors to network drive with detailed logging. Exclude Temporary Files robocopy C:\Source...