Debugging instead of guessing
A method instead of a hunch: walk the layers in a fixed order, start with the cheapest check, isolate one suspect at a time, and know exactly what each tool proves.
Troubleshooting a network is not about knowing more commands. It is about replacing guesses with a sequence of questions whose answers cannot be argued with. The method has three rules. Start with the check that is cheapest in time and rules out the most. Change exactly one thing at a time. And after every test, ask what the result proves and what it does not prove — a test that could have passed for two different reasons has told you nothing.
Cheapest first means: before you touch a configuration, ask whether the thing works at all from here, and whether it works from somewhere else. Comparing two vantage points costs one command and splits the problem space in half. Asking the user to try a different network, or running the same request from a different machine, is usually worth more than an hour of reading logs.
The ladder of questions, from the bottom: does the machine have an address at all, and a default route? Does the name resolve to an address? Does the address answer at the IP level? Is the port open, and does the service answer on it? Does the application return a correct answer? Each question is answered by a different tool, and each answer narrows the suspect until only one layer is left. The point of the ladder is that it eventually ends: a good debugging session shrinks the set of possible causes instead of growing it.
Each tool proves something narrow, and using it for more than that is how people reach wrong conclusions. ping proves that a host answers ICMP and that a path exists in both directions; it does not prove a web server is running. dig proves what a resolver answered and how long the answer is cached; it does not prove that the address is reachable. curl proves what the whole stack does for one concrete request; it does not prove that other clients get the same answer. ss proves what is actually listening on this machine and on which address; it does not prove that a firewall lets anyone in.
$ dig api.example.org +short
198.51.100.20
$ dig api.example.org +short
198.51.100.20
$ dig api.example.org @1.1.1.1 +short
203.0.113.7
$ dig api.example.org @8.8.8.8 +short
203.0.113.7Two resolvers, two different answers — a cache and a stale record, not a broken network.$ curl -v https://api.example.org/health
* Trying 198.51.100.20:443...
* connect to 198.51.100.20 port 443 failed: Connection timed out
* Failed to connect to api.example.org port 443: Connection timed out
$ curl -sv https://api.example.org/health -o /dev/null
* Trying 93.184.216.34:443...
* Connected to api.example.org (93.184.216.34) port 443
* Server certificate: CN=*.example.org
< HTTP/2 200
< content-type: application/jsonThe same command with a timeout on the port and with the address that actually works.ss deserves special attention because it separates two failures that look identical from outside: nothing is listening, or something is listening but only on the loopback address. A server bound to 127.0.0.1 accepts connections from the same machine and refuses every connection from outside, no matter what the firewall says. That single distinction explains a large share of the cases where the service works locally and is unreachable from anywhere else.
$ ss -tlnp
State Local Address:Port Process
LISTEN 127.0.0.1:8080 users:(("node",pid=4127,fd=21))
LISTEN 0.0.0.0:22 users:(("sshd",pid=880,fd=3))
$ curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:8080/
200One service is reachable from the network, the other only from this machine.Practice
Build the isolation ladder: order the checks for a site that does not open, from the first thing you can test to the last.
Click the source node, then the node it points to. Click a pair again to remove it.
Hints
- Each step asks a different layer, so order them from the simplest question to the most specific one.
- A name has to become an address before there is anything to reach, and a port can only be tested once the address answers.
- The application response is the last thing you can possibly observe, so it belongs at the end of the chain.
A colleague says the API is down. On their machine, dig returns 198.51.100.20 and curl to port 443 times out. On your machine the same dig returns 203.0.113.7 and curl returns 200. What is the most likely explanation?
Hints
- Their ping by name already proves two separate things: the name resolved and packets travel.
- Compare the two dig answers: one comes from the local resolver, the other from a public one.
- Ask what is different about the two machines rather than what is wrong with the server.
Order the first four steps for investigating a page that loads slowly for some users in one city.
- 1run curl -v to see the resolved address and which phase is slow
- 2repeat from a second location to tell distance apart from a local problem
- 3repeat the same request on a warm connection to separate handshake cost from transfer cost
- 4reproduce the slowness from the affected location and write down the timings
Hints
- Start with the question that costs nothing and rules out an entire layer if it fails.
- curl -v names the host, the resolved address and the port it is about to use, in that order.
- Repeat the same request twice from the affected location and compare the two timings before blaming anything else.
Questions about this lesson
Why should I learn networking at all?
Almost everything you build eventually talks to something else. Knowing how data actually travels turns "it does not work" from a mystery into a list of things you can check one by one.
What is the real difference between TCP and UDP?
TCP makes sure every piece arrives, in order, and retries anything lost — which costs time. UDP sends and does not look back, which is why live video and games prefer it: a late frame is worse than a missing one.
What is DNS in plain words?
It is the phone book of the internet. You know the name, the computer needs the number. DNS turns a name like example.org into an IP address, and caches the answer so it does not ask every time.
Is it free?
Yes. The first level of every subject is free and needs no account. Deeper levels and the senior grades are paid — that is what keeps the project running.
What age is this for?
It is written for curious teenagers from about 12 and for adults starting from zero. Nothing assumes prior programming experience; lessons about networking and physics need no mathematics beyond school level.
Do I need to know programming already?
No. The logic, physics and networking tracks start from nothing. The languages track is where you actually write code, and it also starts from the beginning.
Do I need to install anything?
No. Everything runs in the browser: theory, practice and the interactive simulations. There is nothing to download and no environment to configure.
How long does one subject take?
A lesson takes 10 to 15 minutes. A junior grade is roughly 12 to 20 lessons, so expect a few weeks of steady practice rather than one evening.
Do I have to follow the order?
Within a grade, levels open one after another, because each builds on the previous one. Between subjects you are free: start with logic, physics or networking.