No KYC · email optional · pay in Monero, Bitcoin or USDT
Language: English
Deploy a VPS

Guide · checked 2026-11-10

How do I connect my home network to a VPS with WireGuard (behind CGNAT)?

Your home router has no public address. The VPS has one, so it becomes the meeting point that both sides dial out to.

Last updated: · 6 min read

Quick answer

How do I connect my home network to a VPS with WireGuard (behind CGNAT)?

To connect your home network to a VPS with WireGuard behind CGNAT, run WireGuard on the VPS as a hub and let the home machine dial out to it with PersistentKeepalive = 25. A Gloamport Dusk plan, 1 vCPU, 2 GB RAM, 40 GB NVMe, 2 TB traffic, hosts the hub for $5.25 a month on 12 months.

Which address does each side use in this setup?

MachineRoleTunnel addressDials out to
VPS (Dusk)Hub with a public IPv4 address10.8.0.1/24Nobody; it listens on UDP 51820
Home machinePeer behind CGNAT, with LAN 192.168.1.0/2410.8.0.3/24The VPS, every 25 seconds
LaptopRoaming peer10.8.0.2/24The VPS

Addresses are examples from private ranges. Prices: Dusk is $5.25 a month on 12 months and $10.50 on 1 month.

Why does CGNAT block a normal WireGuard setup?

Behind CGNAT your router shares one public IPv4 address with other customers, so nothing outside can open a connection to your home. WireGuard needs one side to be reachable by address, and the VPS is that side: it has One IPv4 address and an IPv6 /64 per VPS, on a 1 Gbit/s port. The traffic of a plan counts outgoing data only, and passing it never creates a bill by itself.

The home machine opens the tunnel outward. The WireGuard quickstart describes PersistentKeepalive for exactly this case: set it on a peer behind a firewall or NAT, and 25 seconds is "a sensible interval that works with a wide variety of firewalls". The NAT mapping then stays open and the VPS can send packets back through it.

Which Gloamport plan suits the hub?

Dusk suits a hub that carries traffic between a few machines. Gloamport lists it for "A VPN plus a Tor relay or an onion site", with 1 vCPU, 2 GB of RAM and 2 TB of monthly traffic.

According to Gloamport's survey of 10 November 2026, the median price of a 1 vCPU, 2 GB VPS across 32 hosts was $18.91 a month. If you only need a tunnel for one small service, Ember is enough; the base setup is in How do I set up WireGuard on a VPS?.

How do I connect my home network to a VPS with WireGuard, step by step?

Six steps. Do the VPS first, then the home machine.

  1. Set up the hub

    Install WireGuard on the VPS and generate its key pair, as in the base guide. Open UDP 51820 in the firewall you run there.

  2. Enable forwarding on the VPS

    Packets from the laptop to the home machine cross the VPS, so IPv4 forwarding must be on. net.ipv4.ip_forward defaults to 0.

  3. Declare both peers on the VPS

    Add one [Peer] for the home machine and one for the laptop. The home peer can also carry the home LAN in AllowedIPs.

  4. Configure the home machine

    Install WireGuard at home, set Endpoint to the VPS address and add PersistentKeepalive = 25. No port forwarding is needed on the home router.

  5. Configure the laptop

    Give it AllowedIPs = 10.8.0.0/24, 192.168.1.0/24 so tunnel and home traffic both go through the VPS.

  6. Test from the laptop

    Run wg show on the VPS, then ping 10.8.0.3 from the laptop. A recent handshake for each peer means both dialled in.

How do I write the hub configuration?

The hub file lists each peer with its public key and the addresses the VPS may send to it. Declaring the home LAN on the home peer lets the VPS route 192.168.1.0/24 into the tunnel.

/etc/wireguard/wg0.conf on the VPS
[Interface]
Address = 10.8.0.1/24
ListenPort = 51820
PrivateKey = <VPS private key>
PostUp = sysctl -w net.ipv4.ip_forward=1

[Peer]
# home machine
PublicKey = <home public key>
AllowedIPs = 10.8.0.3/32, 192.168.1.0/24

[Peer]
# laptop
PublicKey = <laptop public key>
AllowedIPs = 10.8.0.2/32

How do I configure the home machine and the laptop?

The home machine needs PersistentKeepalive and a route to the tunnel subnet; the laptop needs routes to both subnets. Bring each up with wg-quick up wg0.

If you want the laptop to reach other devices on the home LAN, and not only the home machine, the home machine must itself forward packets: set net.ipv4.ip_forward to 1 there too, for instance with a PostUp = sysctl -w net.ipv4.ip_forward=1 line.

/etc/wireguard/wg0.conf on the home machine
[Interface]
Address = 10.8.0.3/24
PrivateKey = <home private key>
PostUp = sysctl -w net.ipv4.ip_forward=1

[Peer]
PublicKey = <VPS public key>
Endpoint = <VPS IPv4 address>:51820
AllowedIPs = 10.8.0.0/24
PersistentKeepalive = 25
/etc/wireguard/wg0.conf on the laptop
[Interface]
Address = 10.8.0.2/24
PrivateKey = <laptop private key>

[Peer]
PublicKey = <VPS public key>
Endpoint = <VPS IPv4 address>:51820
AllowedIPs = 10.8.0.0/24, 192.168.1.0/24
PersistentKeepalive = 25
Bring it up and test
wg-quick up wg0
systemctl enable --now wg-quick@wg0
wg show
ping -c 3 10.8.0.3

What can I do with the tunnel once it is up?

You can reach a home NAS, camera or self-hosted service from anywhere without opening a port at home. The laptop talks to 10.8.0.3 as if it were next door, and nothing is exposed on your home router.

Keep the VPS reachable and tidy: How do I harden SSH on a new VPS? covers the login side, and Is a self-hosted VPN on a VPS better than a VPN service? weighs the whole approach. For the hub, Dusk on a 12-month term is $5.25 a month; the plans are listed on the pricing page.

In summary
  • CGNAT blocks inbound connections, so the home machine dials out to the VPS.
  • The VPS runs the hub with a public IPv4 address and UDP 51820 open.
  • PersistentKeepalive = 25 keeps the NAT mapping open at home.
  • IPv4 forwarding (net.ipv4.ip_forward=1) is needed on the VPS, and at home to reach the LAN.
  • Each peer's AllowedIPs decides which subnets it can reach.
  • Dusk (1 vCPU, 2 GB RAM, 40 GB NVMe, 2 TB traffic) costs $5.25 a month on 12 months.

Home network to VPS with WireGuard: common questions

Do I need port forwarding on my home router?

No. The home machine opens the connection outward to the VPS, so the router only needs to allow outgoing UDP. The keepalive keeps the return path open.

What is CGNAT?

Carrier-grade NAT is a setup where your internet provider shares one public IPv4 address between many customers. You cannot receive unsolicited inbound connections, which is why the VPS acts as the meeting point.

Can the VPS reach my whole home LAN?

Yes, if the home peer lists the LAN, such as 192.168.1.0/24, in its AllowedIPs on the VPS and the home machine forwards packets with net.ipv4.ip_forward set to 1.

Which Gloamport plan should I pick for the hub?

Dusk, at $5.25 a month on 12 months, fits a hub for a few machines. Ember is enough if only one device connects.

Does the tunnel carry IPv6?

It can. Add an IPv6 address to Address and an IPv6 prefix to AllowedIPs; wg-quick accepts both families, and the kernel has a separate IPv6 forwarding setting.

Sources (3)
  1. WireGuard quickstart (persistent keepalive) — WireGuard (checked 2026-11-10)
  2. wg-quick(8) manual page — Debian (checked 2026-11-10)
  3. IP sysctl: ip_forward and IPv6 forwarding — The Linux Kernel documentation (checked 2026-11-10)

From $3.74/month · no KYC

Deploy a VPS