Ping (ICMP)

Hello, are you there?

Introduction

Intuition

(A) using Keepalive message (periodical)

(B) using Ping command (triggered)

ICMP

PING use ICMP request and reply to check for network/host connectivity

(A) Ping is successful

PING is successful, 4 ICMP requests are sent to destination; 4 ICMP replies are received. The first ICMP request is responded in 5ms; the remaining Time-to-live (TTL) is 128 hops. The second and third ICMP request is responded in less than 1ms. The fourth ICMP is replied after 8ms; probably due to network congestion.

(B) Ping failed

ICMP error — Destination host unreachable. This means 192.168.2.1 is not reachable. This could be the host is down, or the router of the remote network is down, or the link connecting the routers are down. The local router 192.168.1.254 generate this message to inform the sender that the destination is not reachable.
ICMP error — Request timed out. This message is generated by the sender itself after the max duration to wait for the ICMP reply has timed out. This could be a problem with the host itself, like having invalid IP, or no default gateway is assigned to the host.

How to use PING command

PING <IP address of target host>eg.
ping 192.168.1.1

To use PING on Windows:

To use PING on MAC OS

To use PING on Linux

All the available options for PING to satisfy your needs
Ping in Linux and MAC is indefinite. On Windows, only 4 ICMP are sent for each command execution
Setting the count for ICMP request with -c option
How messages flow when PC1 ping Google.com

Troubleshooting connectivity issues with PING

Any nodes along the path from PC1 to Google Server is a possible point of failure

(1) Perform Self Diagnostic on PC1

PC1 passed self test. The ICMP packet should be sent successfully to the next hop, which is Router1
PC1 is the point of failure. The packet is not sent out from PC1.

(2) Perform Ping Test to Router1

Router1 has already forwarded the packet to the next hop, Router2
Misconfigurations on Router1, Packet is dropped at Router1

(3) Perform Ping Test to Router2

Router2 is presumed to have already forwarded the packet to the next hop
The packet is dropped at Router2. Router1 will generate an ICMP error back to PC1 to inform on the non-delivery

(4) Perform Ping Test to Google Web Server

PC1 → Server is connected.
Google Server dropped the packet, possibly due to security settings

Checking end to end connectivity with Trace Route

tracert <destination IP>eg. 
tracert 172.217.174.174
PC1 →Server passing through 2 hops with extremely low latency