Diagnose the complete path

Inspect local network state

Inspect interfaces, addresses, routes, neighbors, DNS, and listening sockets before changing anything.

8 minute lesson

~~~

Begin a diagnosis by recording the current state. You want facts about interfaces, addresses, routes, neighbors, name resolution, and listening processes — before you change anything, and before the situation changes on its own.

On Linux, four commands cover it:

ip address
ip route
ip neighbor
ss -lntup

Here’s what to look for in each. ip address should show your main interface UP with an inet line carrying a sensible address and prefix:

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500
    inet 192.168.1.20/24 brd 192.168.1.255 scope global dynamic

No inet line, or a 169.254.x.x address, means configuration failed — you can stop looking further out.

ip route must include a default via ... line, or only local destinations are reachable. ip neighbor shows whether your router’s entry is REACHABLE or stuck at FAILED — a failed neighbor entry means frames aren’t even crossing your own link.

ss -lntup lists listening sockets with their owning processes:

tcp LISTEN 0 4096 127.0.0.1:5432 users:(("postgres",pid=812,fd=6))
tcp LISTEN 0 511  0.0.0.0:80    users:(("nginx",pid=1401,fd=8))

Read the address column carefully. That PostgreSQL bound to 127.0.0.1 is invisible from other machines; nginx on 0.0.0.0 accepts from anywhere. A service “not responding” remotely while bound only to loopback is one of the most common findings this command produces.

The macOS equivalents

On macOS, start with ifconfig, netstat -rn, arp -an, ndp -an, and lsof -nP -i. They map one-to-one: interfaces, routes, IPv4 neighbors, IPv6 neighbors, and sockets with processes. Use dig on either system to inspect DNS answers:

dig +short flaviocopes.com
# 104.21.4.157
# 172.67.132.90

Facts first, changes later

Run only the commands you need and preserve their output — paste it into a note or redirect it to a file. Diagnosis is comparison: state now versus state when it worked, or this machine versus a healthy one. Output you didn’t save can’t be compared.

A missing address, unexpected default route, incomplete neighbor, or service bound only to loopback may already explain the symptom. My advice is to resist the itch to restart things until you’ve collected all four views. A restart destroys the evidence, and when the problem comes back next week, you’ll be starting from zero.

Lesson completed

Take this course offline

Get every free book and course as PDF and EPUB files.

Get the download library →