appzasGamesToolsDevLearnCheat sheetsQuick calcsConvertersReferenceNetworkTimeCalculatorsCompareLLM prices

Network troubleshooting from the terminal

Lesson 4 of 412 minIntermediate

Check addresses, routes, open ports, DNS and HTTP, in that order.

Work from the bottom up. Each layer must work before the next one can.

  1. Do I have an address and a route? ip addr and ip route.
  2. Can I reach the gateway and the internet by IP? ping -c 3 192.168.1.1 then ping -c 3 1.1.1.1.
  3. Does a name resolve? dig example.com or getent hosts example.com.
  4. Is the port open? nc -vz example.com 443 or curl -v https://example.com.
  5. Is something listening locally? ss -tlnp.
ip -br addr                 # short list of interfaces and addresses
ip route                    # default gateway
ss -tlnp                    # listening TCP ports and their processes
dig +short example.com      # resolved addresses
curl -I https://example.com # response headers only

Reading the result

  • Ping by IP works but by name fails: a DNS problem.
  • Name resolves but the connection times out: a firewall or routing problem.
  • Connection refused: the host answers but nothing listens on that port.

Noteping can be blocked by a firewall even when the service works. A failed ping alone does not prove the host is down.

Test yourself

Answer all the questions, then check them. Finish with every answer right to mark the lesson as done.

1. ping 1.1.1.1 works but ping example.com fails. What is likely broken?
2. What does "connection refused" usually mean?
Hintss -tlnp

Key terms