Secure private network

Self-Hosted VPN Exit Nodes: Control, Tradeoffs, and Tests

By the OpenFactory Team · February 10, 2026

← Back to Blog

A VPN encrypts traffic between a client and a gateway. It does not make the traffic disappear, make the endpoint trustworthy, or protect the path after packets leave that gateway. Self-hosting changes who operates the gateway; it does not remove the need for trust.

This post is about the exit: the public IP the rest of the internet sees when you browse, and who controls the box behind it. That is the job a commercial VPN sells you, and the one you can do better yourself. (If you instead want to dial into your home LAN to reach a NAS or a camera, the relevant pattern is a remote-access VPN, covered in our companion post on building a private home VPN. Same software, opposite direction of traffic.)

Your own exit node versus a commercial provider’s shared exitYour own VPNYour deviceone managed clientencryptedYour VPS exitdedicated IPInternetCommercial providerUser AUser B+ thousandsShared exit IPshared reputationInternet
Two common exit models. A dedicated exit offers direct policy control but is easier to correlate with one operator; a shared exit offers crowding but inherits other users' reputation and the provider's policies.

Map the Trust Boundary First

With a managed VPN, you depend on the provider's identity controls, gateway configuration, logging policy, infrastructure operators, and legal environment. With a self-hosted exit, you depend on your own configuration plus the hosting provider, upstream network, DNS choices, patch process, and incident response. In either model, HTTPS and other end-to-end protocols still matter because the VPN tunnel ends at the gateway.

NIST's remote-access guidance makes the same boundary explicit: a tunnel protects communications between the client and VPN gateway, not the traffic beyond the gateway or data on the client. Start with that model, then decide whether direct operational control is worth the added responsibility. Read NIST SP 800-46 Rev. 2.

A self-hosted gateway is a different trust arrangement, not a blanket privacy or security upgrade.

Compare the Two Operating Models

Evaluate the properties that matter to your threat model:

  • Shared IPs.A shared exit can provide a larger anonymity set, but its reputation depends on unrelated users. A dedicated exit avoids that shared history while making one address easier to associate with its operator.
  • Bandwidth throttling.A managed service pools capacity and operates multiple regions. A self-hosted node has the bandwidth, availability, and peering of one host unless you design and test redundancy.
  • Jurisdiction roulette.Both models depend on the laws and operators around the gateway and upstream network. Document where the host runs, who administers it, and what records each layer can retain.
  • The business model.Managed services take on patching, abuse response, region failover, and client support. Self-hosting gives you more configuration control and gives you those duties too.

Build Your Own Instead

This prompt builds a full-tunnel WireGuard exit node. Unlike the split-tunnel road-warrior design, it deliberately routes client internet traffic through the gateway and enables outbound masquerading.

Build and validate a self-hosted WireGuard exit node named `private-exit` as a BUILD_PLAN.

Create one `device_kind=linux-build` node named `exit-gateway` on Debian Trixie with `headless`, `ssh`, and `vpn-wireguard`, plus iptables, tcpdump, iproute2, curl, and nftables. Give it `172.31.212.10/24` on a `wan` network with gateway `172.31.212.1` and `is_default_route=true`.

Set `plan.vpn` to protocol `wireguard`, implementation `linux`, mode `roadwarrior`, authentication `public-key`, tunnel CIDR `10.252.12.0/24`, listen port `51820`, and DNS servers `9.9.9.9` and `149.112.112.112`. The endpoint is `exit-gateway`, public endpoint `172.31.212.10`, and protected subnet `0.0.0.0/0`. Generate full-tunnel profiles named `laptop` and `phone` with `full_tunnel=true`. The generated gateway configuration must enable forwarding and outbound masquerading; never embed keys in the recipe.

Add a group scenario on `exit-gateway` that verifies `wg show wg0` reports UDP port `51820`, IPv4 forwarding is `1`, and the NAT POSTROUTING table contains a MASQUERADE rule. Keep all private keys in the owner-only deployment bundle.

The prompt produces a reviewable build plan for a Debian gateway. A completed image is only the starting state: deploy private keys outside the recipe, replace the illustrative endpoint and addressing, configure the actual cloud or router forwarding path, and run the acceptance checks below before relying on the tunnel.

Distinct Use Cases, Distinct Policies

A self-hosted VPN can support several network patterns. Each needs its own routes, access policy, and failure tests:

  • Remote work.Reach selected home or office subnets through an authenticated tunnel. Endpoint discovery, firewall exposure, DNS, and least-privilege routes still need explicit configuration.
  • Travel.Protect client-to-gateway traffic on an untrusted access network. The exit network and destination still see traffic that is not protected end to end.
  • IoT isolation.Route a constrained device segment through a policy gateway. A tunnel does not itself isolate devices; VLANs, firewall rules, egress policy, and tests do.
  • Site-to-site.Connect explicitly routed subnets. Avoid overlapping address space and test routing, key rotation, peer loss, and fail-closed behavior on both sides.
  • Ad blocking.Advertise a resolver through the tunnel, then verify that each client uses it and define what happens when it is unavailable. DNS filtering is separate from transport encryption.

Choose a Protocol Deliberately

The prompt above specifies WireGuard. IKEv2/IPsec through strongSwan is a separate design option, with a different policy, certificate, and client- interoperability surface:

StrongSwan IKEv2

  • Native client support.Several operating systems include IKEv2 clients, while others use a strongSwan or NetworkManager client. Verify the exact authentication method and platform support you intend to operate.
  • Enterprise-grade.IKEv2 supports certificate and EAP authentication, and some clients support MOBIKE for address changes. The strongSwan documentation also requires careful proposal, credential, and traffic-leak decisions.
  • Firewall-friendly.NAT traversal commonly uses UDP 500/4500. Network policy can still block either path, so test from representative client networks and retain a recovery route.

WireGuard

  • A deliberately small protocol surface. WireGuard documents formal-verification work for parts of its protocol and implementation, including a Tamarin symbolic model. That evidence does not verify your keys, host, firewall, client, or deployment. You can review the WireGuard verification scope.
  • Modern, opinionated crypto.WireGuard fixes its protocol primitives rather than offering a general cipher- suite negotiation surface. Operational mistakes remain possible around keys, peers, routes, DNS, and firewall policy.
  • Measure performance.Throughput and latency depend on CPU, MTU, network path, implementation, and workload. Do not turn an implementation choice into an unmeasured speed claim.
  • Simpler config.The base peer format is compact. Production operation still needs endpoint discovery, key distribution and revocation, routes, DNS, monitoring, and recovery procedures.

Choose from client support, authentication requirements, policy model, network constraints, and the team's ability to operate the result. Running both expands the attack and maintenance surface; it is not a default requirement. strongSwan's security recommendations are a useful review boundary for an IKEv2 design.

Compare Total Operating Cost

Compare current provider or hosting prices at the time you decide. Include data transfer, snapshots, additional regions, monitoring, domain or address needs, replacement hardware, and operator time for updates and incidents.

A home gateway can reuse hardware but inherits the availability and upstream bandwidth of that site. A cloud gateway can offer a stable endpoint but adds a hosting provider, egress policy, and possible data-transfer charges to the trust and cost model.

Self-hosting may cost less or more. The defensible benefit is direct control over a defined configuration, not the absence of cost, logs, or trust.

What You Trade, and What to Lock Down

Owning your exit is not strictly better at everything. One trade-off is that a dedicated IP is yours alone, so it doesn't blend you into a crowd the way a busy commercial exit does. You swap “hide in the herd” for a smaller, more attributable operating boundary. It also concentrates availability, configuration, and incident response in one place. A single self-hosted node is not an anonymity system and is not designed to resist a global observer.

Running the box means owning an ongoing maintenance and recovery checklist. Treat the build plan as draft intent and verify at least these controls yourself:

  • Test fail-closed routing: route the intended IPv4 and IPv6 prefixes through the tunnel, add explicit firewall policy for the non-tunnel path, then stop the interface and observe whether traffic leaks. A configuration line is not a fail-closed result.
  • Close DNS leaks: define the resolver each client should use, whether it is reachable only through the tunnel, and what happens on failure. Capture DNS traffic during tunnel-up, tunnel-down, reconnect, and network-change tests.
  • Rotate keys and patch: use one key per device so you can revoke one peer, protect the gateway's private keys, and keep the OS and VPN implementation current. Automated upgrades help only when they succeed, reboot safely when required, and do not break routing. Monitor failures and rehearse rollback.

Get Started

We have a pre-built Personal VPN Router recipe that expresses a StrongSwan IKEv2 and DNS-filtering starting point, or use the WireGuard plan above. Review the generated recipe and build record, then provision runtime credentials and validate it on compatible hardware or a VM. A bootable ISO is not evidence that routing, authentication, DNS, revocation, updates, or recovery works in your environment.

If you want the remote-access angle (reaching your own LAN rather than providing an exit), check out our companion post on building a private home VPN, which walks through StrongSwan IKEv2 step by step. Owning your exit also pairs naturally with taking back your data and browser isolation without the vendor lock-in. Those are three layers of the same idea: control the infrastructure your traffic runs on. For teams that need fleets of these appliances under one roof, see OpenFactory Enterprise and pricing.

Build your VPN appliance →

Choose the next validation step

Compare published self-service limits, or scope customer-controlled deployment and fleet requirements through a technical pilot.