Skip to content

Networking on a Host

When a service is unreachable, figure out whether the problem is the process, the local host, DNS, or the network path.

Terminal window
ip addr # show network interfaces and assigned IPs
ip route # show the routing table
ss -ltnp # show listening TCP ports and owning processes
ss -lunp # show listening UDP ports and owning processes
ping <host>
curl -I http://<host>:<port> # fetch response headers only
dig <name> # query DNS records for a name
nslookup <name> # simple DNS lookup
  1. Is the service listening?
Terminal window
ss -ltnp | grep <port>
  1. Is the interface up and does the host have the expected IP?
Terminal window
ip addr
  1. Is the route sane?
Terminal window
ip route
  1. Does DNS resolve the name you are using?
Terminal window
dig <hostname>
  1. Can you reach the endpoint from this host?
Terminal window
curl -v http://<host>:<port>
  1. If it is listening but still unreachable, check the local firewall with iptables -L -n, nft list ruleset, or firewall-cmd --list-all depending on the host.
  • 0.0.0.0:<port> means listening on all IPv4 interfaces.
  • 127.0.0.1:<port> means local only.
  • A healthy process can still be unreachable if it bound to the wrong address.

People often stop at “the service is running.” That is not enough. It also needs to be listening on the right port and bound to the right interface.