The tunnel itself is an hour's work: WireGuard on a rented server, a script that creates peers, and the official WireGuard apps on each device, with an ad-blocking DNS resolver as a bonus. What Surfshark rents out is the pool, with 4,500+ servers in 100 countries whose addresses are shared by many customers, plus a no-logs promise you take on trust or from audit reports. A server of your own has one fixed datacenter address tied to your hosting account, often blocked by streaming sites. It covers safe café Wi-Fi and a stable IP, not choosing a country or blending into a crowd.
Before you buildSurfshark has no free plan, and its low monthly prices are first-term rates. Compare the renewal price (about $6.58 a month for Starter after the first term) with a small server before you decide.
Build me a personal multi-server WireGuard setup with ad-blocking DNS to replace Surfshark's VPN. Requirements: - Node.js 22 + TypeScript CLI called `tunnel` (`commander`, `ssh2`, `qrcode`), installed with `npm link`. Servers are listed in tunnel.yaml (name, SSH host, user, key path, public IP); any Debian 12 or Ubuntu 24.04 VPS I can reach over SSH works, with no cloud API involved. - `tunnel server add <name>` installs wireguard and unbound over SSH, turns on IPv4 and IPv6 forwarding, opens only UDP 51820 and SSH in nftables, and enables unattended upgrades. Running it twice must change nothing. - DNS: unbound answers tunnel clients only and forwards over TLS to the resolver named in tunnel.yaml. It loads a blocklist built from StevenBlack/hosts into a local-zone file that a systemd timer refreshes weekly. `tunnel dns allow <domain>` exempts a site. - `tunnel peer add <name> --server <server>` makes keys locally with `wg genkey`, registers the peer with `wg set` (no restart), writes ./data/peers/<name>-<server>.conf routing 0.0.0.0/0 and ::/0 with the server as DNS, and prints a QR code for the official WireGuard app. - Storage: ./data/state.json with servers, peers and tunnel addresses; private keys stay in ./data with mode 600 and appear only inside that peer's config. - `tunnel check <server>` runs with the tunnel up and verifies the public IPv4 and IPv6 from IP_ECHO_URL (tunnel.yaml) equal the server's, DNS resolves over the tunnel, and a domain from the blocklist returns 0.0.0.0. Exit 1 on any miss. `tunnel status` shows handshake age and traffic. - No accounts, no telemetry, local-first: outbound calls are SSH, the blocklist download and the one echo request, all named in the README. - Out of scope: client apps (use the official WireGuard apps), multi-hop, obfuscation, streaming unblocking, a dashboard. - README: monthly cost per server and three plain warnings: sites see a datacenter address tied to my hosting account; streaming services often block those ranges; the host can see traffic metadata, so this swaps trust in Surfshark for trust in the host.
Opens your agent with the prompt filled in, you press enter. Or copy it and paste it into an empty folder.
The first prompt builds the core. Run these one at a time in the same folder to grow it into your own Surfshark.
Add per-peer routing profiles to the WireGuard setup in this folder. Requirements: - A peer can have a profile in tunnel.yaml: full (all traffic), split (only the listed CIDRs and domains go through the tunnel) or dns-only (only DNS goes through the server). - Regenerate that peer's config for the profile and rewrite its AllowedIPs; for domains in a split profile, resolve them at generation time and print a warning that addresses change. - `tunnel peer profile <name> <profile>` updates the server's allowed IPs with `wg set` without a restart. - Add a test that the generated AllowedIPs match each profile. - Update the README.
Add a health report to the WireGuard setup in this folder. Requirements: - `tunnel report` connects to every server over SSH and records disk use, uptime, `wg show` handshake ages, pending security updates and the blocklist's age. - Write ./data/report-YYYY-MM-DD.md with a table and a line per problem. - Exit 1 when a server is unreachable or a handshake is older than 7 days for a peer marked active. - Print a ready-made cron line that runs it weekly and mails the report with the system mail command. - Update the README.
Add key rotation to the WireGuard setup in this folder. Requirements: - `tunnel peer rotate <name>` makes a new key pair, registers it on the server, writes the new config and QR code, and removes the old public key after I confirm the new tunnel connects. - Keep the previous config in ./data/peers/old/ for 7 days so a half-finished switch can be undone. - `tunnel peer ls` shows the age of each key and flags any older than 180 days. - Add a test with a mocked SSH layer for the order of the steps. - Update the README.
People rent a VPN to look like someone else, not only to encrypt: an address in another country is what opens a foreign catalogue, a local price or a blocked site. The apps work on any device with one tap, and the intro price is lower than a server plus the evenings spent when it breaks. A self-hosted tunnel only moves your trust from Surfshark to your hosting company.
Estimate · A one-core VPS at a budget host costs a few dollars a month and includes plenty of traffic; each extra country is another server at the same price. The build is token usage on your agent plan.
| Plan | Monthly | Annual, per month | What you get |
|---|---|---|---|
| Starter | $16.45 | $3.39 | The VPN on unlimited devices plus the Alternative ID tool. |
| One | $18.95 | $3.39 | Everything in Starter plus antivirus, Surfshark Search, identity tools and scam, message and call protection. |
| One+ | $21.85 | $6.99 | Everything in One plus Incogni data removal and identity-theft coverage. |
Not really. People rent a VPN to look like someone else, not only to encrypt: an address in another country is what opens a foreign catalogue, a local price or a blocked site. The apps work on any device with one tap, and the intro price is lower than a server plus the evenings spent when it breaks. A self-hosted tunnel only moves your trust from Surfshark to your hosting company. The prompt on this page builds the closest honest substitute.
About $16.45 a month on the Starter plan, $197.40 a year (checked 2026-10-20).
Servers in 100 countries; your own setup has one location per VPS you rent; Shared addresses that many customers use, so a site can't tie the IP to you; Access to streaming libraries that block datacenter address ranges; Polished apps with a kill switch and one-tap server switching on every platform; The extras on higher plans: antivirus, breach alerts and, on One+, Incogni. If any of those matter to you, keep paying.
Yes: wg-easy (open source), Algo VPN (open source), PiVPN (open source).