Pcornel
Linux

Network Troubleshooting

Cheat sheet · https://pcornel.dk/topic.php?topic=2793

Back to the Topic

Answer

Network troubleshooting on Linux works up the stack: interface and link, address, neighbour (ARP), route, DNS, firewall and MTU, then whether the service listens and accepts connections. The first layer that fails is the one to fix.

Remember

ip route get <dst> shows which interface and source address are actually used. getent hosts tests name resolution the way applications do. ss -ltn shows what is listening and on which address. A firewall on the host can drop traffic the network delivers.

First checks

  • ip -br link / ip -br addr — interface state and addresses.
  • ip route get <dst> — the route, interface and source address used.
  • ip neigh — ARP/neighbour entries (FAILED or INCOMPLETE is a problem).
  • getent hosts <name> — name resolution via the system resolver.
  • ss -ltnp — listening TCP sockets and processes.
  • nft list ruleset — host firewall rules.
  • tracepath <dst> — path and MTU.

Commands

ping
Probe IP reachability and round-trip behavior with ICMP echo requests and replies.
traceroute
Discover path hops toward a destination by eliciting TTL-expiry responses.
tracepath
Trace the IP path and path-MTU behavior without requiring raw-socket privilege on typical Linux systems.
ss
Inspect kernel socket, listener and transport-state information through the inet_diag interfaces.
netstat
Inspect legacy socket, route and interface statistics where net-tools is installed.
iperf3
Generate controlled TCP, UDP or SCTP traffic to measure throughput, loss and related transport metrics.
curl
Transfer data to or from a URL while exposing protocol, TLS, header and response details.
wget
Retrieve content from HTTP, HTTPS or FTP URLs into standard output or local files.
tcpdump
Capture and decode packets matching a BPF filter on a selected interface.
ss -tulpn
Listening TCP/UDP sockets with process context when permitted.
ss -tp
Established TCP sockets with process context when permitted.
ethtool
Inspect or change Ethernet link settings, driver information, offloads and interface statistics.
mtr
Continuously combine route-hop discovery with per-hop latency and loss sampling.
ethtool <dev>
Display link mode, speed/duplex and driver-adjacent link data.
ss -lntup
Shows listening TCP/UDP sockets and owning processes where permitted.
ss -tnpi
Shows active TCP sessions with process/timer details where permitted.

Verify in this order

interface up with address → route via the right interface and source → neighbour resolved → name resolves → path and MTU fine → host firewall allows → service listening → connection succeeds

Where it usually breaks

First mismatch in link/interface → address/namespace → route/neighbor → firewall/policy → socket/daemon → DNS/TLS/SSH/application peer path; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2793

Confirmation

Confirm action

Continue?