What is a ping and how does it work?

 

Ping in the network

A command ping is often used in network construction or troubleshooting. What is ping? What is its working principle?

What is a ping?

Ping is used to determining whether the local host can successfully exchange (send and receive) data packets with another host, and then according to the returned information, it can be inferred whether TCP/IP parameters are set correctly, whether the operation is normal, whether the network is unobstructed, etc.

From the working process of Ping, we can know that host A received a reply packet from host B, indicating that the return and return paths between the two hosts are normal. That is to say, no matter from host A to host B or from host B to host A, it is normal.

ICMP protocol

The full name of ICMP is Internet Control Message Protocol, that is, internet control message protocol.

Send an ICMP; Ping; Request an echo message to the destination and report whether the desired ICMPecho(ICMP received or not). It is a command to check whether the network is unobstructed or the speed of the network connection.

Common ICMP message types

Simulate PC1 and PC2 for evaluation and testing.

ICMP request packet

ICMP reply packet

Summary 

The PING command is often used to test the connectivity of the network. Does it mean that there is a problem with the network if it fails to ping?

No, when the destination address cannot be ping, we should consider whether there is a firewall device that prohibits ICMP requests. If the ICMP protocol is not disabled, it proves that there is a fault in the network.