→ From Coder to Shipper
From Coder to Shipper · Infrastructure

VPNs — a private, encrypted tunnel

Your VPS has an admin panel, a database and SSH. A VPN lets your laptop and phone reach them privately and encrypted — with WireGuard and Zerotier, the two tools every shipper should know.

← / → to navigate · EN/VI switch below · the operator's view — mental model first, a few small examples

The problem

Everything on your VPS is public by default

The moment you deploy, your machine has a public IP — visible to every scanner, crawler and script on the internet.

A public IP

Your VPS has an address like 203.0.113.10. Anyone who knows it — and bots know everything — can try every port on it.

Open ports are doorways

Every service you start on a port is reachable from anywhere: Grafana on :3000, your admin on :8080, Postgres on :5432, SSH on :22.

Scanners never sleep

Bots constantly scan the internet for known admin panels and default credentials. An exposed Grafana gets found within hours, not days.

You need a door that locks

Your website can stay public. But admin tools, databases and SSH should be reachable from your devices — and only your devices.

The picture

Today: the internet walks straight in

No tunnel yet — every service answers anyone who asks.

anyone
Your laptop / phoneyou, logging in
→over the public internet
VPS — 203.0.113.10 open to the whole world
Grafana:3000
App admin:8080
Postgres:5432
SSH:22

Same boxes, same ports — but now every one of them also answers the credential-stuffing bots. That is the problem this whole deck solves.

The best attack surface is the one that doesn't exist — keep your admin tools off the public internet entirely.
— the operator's motto
01
Part 1

The mental model — what a VPN actually is

One idea, two jobs: an encrypted pipe and a private network. Get this and WireGuard vs Zerotier becomes easy.

The core

A VPN does two jobs

(a) It encrypts

Everything you send through the tunnel becomes unreadable gibberish to anyone on the wire — your ISP, the café Wi-Fi, anyone sniffing. Encryption = nobody can read your traffic.

(b) It builds a private network

Your devices get internal addresses (like 10.0.0.2) and can reach each other — and your VPS — as if you were all plugged into one LAN at home.

The overlay

A VPN network is an 'overlay': a private network laid over the public internet. The internet carries the tunnel; the tunnel carries you.

Not the same as HTTPS

HTTPS protects one browser tab talking to one site. A VPN protects every app on your whole device — and adds the private network on top.

The picture

A private tunnel over the public internet

Laptop + phone → the tunnel → private net → VPS admin. The internet only ever sees an encrypted blob.

Laptop10.0.0.2
Phone10.0.0.3
→encrypts
The tunnelciphertext over the internet
→10.0.0.0/20
VPS — 10.0.0.1 admin · DB · SSH

From inside the tunnel, the VPS is just a neighbour on your LAN — addressed by its private IP, no public admin ports at all.

Two jobs, two problems solved

Why each job matters

Encryption answers: 'who's listening?'

On a shared network — café, airport, hotel — traffic is easy to capture. Encrypted, the capture is useless: ciphertext, no keys, no reading. Your admin login and data can't be sniffed in transit.

The overlay answers: 'how do I reach it?'

Your laptop at the café and your VPS live on different networks — no route between them. The overlay gives both an address in the same private network, so 'reach 10.0.0.1' just works, from anywhere, over any connection.

The detail that makes it click

Internal IPs — the same trick as your home Wi-Fi

10.x.x.x is private

Ranges like 10.0.0.0/20 don't route on the public internet — they only exist inside your overlay. Your home router does the exact same thing with 192.168.x.x.

The VPS is the endpoint

On the VPS you run the tunnel's server (WireGuard or Zerotier). It takes 10.0.0.1, and every device in the tunnel can address it directly — no DNS, no public ports for admin.

From anywhere, on any network

Café Wi-Fi, 4G, hotel, office — doesn't matter. Inside the tunnel you're on the same private network, so the admin panel is just 'http://10.0.0.1:3000'.

02
Part 2

Why, on a VPS

The operator's move: put your product on the public internet, and everything you manage behind the tunnel.

The split

What belongs behind the tunnel

Admin panels

Grafana, your app's admin, the dashboard where you make things happen. One exposed login form is a magnet for credential stuffing.

Databases

Postgres or Mongo on :5432/:27017 should never answer strangers. If they did, they'd answer bots — and bots already have SQL ready to go.

SSH

:22 is the most scanned port on earth. Behind the tunnel your shell is reachable from your laptop — not from a botnet.

…and what stays public

Your website, public API, docs, checkout — the things your users need. Public is fine (and good) for them. The rule is about tools, not products.

The picture

The secure back door

The internet sees one door. Your devices hold the key.

public
Internet — everyoneusers + scanners
→:443
VPS — website + APIopen, as it should be
private
Your laptop / phoneyou, via the VPN tunnel
→10.0.0.0/20
VPS — 10.0.0.1
Grafana:3000
Postgres:5432
SSH:22

Same VPS, same services — now reachable only from inside the tunnel. The scanner keeps knocking; nothing admin answers.

The rule of thumb

Expose your product, hide your tools

Expose — the product

The website, the public API, the docs, the checkout. Users need them, and HTTPS already protects the data in transit. Exposure here is the point.

Hide — the tools

Grafana, the admin panel, the database, SSH, backup endpoints. Nothing here has a legitimate stranger. If you can't name who should reach it, keep it behind the tunnel.

If a stranger could open it, it's not an admin panel — it's an invitation.
— the tunnel's job, in one line
03
Part 3

WireGuard — your own keys, your own server

The modern default for a self-hosted tunnel: tiny, fast, and simple enough to hold in your head.

The tool

WireGuard in one breath

Modern

Designed in 2013, released in 2016. Newer than OpenVPN, built on modern crypto (ChaCha20-Poly1305), and it lives in the Linux kernel — so it's fast.

Simple

The whole protocol is a few thousand lines of auditable code. No hundreds-of-pages config to fear — a small INI file per device, that's it.

Key-pair model

Every device has a private key (its secret) and a public key (its name). The server only opens the door for public keys you have told it to trust.

You host it

The server runs on your VPS. That's the trade: full control, zero service — you generate the keys, write the config, and keep them safe.

The flow

WireGuard, in five moves

  1. 1

    Generate keys

    On the VPS: wg genkey gives the server's private key, and the matching public key. Each device gets its own pair the same way.

  2. 2

    Server config

    The server takes an interface on a private subnet — say 10.0.0.1/20 — listens on a port (51820), and lists each trusted client under a [Peer] section.

  3. 3

    One [Peer] per client

    Each [Peer] holds the client's public key and its AllowedIPs — the one private address it may use, e.g. 10.0.0.2/32. New laptop? Add a [Peer].

  4. 4

    Client config

    The client's config points at the server's public IP (Endpoint = 203.0.113.10:51820), carries the server's public key, and claims its own private address.

  5. 5

    Tunnel up

    Load the config in the client app. Instantly your laptop is 10.0.0.2 on the private net — and 10.0.0.1 (the VPS) is reachable by its internal address.

A tiny sketch

Server config — /etc/wireguard/wg0.conf

wg0.conf
[Interface]
# the VPS: server end of the tunnel
Address = 10.0.0.1/20
ListenPort = 51820
PrivateKey = <server-private-key>

[Peer]
# Alice's laptop — the only client we trust
PublicKey = <alice-public-key>
AllowedIPs = 10.0.0.2/32

Two sections: [Interface] is the server itself; [Peer] is one trusted client. More clients = more [Peer] blocks.

A tiny sketch

Client config — alice's laptop

alice.conf
[Interface]
# Alice's laptop, inside the tunnel
Address = 10.0.0.2/20
PrivateKey = <alice-private-key>

[Peer]
# the VPS — the server end
PublicKey = <server-public-key>
Endpoint = 203.0.113.10:51820
AllowedIPs = 10.0.0.0/20

The client's [Peer] is the server. Endpoint = the VPS's public IP; AllowedIPs = 'everything in the private net goes through the tunnel'.

Checking in

wg show — who's on the network

On the server, one command tells you every peer and whether it's actually alive.

ops@vps — zsh
# bring the tunnel up (one-time)
$ sudo systemctl enable --now wg-quick@wg0
$ wg show
interface: wg0
public key: 9FqK...serverPublicKey
endpoint: 203.0.113.77:51820
allowed ips: 10.0.0.2/32
last handshake: 3 minutes ago
transfer: 1.2 MiB received, 890 KiB sent
The honest trade

WireGuard's strengths and its chores

Small

A few thousand lines of code, audited by many eyes. Fewer lines, fewer holes — and the config is small enough to read end to end.

Fast

Modern crypto in the Linux kernel. You genuinely won't feel the difference — it's just free performance.

Yours to manage

Every device = generate a key pair, paste the public key into a [Peer], hand the private config to that device. Private keys never travel in the open.

When it gets fiddly

Ten devices, three networks, a phone that keeps reconnecting — that's when the bookkeeping of keys and configs starts to feel like a job.

04
Part 4

Zerotier — a virtual LAN as a service

The same private-network idea, with the coordination outsourced to the cloud.

The tool

Zerotier in one breath

A network is an ID

You create a Zerotier network in the cloud and get a 16-digit ID, like 914b7c2a5d6e8f30. That ID is the whole 'server' — there is no server of yours.

Join, and you're on the LAN

Every device runs the Zerotier client and joins with that ID. Inside the network, every device can reach every other by its internal Zerotier address.

Coordination lives in the cloud

Zerotier's cloud acts as the address book: it knows who's in the network and introduces members to each other. After the intro, traffic goes device-to-device.

No ports to open

Members reach out to the cloud and to each other outbound — NAT traversal handles the awkward cases, with cloud relay as the fallback. Nothing inbound, ever.

One command

Joining your Zerotier network

The network ID comes from the Zerotier admin console. That's the entire setup on this machine.

ops@vps — zsh
$ zerotier-cli join 914b7c2a5d6e8f30
OK joined 914b7c2a5d6e8f30
$ zerotier-cli peers
914b7c2a5d6e8f30 ONLINE
# your VPS also joined the same network — you can reach it by its internal address now
Under the hood

What the cloud does — and doesn't do

It's a directory, not a pipe

After the cloud introduces two members, their traffic flows peer-to-peer, encrypted. The cloud sees who's talking to whom — but not what they say.

NAT traversal

Behind home routers and 4G, devices usually still manage to punch direct paths to each other. When they can't, Zerotier's relay carries the traffic — slightly slower, still private.

Identity in the cloud

Your members' identities live in Zerotier's cloud, managed from a web console. Convenient — and one more trust to weigh in the decision.

Access rules

The console lets you allow/deny specific members, or whole subnets. Kick a laptop = flip one switch in the browser.

05
Part 5

Choosing — WireGuard vs Zerotier

Same destination — a private, encrypted network. Two very different ways to run it.

Side by side

WireGuard vs Zerotier

The same private network, two operating models.

WireGuardZerotier
Who coordinatesYou — the server on your VPSZerotier's cloud
Runs onyour VPS, kernel moduleclient apps + their cloud
Config efforta small INI per device, keys to manageone join command per device
Ports to openone (e.g. 51820/udp) on the VPSnone — outbound only
Removing a devicedelete its [Peer] blockone switch in the web console
Good fitone VPS + your machines, full controlmany devices, fast setup, no ports
The mental contrast

One sentence each

WireGuard

You self-host and manage the keys. Maximum control and simplicity — the server is a small program on your VPS, and every trust decision is yours.

Zerotier

Managed cloud coordination, less config. You trade a bit of control and one external dependency for near-zero setup and a console to manage members.

Around the main two

OpenVPN in one line — and where the client runs

OpenVPN

The older, extremely common workhorse — you'll meet it in companies and older tutorials. Same job, more config, more moving parts. For a new VPS in 2026, start with WireGuard or Zerotier.

The client is an app

WireGuard and Zerotier both ship client apps for macOS, Linux, iOS and Android. On your phone it's literally: open the app, load the config (or join the ID), toggle it on.

The practical default

One VPS + your laptop and phone? WireGuard — it's small, fast, and fully yours. A dozen devices, no ports allowed, or you just want it done today? Zerotier.

The VPN is the secure back door to your infrastructure — the internet gets your product, and your tools stay behind the tunnel.
— that's the whole lesson

Now go ship — with a door that locks

Website public, admin private: pick WireGuard or Zerotier, put the tunnel on your VPS, and never open an admin port to the world again.