Introduction
When a server or website is unreachable, the first step is to determine where the connection fails. Three essential command-line tools help you diagnose network issues: ping, traceroute, and mtr.
ping — Test basic connectivity
ping sends ICMP echo requests to a host and measures the round-trip time. It answers the most basic question: "Can I reach this host?"
Basic usage
ping example.com
On Linux, ping runs continuously until you press Ctrl+C. To send a specific number of packets:
ping -c 5 example.com
Reading the output
PING example.com (93.184.216.34): 56 data bytes
64 bytes from 93.184.216.34: icmp_seq=0 ttl=56 time=11.6 ms
64 bytes from 93.184.216.34: icmp_seq=1 ttl=56 time=11.4 ms
64 bytes from 93.184.216.34: icmp_seq=2 ttl=56 time=11.5 ms
--- example.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss
round-trip min/avg/max = 11.4/11.5/11.6 ms
What to look for
| Symptom | Possible cause |
|---|---|
| 100% packet loss | Host is down, firewall blocking ICMP, or routing issue |
| High latency (>200 ms) | Network congestion, geographic distance, or routing inefficiency |
| Intermittent packet loss (1–20%) | Network congestion, faulty hardware, or ISP issue |
Destination Host Unreachable |
No route to the host; check routing tables and gateway |
Name or service not known |
DNS resolution failure; check DNS settings |
Useful options
| Option | Description |
|---|---|
ping -c 10 host |
Send exactly 10 packets |
ping -i 0.2 host |
Send packets every 0.2 seconds (faster) |
ping -s 1400 host |
Use a larger packet size (test MTU issues) |
ping -4 host |
Force IPv4 |
ping -6 host |
Force IPv6 |
traceroute — Trace the path to a host
traceroute shows every router (hop) between your machine and the destination. It helps identify where a connection fails or slows down.
Basic usage
traceroute example.com
On some systems, you may need to install it:
sudo apt install traceroute # Debian/Ubuntu
sudo yum install traceroute # AlmaLinux/RHEL
Reading the output
traceroute to example.com (93.184.216.34), 30 hops max, 60 byte packets
1 gateway (192.168.1.1) 0.5 ms 0.4 ms 0.3 ms
2 isp-router (10.0.0.1) 3.2 ms 3.1 ms 3.0 ms
3 core-router (172.16.0.1) 8.5 ms 8.4 ms 8.3 ms
4 * * *
5 target (93.184.216.34) 11.5 ms 11.4 ms 11.3 ms
Each line is a hop. The three time values are round-trip times for three probe packets. Asterisks (* * *) mean the hop did not respond (it may be blocking ICMP, not necessarily a failure).
What to look for
| Symptom | Possible cause |
|---|---|
| Sudden jump in latency at a specific hop | Congestion or issue at that router/network |
All hops after a certain point show * * *
|
Firewall blocking or host down beyond that point |
| Trace ends before reaching the target | Routing problem or firewall dropping packets |
TCP traceroute (bypass ICMP blocks)
Some firewalls block ICMP but allow TCP. Use tcptraceroute or:
traceroute -T -p 443 example.com
mtr — Combined ping + traceroute
mtr (My Traceroute) combines ping and traceroute into a single real-time diagnostic tool. It continuously sends packets and shows per-hop packet loss and latency statistics.
Installation
sudo apt install mtr # Debian/Ubuntu
sudo yum install mtr # AlmaLinux/RHEL
Basic usage
mtr example.com
This opens an interactive, real-time display. Press q to quit.
Generate a report
For sharing with support teams, use report mode:
mtr -r -c 100 example.com
This sends 100 packets and prints a summary:
HOST: myserver Loss% Snt Last Avg Best Wrst StDev
1. gateway 0.0% 100 0.3 0.4 0.2 1.1 0.1
2. isp-router 0.0% 100 3.1 3.2 2.8 5.4 0.3
3. core-router 2.0% 100 8.5 8.7 8.1 12.3 0.5
4. target 0.0% 100 11.4 11.6 11.2 14.1 0.4
Key columns
| Column | Description |
|---|---|
| Loss% | Percentage of packets lost at this hop |
| Snt | Number of packets sent |
| Last | Latency of the last packet (ms) |
| Avg | Average latency (ms) |
| Best | Lowest latency observed (ms) |
| Wrst | Highest latency observed (ms) |
| StDev | Standard deviation (higher = more jitter) |
When to use each tool
| Scenario | Tool |
|---|---|
| Quick check if a host is reachable | ping |
| Find where a connection fails | traceroute |
| Ongoing network quality analysis | mtr |
| Generate a report for support | mtr -r -c 100 |
Tips for reporting network issues
When contacting support about a network problem, include:
- An
mtrreport from your machine to the target:mtr -r -c 100 target-ip - A reverse
mtrreport from the server back to you (if you have SSH access) - The time and timezone when the issue occurred
- Whether the issue is constant or intermittent