How to Test Network Connectivity with ping

Published 2026-08-05 · Learn Linux

The ping command tests whether a host is reachable over the network. ping google.com sends small probes and reports how fast replies come back. It is the first tool to use when a website, server or printer is not responding.

Ping a host

ping keeps going until you stop it with Ctrl+C, then prints a summary with packet loss and average time. The time shown is the round-trip latency in milliseconds.

$ ping google.com

Limit the count with -c

For scripts and quick checks, send a fixed number of probes with -c. Four is enough to see if a host answers.

$ ping -c 4 google.com

Set the interval with -i

Default intervals are 1 second. Use -i to send probes faster or slower, which matters when testing a flaky link without flooding it.

$ ping -i 5 router.local

Ping by IP to skip DNS

Ping a raw IP to test pure network reachability without DNS: ping 8.8.8.8. If an IP answers but the hostname does not, the problem is DNS, not the network.

$ ping -c 3 8.8.8.8

Interpret the results

100% packet loss with timeouts means the host is unreachable or blocks ICMP (many firewalls do). High and rising times point to congestion. See ping for all options, and check your own addresses with ip addr.

Keep learning

Related guides: How to Manage Network Interfaces with the Linux ip Command · How to Query DNS with dig and nslookup · How to Check Open Ports with ss and netstat. Read all tutorials on the Learn Linux blog.