Linux Networking from Zero
Tested 2026-11-27 on Ubuntu 22.04.4 LTS host (Linux 6.8), 4-core Arm Neoverse-N1 (aarch64), 23 GB RAM; Docker Engine 29.1.3 · with Ubuntu 26.04.1 LTS (ubuntu:26.04 image), iproute2 6.19.0, iptables 1.8.11 (nf_tables), nftables 1.1.6, tcpdump 4.99.6, curl 8.18.0, Docker Engine 29.1.3 · by the fromzero project · CC BY 4.0
Your app calls another service, and all you get back is one line: Could not connect to server.
That same line comes from at least three different problems. Nothing is listening, there’s no route, or nobody on the network has that address. The only visible difference is how long it took: 0 ms, 0 ms or 3 seconds.
So people guess: restart the container, open the firewall, blame DNS. But every connection asks the same six questions in the same order.
Ask them one by one with the right Linux tool, and the first “no” is your problem.
This course builds networks with you from zero, inside one container on your own computer: namespaces as machines, virtual cables, a router, a switch, a firewall. You build each piece yourself, so you know what each tool’s output means and what breaks when it’s missing.
By the end you’ll be able to:
- read a machine’s interfaces, addresses, routes, neighbours and listening sockets, and say what each one means for a connection;
- connect isolated “machines” with virtual cables, a bridge and a router, the way Docker does;
- tell “refused”, “unreachable”, “no route to host” and “timed out” apart, and know which part of the system each points to;
- write firewall and NAT rules that let in only what you mean;
- trace “it can’t connect” step by step with a script you wrote yourself, and say where it breaks.
How it works
Each lesson starts from zero with an animated, step-by-step picture (press Play, or step with the arrow
keys), then explains in plain words, with optional Go deeper sections. Each practical has you build the
network yourself, with requirements, a hint, a hidden solution, a “predict first” question and a part where you
break it on purpose. One script, ./lab, checks your work:
./lab setup pNgets what a practical needs that isn’t its topic (in Practical 0, just a check that Docker runs)../lab check pNtells you whether your lab is right. Checks only read, except p3’s: it breaks your lab on purpose, one way at a time, and undoes each break../lab reset pNrebuilds the lab as the earlier practicals left it, when an experiment went too far.
All you need is Docker Engine on your Linux server, and a few hundred MB of disk. Everything runs inside one lab container that you start yourself.
Path
| Lesson | Practical | You’ll be able to |
|---|---|---|
| 1 · What happens when you connect | name the six questions every connection asks, and match an error to one | |
| 2 · The Linux network stack | 0 · Your lab: two namespaces and a cable | read the five tables; build two machines and a cable; diagnose an unplugged cable |
| 3 · IP addresses and subnets | say which addresses are on your link and which need a router | |
| 4 · Routing | 1 · A router between two networks | route between networks, and trace a missing route |
| 5 · ARP and bridges | see how a frame finds a machine on a link; build a switch | |
| 6 · Ports, sockets and TCP | 2 · A switch and a service | watch the handshake; tell refused from timed out |
| 7 · Firewalls and NAT | drop, reject, masquerade and forward ports with iptables and nft | |
| 8 · What really happens when you run curl | 3 · Capstone: netcheck | trace a connection end to end; write a script that names the broken step |
What your folder will look like
~/linux-networking-zero/ on your computer, and at the same path inside netlab
├── lab the lab script: ./lab setup|check|reset pN
├── lab.log every command ./lab ran, with its output
├── on your 5-line script: ./on opens a shell in netlab (Practical 0)
├── p0.sh rebuilds red and blue after a restart (Practical 0)
├── ... one script per practical: p1.sh, p2.sh, p3.sh
└── netcheck/ your capstone: the netcheck script (Practical 3)