H
10Corp Premium Hosting

The ping Command — Network Connectivity Testing

Last Updated: 2025-01-01 3 min read

Overview

ping is the most basic network diagnostic tool. It sends small packets (ICMP echo requests) to a target host and measures the response time. Use it to check whether a server is reachable and to measure network latency.

Basic Syntax

ping [options] hostname_or_IP

Common Usage

Ping a host

ping example.com

On Linux, this runs continuously until you press Ctrl+C. Sample output:

PING example.com (93.184.216.34) 56(84) bytes of data.
64 bytes from 93.184.216.34: icmp_seq=1 ttl=56 time=11.2 ms
64 bytes from 93.184.216.34: icmp_seq=2 ttl=56 time=10.8 ms
64 bytes from 93.184.216.34: icmp_seq=3 ttl=56 time=11.5 ms
^C
--- example.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 10.800/11.166/11.500/0.286 ms

Send a specific number of pings

ping -c 5 example.com

The -c flag limits the number of packets sent. The command exits automatically after 5 pings.

Understanding the Output

Per-packet line

FieldMeaning
64 bytesSize of the response packet
icmp_seq=1Sequence number (tracks packet order)
ttl=56Time to live — remaining hop count
time=11.2 msRound-trip time (latency) in milliseconds

Summary statistics

MetricMeaning
packets transmittedHow many pings were sent
receivedHow many responses came back
packet lossPercentage of packets that never returned
rtt min/avg/max/mdevRound-trip time: minimum, average, maximum, and standard deviation

What the results mean

ResultInterpretation
Low latency (< 50ms)Good connection
High latency (> 200ms)Slow connection, possibly distant server or congestion
0% packet lossStable connection
Partial packet lossIntermittent connectivity issue
100% packet lossHost unreachable, down, or blocking ICMP
“Request timed out”No response received within the timeout

Useful Flags

FlagDescription
-c NSend N packets then stop
-i NWait N seconds between pings (default: 1)
-W NTimeout in seconds for each response
-s SIZESet packet size in bytes (default: 56)
-qQuiet mode — only show summary
-fFlood ping (requires root) — sends packets as fast as possible
-4Force IPv4
-6Force IPv6

IPv6 Testing with ping6

To test IPv6 connectivity:

ping -6 example.com
# or on older systems:
ping6 example.com

Practical Examples

Quick connectivity check

ping -c 4 yourdomain.com

Check if DNS is working (ping an IP vs. a domain)

ping -c 3 8.8.8.8           # Google's DNS IP — tests raw connectivity
ping -c 3 google.com        # Tests connectivity AND DNS resolution

If the IP works but the domain doesn’t, you have a DNS issue.

Test with a larger packet size

ping -c 5 -s 1400 example.com

Useful for detecting MTU (Maximum Transmission Unit) issues.

Troubleshooting Tips

  • 100% packet loss doesn’t always mean the host is down — many servers and firewalls block ICMP (ping) traffic for security reasons.
  • If ping fails but your website loads, ICMP is likely blocked — this is normal.
  • Use traceroute or mtr for more detailed path analysis when ping shows high latency or packet loss.
  • Compare pings from your local machine to pings from the server itself to isolate whether the issue is on the network path or on the server.
Tags: ssh linux ping networking diagnostics

Still need help?

Our support team is available 24/7 to assist you.