ping
In the output, look at: loss (packet loss) and spread
(rtt min/avg/max). 0% and a stable rtt mean the link is healthy.
A ladder of connectivity checks — from the gateway to DNS and the destination port.
ping -c4 gateway
L2/L3: is the gateway reachable
ping -c4 8.8.8.8
L3: connectivity to the internet
mtr -rwc 10 host
path + loss (a report)
traceroute -T -p 443 host
trace over a TCP port (when ICMP is blocked)
getent hosts name
DNS
nc -zv host port
the destination port
ip route get 8.8.8.8
which route it would take
"The network doesn't work" is vague. Diagnose it by walking a ladder of layers, ruling out half the possibilities at each step:
-br aping gatewayping 8.8.8.8getent hosts name (see dns-resolv)-zv host portEach step answers "how far did it get" and cuts the search space in half.
In the output, look at: loss (packet loss) and spread
(rtt min/avg/max). 0% and a stable rtt mean the link is healthy.
mtr is the main tool: it shows loss at every hop, so you can see
exactly whose segment is dropping packets (yours, your provider's, or an
intermediate node's).
The network is fine, DNS isn't working. See dns-resolv:
resolvectl status, getent hosts name, dig @8.8.8.8 name.
mtr -rwc 20 shows which hop the loss grows at. Loss only at an
intermediate hop but not at the destination is usually normal (routers
deprioritize ICMP addressed to themselves). Loss that persists to the end
is a real problem with the link.
Many hosts don't answer ping on purpose. Check port reachability with
nc and trace with traceroute -T -p 443, instead of relying only on
ICMP.
Intermittent loss: run ping -c100 -i0.2, mtr for longer. Often a
congested link, a duplicate IP on the network, or a flapping link.
Found an inaccuracy? Report an error in the article