Ping Network Utility
Module 5 · IT Infrastructure & Networking

Ping Network Utility

Use the ping command-line utility to test network connectivity, measure latency, and diagnose basic network issues.

What Is Ping?

Ping is one of the oldest and most widely used network diagnostic tools. It sends small packets of data to a target host and measures whether a response comes back and how long it takes.

The name comes from sonar: a submarine sends out a ping and listens for the echo. Network ping works the same way — send a signal, wait for the echo, measure the round trip.


How Ping Works

Ping uses the ICMP (Internet Control Message Protocol) to send Echo Request packets to a target. If the target is reachable and configured to respond, it sends back an Echo Reply.

The output tells you:

  • Whether the host is reachable
  • The round-trip time (RTT) in milliseconds
  • Any packet loss (requests with no reply)

Running Ping

💻 Code Lab: Basic Ping Commands

Open a terminal (Command Prompt on Windows, Terminal on Mac/Linux) and try:

# Ping a public server by hostname
ping google.com

# Ping by IP address
ping 8.8.8.8

# Limit to 4 packets (Windows default) / use -c on Mac/Linux
ping -c 4 google.com

Sample output:

PING google.com (142.250.80.46): 56 data bytes
64 bytes from 142.250.80.46: icmp_seq=0 ttl=117 time=12.4 ms
64 bytes from 142.250.80.46: icmp_seq=1 ttl=117 time=11.8 ms
64 bytes from 142.250.80.46: icmp_seq=2 ttl=117 time=12.1 ms
64 bytes from 142.250.80.46: icmp_seq=3 ttl=117 time=11.9 ms

--- google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss
round-trip min/avg/max/stddev = 11.8/12.1/12.4/0.2 ms

What to read:

  • time=12.4 ms — round-trip latency; under 50ms is excellent, 100–200ms is acceptable, 500ms+ is problematic
  • 0% packet loss — all packets received; any loss indicates network instability
  • ttl=117 — Time to Live; decrements at each router hop; tells you roughly how many hops the packet traveled

Diagnosing with Ping

SymptomLikely Cause
Request timed out (100% loss)Host unreachable, firewall blocking ICMP, or host offline
High latency (>200ms to local host)Network congestion or routing issue
Intermittent packet lossUnstable connection, faulty cable, or wireless interference
Resolved to wrong IPDNS misconfiguration

Systematic Diagnosis

  1. ping 127.0.0.1 — ping your own machine (loopback); if this fails, your network stack has a problem
  2. ping <gateway IP> — ping your router; if this fails, you’re not connected to local network
  3. ping 8.8.8.8 — ping a known public IP; if this fails, your router can’t reach the internet
  4. ping google.com — ping by hostname; if this fails but the IP works, you have a DNS issue

🧠 Knowledge Check

You ping 8.8.8.8 and get a response, but ping google.com times out. What does this tell you, and what is the likely fix?

Reveal Answer & Explanation

It tells you that internet connectivity is working (you can reach a public IP) but DNS resolution is failing (the hostname google.com cannot be translated to an IP address). The likely fix is to check your DNS server configuration — either it’s offline, misconfigured, or blocked. You can test by manually specifying a DNS server: nslookup google.com 8.8.8.8 to see if Google’s public DNS resolves it correctly.