Monday, 12 March 2018

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

No comments:

Post a Comment