Using ping in Linux
Purpose of ping: To check whether a device can reach another device over a network.
Not “is the website working.” Not “is the server application running.”
Only this: Can my machine reach that host at the network level?
If the answer is no, nothing above that layer matters.
What Protocol Does ping Use?
ping uses ICMP (Internet Control Message Protocol).
- OSI Layer: Network Layer (Layer 3)
- TCP/IP Model: Internet Layer
- Important: ICMP is not TCP and not UDP. It does not carry application data.
Ping sends an ICMP Echo Request, and the target replies with an ICMP Echo Reply.
Think of it as:
“Are you alive?” → “Yes, I’m here.”
Basic Syntax
ping <target>
The target can be:
- A domain name →
google.com - An IP address →
8.8.8.8 - A device on your local network →
192.168.1.1
Example: Pinging a Website
ping google.com
Typical output:
PING google.com (142.250.183.14) 56(84) bytes of data.
64 bytes from 142.250.183.14: icmp_seq=1 ttl=117 time=24.3 ms
64 bytes from 142.250.183.14: icmp_seq=2 ttl=117 time=23.8 ms
What just happened?
-
Your system resolved the domain name
google.com → 142.250.183.14That’s DNS working. -
Your machine sent ICMP Echo Requests.
-
Google’s server responded.
This confirms:
âś” DNS resolution works âś” Your network interface works âś” Routing works âś” The remote host is reachable âś” ICMP is not blocked
That’s a lot of information from one command.
Ping Also Reveals the IP Address
Notice:
PING google.com (142.250.183.14)
Ping quietly tells you the actual IP address behind a website. That’s useful for:
- Network diagnostics
- Testing direct IP connectivity
- Understanding how services are hosted
Key Output Fields (Don’t Ignore These)
Example line:
64 bytes from 142.250.183.14: icmp_seq=3 ttl=117 time=23.5 ms
| Field | Meaning |
|---|---|
| 64 bytes | Size of reply packet |
| icmp_seq | Sequence number of packet |
| ttl | Time To Live — number of hops remaining |
| time | Round-trip latency (milliseconds) |
Latency (time)
This is how long the packet took to go to the target and back.
- < 1 ms → same machine
- < 5 ms → local network
- 10–50 ms → good internet
- 100+ ms → slow / distant / congested
Stopping Ping
On Linux, ping runs continuously.
Stop it with:
Ctrl + C
You’ll then see statistics:
--- google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 23.5/24.0/24.3/0.3 ms
What matters here?
- packet loss → If not 0%, your connection is unstable
- avg → Average latency
Packet loss is a red flag. Even 2–3% is a problem.
Useful Options (Linux)
Send only 4 packets
ping -c 4 google.com
Change packet size
ping -s 1000 google.com
Set interval between packets
ping -i 2 google.com
Flood ping (advanced, don’t abuse)
ping -f google.com
Used for stress testing. Can look like an attack. Use responsibly.
Ping on Local Network
Check if a device in your home network is reachable:
ping 192.168.1.10
If this fails:
- Device might be off
- Wrong IP
- Firewall blocking ICMP
- Network misconfigured
When Ping Fails
Destination Host Unreachable
Request timeout
Possible causes:
- No route to host
- Firewall blocking ICMP
- Host powered off
- Wrong IP
- Network cable unplugged
- ISP or router issue
Modern servers often block ICMP intentionally. So:
Ping failure ≠host is down, It may just be filtered.
Why Ping Is Important
- Fastest network test
- Works on almost every OS and device
- First step in troubleshooting
-
Helps isolate whether issue is:
- Network problem
- Service problem
- Application problem
Professionals always start at the lowest layer first. Ping is Layer 3 testing.
Manual Help
To see all options:
man ping
If you don’t read man pages, you’re limiting yourself.
Bottom Line
ping answers one question only:
Can I reach that machine over the network?
It’s simple, but it’s the foundation of practical networking. If you skip mastering basic tools like this and jump to advanced topics, you’ll struggle later.
Copyright © 2026 Mahidul Haque. This post is licensed under a CC BY-NC-ND 4.0 license. You may read, learn, and share links to this post for non‑commercial, educational purposes, as long as you give appropriate attribution. You may not copy, reproduce, adapt, distribute, or use this work commercially without explicit permission.