ping, dig, curl & ss
Is it reachable?
Lesson 19 of 20 · 12 min · Module 6: Networking from the shell
When "the site is down", a network engineer checks each layer in turn: can I reach the host, does the name resolve, does the service answer, and is it listening?
Start this lesson →Free. No installation: you write and run the code in your browser, and it is checked automatically.
By the end, you’ll be able to…
- Test reachability with ping
- Resolve names with dig
- Check a service with curl and ss
The idea
ping -c 2 host sends two test packets. dig +short name asks DNS for an address. curl url makes a web request and prints the response. ss -tuln lists ports on which this machine is listening (t = TCP, u = UDP, l = listening, n = numbers).
ping -c 2 192.168.1.1
dig +short codetemper.com
curl http://localhost:8080/health
ss -tuln
01Work from the bottom up
ping tests basic reachability. dig tests DNS. curl tests the application. Each check rules out a layer, so you know where to look next.
02Read ping statistics
0% packet loss with low times means the path is healthy. "Destination Host Unreachable" or 100% loss means the host or the route is the problem, not the website.
ping -c 1 10.9.9.9From 192.168.1.50 icmp_seq=1 Destination Host Unreachable03Listening is not the same as reachable
ss shows 127.0.0.1:5432 for the database: it listens, but only for this machine. 0.0.0.0:80 listens on every interface. curl to a port with nothing listening gives "Connection refused".
Your turn
192.168.1.1 exactly 2 times. Look up the address of codetemper.com with dig +short. Request http://localhost:8080/health with curl. Finally, list the listening ports with ss -tuln.What the checks look for
- Pings the gateway exactly twice
- Resolves codetemper.com to 203.0.113.10
- Gets the health response
- Shows port 8080 listening
Take this with you
Check layer by layer: reach the host, resolve the name, ask the service, confirm it listens.
Go a little further
Use curl -I http://codetemper.com to see a redirect and its location header.