Andrew Mercer
on this page

What it is

ping sends ICMP Echo Request packets and reports Echo Reply round-trip times. It's the first tool to reach for when asking "is this host up / reachable / how far away is it" — but it only tells you about ICMP reachability, which is frequently blocked or rate-limited on the actual service ports you care about (see nc/nping for TCP/UDP-level checks).

Basic usage

ping example.com                 # continuous, Ctrl+C to stop
ping -c 5 example.com            # stop after 5 packets
ping -c 5 -i 0.2 example.com     # 5 packets, 200ms interval (needs root for <200ms)

Reading the output

64 bytes from 93.184.216.34: icmp_seq=1 ttl=56 time=14.2 ms
  • icmp_seq — sequence number; gaps mean dropped packets
  • ttl — remaining hops; a much lower TTL than expected on a LAN host can indicate asymmetric routing or an unexpected extra hop
  • time — round-trip time in ms

The summary line at the end (rtt min/avg/max/mdev) gives jitter (mdev — mean deviation) alongside latency, which matters more than raw latency for anything real-time (VoIP, gaming).

Useful flags

Flag Meaning
-c <n> stop after n packets
-i <secs> interval between packets (root required below 0.2s)
-s <bytes> payload size — useful for MTU/fragmentation testing (see MTU troubleshooting)
-M do set Don't Fragment bit — pairs with -s to find the real path MTU
-W <secs> timeout waiting for a reply
-4 / -6 force IPv4 / IPv6
-f flood ping (root only) — for load testing, not casual use
-q quiet, summary only

MTU / fragmentation testing

ping -M do -s 1472 example.com    # 1472 + 28 bytes overhead = 1500, standard Ethernet MTU
ping -M do -s 8972 -c1 host       # jumbo frame test (9000 MTU networks)

If a size fails with "Message too long" but a smaller one succeeds, you've found the actual path MTU — see the MTU troubleshooting guide for the full binary-search workflow.

IPv6

ping6 example.com          # or: ping -6 example.com (modern iputils merged the binaries)

Cheat sheet

ping -c 5 host                    # quick reachability check, 5 packets
ping -c 5 -i 0.2 host             # faster interval
ping -M do -s 1472 host           # MTU probe (standard Ethernet)
ping6 host                        # IPv6