C.W.K.
Stream
Lesson 12 of 12 · published

Network Diagnostics

~18 min · ping, traceroute, dig, lsof, diagnostics

Level 0Pinger
0 XP0/101 lessons0/12 achievements
0/150 XP to next level150 XP to go0% complete

Your day-one diagnostic kit

Before we head into SSH, lock in the network diagnostic muscle-memory. When something doesn't work, the right tool in the first 10 seconds saves an hour of guessing. This is the table I keep mental-pinned.

QuestionToolCommand
Is the host alive?pingping -c 4 host
Where does the path break?mtr / traceroutemtr host
Does the name resolve?digdig +short domain
What's my config?ifconfig / ipifconfig en0
What's using a port?lsoflsof -i :8000
What ports are listening?ss / netstatss -tuln
What's the gateway?route / netstatnetstat -rn
Is a TCP port open?ncnc -zv host port

The ladder

Walk the ladder bottom-up: gateway, internet, DNS, target, port, app. Each rung either passes or fails — when one fails, you've found the layer. Tracks 5 and 7 dig deeper into each tool; this lesson exists to imprint the order.

Code

The 60-second connectivity ladder·bash
# 1. Interface up?
ifconfig en0 | grep status

# 2. Gateway reachable?
ping -c 3 $(route -n get default | awk '/gateway/ {print $2}')

# 3. Public internet reachable (no DNS)?
ping -c 3 1.1.1.1

# 4. DNS works?
dig +short github.com

# 5. Specific service reachable?
nc -zv github.com 443

# 6. Application healthy?
curl -sI https://github.com | head -1

External links

Exercise

Pick a service you use (GitHub, your bank, a streaming site). Walk the ladder against it: ifconfig → ping gateway → ping 1.1.1.1 → dig the hostname → nc -zv host 443 → curl -sI the URL. Time yourself — under 60 seconds is the goal. When this is muscle memory, troubleshooting becomes "oh, hop 4" instead of "hmm."

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.