How to test network connectivity
Overview
ping sends ICMP echo requests and reports replies. It helps distinguish a general network problem from a DNS name-resolution problem.
Examples
ping -c 4 1.1.1.1
ping -c 4 example.com
ping -W 2 -c 4 example.com
Read the results
time=reports round-trip latency in milliseconds- Packet loss reports the percentage of unanswered requests
- “Temporary failure in name resolution” suggests a DNS issue
-c 4stops after four requests-W 2limits reply wait time on common Linux versions
Tips
Without -c, Linux ping commonly runs until you press Ctrl+C. Some working hosts block ping, so failure alone does not prove a website is down.