The Homelab Handbook

Practical guides for Linux servers, networking, and self-hosting.

Networking

Most server problems are networking problems wearing a disguise. Understand the path a packet takes and half your debugging is done.

DNS

DNS is the phone book. An A record maps a name to an IPv4 address; a AAAA record maps it to IPv6. Keep TTLs short (300 seconds) while you are changing things, and raise them once the setup is stable. Verify from outside your own network — your local resolver may cache a stale answer, so check with an independent resolver:

dig +short example.com @1.1.1.1
dig +short example.com @8.8.8.8

Reverse proxies

A reverse proxy (Caddy, Nginx) sits on ports 80 and 443 and forwards each request to the right backend service based on the hostname or path. This is how one machine serves many sites and services. The proxy terminates TLS, so backends can listen on localhost only — a service that never touches the public internet is a service that cannot be probed from it.

TLS certificates

Let's Encrypt issues free certificates and renews them automatically. The HTTP-01 challenge requires port 80 to be reachable from the internet and the domain to resolve to your server. If a certificate fails to issue, check DNS first, then check that nothing else is already bound to port 80.

Firewalls

Default-deny is the only sane posture: block everything, then allow exactly the ports you need. On Ubuntu, UFW is the friendly front end:

ufw default deny incoming
ufw allow 22/tcp
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable

Verify from the outside with a port scan. A rule you believe exists and a rule that actually exists are two different things.

TCP tuning

For high-bandwidth or high-latency links, the defaults are conservative. BBR congestion control with the fq queue discipline, larger socket buffers, and disabling slow-start-after-idle noticeably improves throughput on long-distance connections. Set them in /etc/sysctl.d/ and apply with sysctl --system, then measure — tuning without measurement is superstition.