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.
Core commands
Section titled “Core commands”ip addr # show network interfaces and assigned IPsip route # show the routing tabless -ltnp # show listening TCP ports and owning processesss -lunp # show listening UDP ports and owning processesping <host>curl -I http://<host>:<port> # fetch response headers onlydig <name> # query DNS records for a namenslookup <name> # simple DNS lookupFast workflow
Section titled “Fast workflow”- Is the service listening?
ss -ltnp | grep <port>- Is the interface up and does the host have the expected IP?
ip addr- Is the route sane?
ip route- Does DNS resolve the name you are using?
dig <hostname>- Can you reach the endpoint from this host?
curl -v http://<host>:<port>- If it is listening but still unreachable, check the local firewall with
iptables -L -n,nft list ruleset, orfirewall-cmd --list-alldepending on the host.
What matters
Section titled “What matters”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.
Common mistake
Section titled “Common mistake”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.