Problem Statement
What does the ping command do?
Explanation
Ping sends ICMP (Internet Control Message Protocol) echo request packets to a target host and waits for echo reply packets. It measures round-trip time and packet loss, helping diagnose network connectivity and latency issues. Basic usage: ping hostname or ping IP_address sends continuous pings until interrupted with Ctrl+C.
Common options include -c count to send specific number of packets (ping -c 4 google.com sends 4 packets then stops), -i interval to set time between packets, -W timeout for response timeout, and -s size to set packet size. Output shows bytes received, sequence number, TTL (Time To Live), and time in milliseconds.
Ping results help diagnose issues: 100% packet loss indicates no connectivity, high latency suggests network congestion or distant host, variable times indicate unstable connection, and 'Destination Host Unreachable' suggests routing problems. Some hosts block ICMP for security, causing ping to fail even when host is accessible via other protocols. Understanding ping is essential for basic network troubleshooting.
