How to Use Ping and Traceroute to Diagnose Network Problems

Ping tells you whether a host is reachable and how long a round trip to it takes. Traceroute shows the chain of routers your traffic actually passes through to get there. Put them together and you can usually tell, in a couple of minutes, whether a problem sits on your own network, out at your ISP, or somewhere further downstream — and you don't need anything beyond what's already built into Windows, macOS and Linux.

How ping works

Under the hood, ping just fires small ICMP Echo Request packets at a target and waits for an Echo Reply to come back. Each reply gets a round-trip time (RTT) attached to it, and once it's done, ping gives you a summary: how many packets vanished along the way, plus the minimum, average and maximum times. What it won't tell you is anything about a specific app or service — it's checking raw IP reachability and latency, nothing more.

Running ping on each operating system

Windows

Fire up Command Prompt or PowerShell. Windows defaults to four pings, then stops on its own.

ping example.com
ping -n 20 example.com
ping -t example.com
ping -4 example.com
ping -6 example.com

Four pings isn't much to go on, honestly — -n 20 sends 20 instead, and that gives you a far more trustworthy read on packet loss. Want it to just keep going? -t pings continuously until you hit Ctrl+C. -4 and -6 force IPv4 or IPv6 respectively.

macOS and Linux

Open a Terminal window. Here ping just runs forever until you press Ctrl+C, so you'll want -c to cap the count.

ping -c 20 example.com
ping -c 20 -i 0.5 example.com    # one ping every 0.5 seconds
ping6 example.com                # IPv6 on macOS
ping -6 example.com              # IPv6 on Linux

Reading ping output

Here's what typical output looks like on Linux or macOS:

PING example.com (192.0.2.10): 56 data bytes
64 bytes from 192.0.2.10: icmp_seq=0 ttl=55 time=18.4 ms
64 bytes from 192.0.2.10: icmp_seq=1 ttl=55 time=17.9 ms
64 bytes from 192.0.2.10: icmp_seq=2 ttl=55 time=41.2 ms
64 bytes from 192.0.2.10: icmp_seq=3 ttl=55 time=18.1 ms

--- example.com ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 17.9/23.9/41.2/10.0 ms
  • time is the round-trip latency for each packet. There's a hard physical floor here: light in optical fiber only covers about 200 km per millisecond, so every 100 km of cable tacks on roughly 1 ms to the round trip — and that's before routing or queuing delay even enters the picture.
  • ttl is just the remaining hop count in the reply. It's not telling you anything about quality on its own, but if it suddenly changes, your route probably changed too.
  • packet loss is the share of pings that got no reply at all. Even a few percent of sustained loss will wreck a call or a game.
  • stddev (Linux calls it mdev) tells you how much the latency bounces around. That's essentially jitter, and for voice and video it matters more than the raw latency number does. In the example above, that one 41 ms spike is what's dragging the figure up.

Common ping errors

MessageWhat it usually means
Request timed outNo reply arrived. The host may be down, or a firewall may drop ICMP.
Destination host unreachableA router (or your own PC) has no route to the target. If it comes from your own IP, your network connection or gateway is the problem.
Ping request could not find host / Unknown hostThe name did not resolve. This is a DNS problem, not a connectivity problem.
General failure (Windows)The network stack could not send at all: adapter disabled, no IP address, or VPN/firewall software interfering.
Note: Plenty of servers and firewalls block or just ignore ping on purpose — don't read too much into it. A host that never answers a single ping might still serve its web pages without a hitch. To actually check a website, reach for our Is it down checker, which tests the real HTTP service instead.

Using ping to locate a fault

Ping a handful of targets, working from nearest to furthest. Wherever the chain first breaks is where your problem starts.

  1. ping 127.0.0.1 tests your own network stack. If this fails, your OS network configuration is broken, full stop.
  2. ping 192.168.1.1 — or whatever your default gateway actually is (find it with ipconfig on Windows or ip route on Linux) — tests your link to the router. Fails here? That's a Wi-Fi or cable problem.
  3. ping 1.1.1.1 or ping 8.8.8.8, two well-known public DNS servers, checks your internet connection without DNS getting in the way.
  4. ping example.com brings DNS into the picture. Step 3 working but this one failing with "could not find host"? DNS is your culprit.

How traceroute works

Every IP packet carries a TTL field (time to live, hop limit in IPv6-speak), and each router along the way knocks it down by one. Hit zero and the router drops the packet, usually firing back an ICMP Time Exceeded message. Traceroute is basically built around that one quirk: send a probe with TTL 1, then 2, then 3, and so on, and each router that expires one gives up its address and the round-trip time to reach it. Three probes per hop is the default.

CommandPlatformWhat it does
tracert example.comWindowsTraces the route using ICMP probes
tracert -d example.comWindowsSkips reverse DNS lookups, which makes it much faster
traceroute example.commacOS, LinuxTraces the route using UDP probes by default
traceroute -n example.commacOS, LinuxSkips name lookups
traceroute -I example.commacOS, LinuxUses ICMP probes instead of UDP
sudo traceroute -T -p 443 example.comLinuxUses TCP probes to port 443

Stuck behind a firewall that blocks UDP or ICMP? TCP probes are your way around it.

Reading traceroute output

traceroute to example.com (192.0.2.10), 30 hops max
 1  192.168.1.1        1.2 ms   1.0 ms   1.1 ms
 2  100.64.12.1        8.4 ms   7.9 ms   8.1 ms
 3  198.51.100.17      9.0 ms   9.3 ms   8.8 ms
 4  * * *
 5  198.51.100.94     65.2 ms  12.4 ms  11.9 ms
 6  203.0.113.5       18.7 ms  18.3 ms  18.9 ms
 7  192.0.2.10        18.5 ms  18.2 ms  18.6 ms
  • Hop 1 is your router. High or erratic times this early usually mean Wi-Fi trouble.
  • Hop 2 is typically the first box sitting at your ISP. See an address in 100.64.0.0/10? That's usually carrier-grade NAT.
  • Hop 4 shows * * * — that router simply doesn't send Time Exceeded messages. Later hops are still answering fine, so traffic is clearly getting through; nothing to worry about here.
  • Hop 5 throws out one 65 ms probe, but everything after it is back to normal. Not a real problem — more on why below.
  • The last hop is really the one you care about: it's your true end-to-end latency.

Why a single slow hop is usually not a problem

Routers are built, in hardware, to forward packets fast. Generating an ICMP reply is a different job entirely — it falls to the router's control-plane CPU, which treats it as low priority and often throttles it outright. So a busy router can answer traceroute probes slowly, or not reply at all, while still forwarding your actual traffic at full speed, no problem. Here's the rule that actually matters:

  • Latency or loss showing up at one hop and sticking around at every hop after it — that's real.
  • Latency or loss at one hop that vanishes by the next one — that's just a router deprioritizing ICMP, nothing more.

One more wrinkle: the return path doesn't have to match the outbound path (asymmetric routing is common), so a delay you see at a given hop might actually be happening on the way back, not the way out.

Continuous tests: mtr and pathping

A single traceroute only captures one moment in time, which is exactly the wrong tool for an intermittent problem — you need lots of samples per hop to catch it.

mtr (macOS and Linux)

mtr basically fuses ping and traceroute together and keeps updating in real time. Install it with sudo apt install mtr or brew install mtr. Want something you can share or paste elsewhere?

mtr -rwc 100 example.com

That fires 100 probes per hop (-c 100) and spits out a report (-r) in wide format (-w), with Loss%, Avg, Best, Wrst and StDev columns laid out for you. Same rule as regular traceroute applies: loss only counts if it survives to the final hop. Tack on -T -P 443 if you need TCP probes instead.

pathping (Windows)

pathping example.com
pathping -n -q 50 example.com

Pathping traces the route first, then sends 100 queries to each hop by default and tallies up loss per hop. Fair warning: it takes several minutes. -q cuts down the query count and -n skips the name lookups to speed things along.

Testing from your browser

No terminal to work with — locked-down work laptop, a phone, whatever the reason? Our Ping & Jitter Test measures latency, jitter and failed requests straight from your browser. Browsers can't send ICMP at all, so it times HTTP round trips to our server instead. Expect the numbers to run a touch higher than command-line ping, since there's some browser and server processing baked in, but they do reflect what a real web app experiences. Want a guided walkthrough? Try the connection troubleshooter, and once you've pinned down the fault, our guide on how to fix common internet connection problems covers the fixes.

Frequently asked questions

What is a good ping time?

Depends entirely on distance, really. A server in your own city might come in under 10 ms on a wired connection, while something on another continent can easily clear 100 ms — purely because light only travels so fast. And the number itself isn't the whole story: low jitter and zero packet loss matter just as much as a healthy sign.

Why does traceroute show asterisks?

That hop's router simply didn't reply before the timeout — usually because it's configured not to send ICMP Time Exceeded messages at all. If later hops answer fine, just ignore it. But if every hop past a certain point shows asterisks, something is blocking traffic there, or the destination itself is filtering probes.

Can I ping a specific port?

No — ICMP doesn't have ports, full stop. To see whether a TCP port actually answers, use Test-NetConnection example.com -Port 443 in PowerShell, nc -vz example.com 443 on macOS or Linux, or any online port checker.

Experimente você mesmo

Coloque este guia em prática com nossas ferramentas gratuitas.

Comentários

Compartilhe uma dica, faça uma pergunta ou conte como a ferramenta funcionou para você.

Continue lendo

Copiado para a área de transferência