Most 'the service is down' tickets are network questions you can answer with five commands.
Debug network problems layer by layer, from the interface up to the application:
- Interfaces and addresses:
ip addr(ip -br afor a brief view) shows interfaces, their state and IPs;ip linkthe link layer. The oldifconfigis deprecated. - Routes:
ip routeshows the routing table; thedefault vialine is your gateway.ip route get 8.8.8.8tells which route and source address a destination would use. - Reachability:
ping -c 3 host(ICMP may be blocked by firewalls),tracepathormtrfor the path. - DNS:
dig +short nameorgetent hosts name(which also honours/etc/hosts); resolvers are listed in/etc/resolv.conf, often pointing at the localsystemd-resolved(checkresolvectl status). - Ports:
ss -tlnplists listening TCP sockets with the owning process (run with sudo to see all),ss -tnpcurrent connections. A service bound to127.0.0.1is reachable only from the machine itself;0.0.0.0or[::]means all interfaces. - Application:
curl -v https://host/pathshows the TLS handshake, request and response headers;nc -zv host 5432tests whether a TCP port accepts connections.
Network configuration itself is distribution-specific: netplan on Ubuntu, NetworkManager (nmcli) on Fedora/RHEL and desktops, systemd-networkd elsewhere.
Example
ip -br addr # interfaces and addresses
# lo UNKNOWN 127.0.0.1/8 ::1/128
# eth0 UP 192.168.1.20/24 fe80::1c2:3ff:fe4d:5e6f/64
ip route # default via 192.168.1.1 dev eth0 ...
ip route get 1.1.1.1 # which interface and source address would be used
ping -c 3 example.com # reachability and latency
dig +short example.com # DNS answer only
getent hosts db.internal # resolve like applications do (incl. /etc/hosts)
sudo ss -tlnp # listening TCP ports with processes
# LISTEN 0 511 0.0.0.0:80 0.0.0.0:* users:(("nginx",pid=812,fd=6))
curl -sS -o /dev/null -w '%{http_code} %{time_total}s\n' https://example.com
nc -zv db.internal 5432 # is the TCP port open?Remember
- Check interface, route, DNS, port, then application
- ss -tlnp shows what listens where; 127.0.0.1 means local only
- dig / getent for DNS, curl -v and nc -zv for services
Watch out for
- Concluding a host is down because ping fails, when ICMP is simply blocked.