Networking

Securely reach your home network from anywhere.

Set up remote access to your NAS, cameras, Home Assistant, printers, and other home devices with a UniFi gateway. This walkthrough focuses on WireGuard, with Teleport as a simpler alternative.

Before you start:Your home internet connection needs a reachable public IP for direct inbound WireGuard connections. Check for CGNAT or double NAT before configuring the VPN.

UniFi menu names can shift between Network versions. Look for the closest equivalent if a menu path differs.

Choose the right VPN type

For most home users, WireGuard is the recommended default. UniFi also offers these alternatives:

OptionBest forProsCons
WireGuardMost people; recommended defaultFast, modern cryptography, low battery use, and simple configuration.Requires the WireGuard app and a separate profile for each device.
TeleportFamily members who want quick accessSimple invite links, uses the UniFi mobile app, and is built on WireGuard.Requires a UniFi account and offers fewer controls.
OpenVPNLegacy clients or devices that only support OpenVPNWidely supported.Slower and more involved to set up.
L2TP/IPsecDevices using a built-in VPN clientNative clients are available on Windows, macOS, iOS, and Android.Older, slower, and sometimes blocked; less recommended.
Site-to-Site / Site MagicConnecting two UniFi locationsAlways-on connection between places such as home and an office.Designed for networks, not individual roaming devices.

Recommendation: Use WireGuard for a fast, modern VPN with per-device profiles. The rest of this guide walks through that setup.

Step 1: Confirm your internet connection can accept VPN traffic

A VPN server at home only works if remote devices can reach your gateway.

  1. In UniFi Network, open your gateway's WAN details and note its WAN IP address.
  2. From a device on your home network, visit a trusted “what is my IP” service.
  3. Compare the two addresses. If they match, you likely have a public IP. If they differ, or the gateway address is in 100.64.0.0/10, 10.0.0.0/8, 172.16.0.0/12, or 192.168.0.0/16, you may be behind CGNAT or another router.

If your ISP uses CGNAT

Ask your ISP for a public (sometimes static) IP, or use a relay-based option such as Teleport or Tailscale that does not require an inbound port. Direct WireGuard connections to your gateway will not work through CGNAT.

If you have another router upstream

Put the upstream modem/router in bridge or passthrough mode, or forward the WireGuard UDP port (51820 by default) from that router to your UniFi gateway's WAN IP.

Step 2: Set up Dynamic DNS (skip with a static IP)

Most residential public IP addresses change occasionally. A DDNS hostname tracks the current address so client profiles can keep reaching home.

  1. Create an account with a DDNS provider such as No-IP, DuckDNS, Dynu, or Cloudflare with your own domain.
  2. Create a hostname, for example myhome.duckdns.org.
  3. In UniFi Network, open Settings > Internet (older versions may use Settings > Networks > WAN), select your WAN, and find Dynamic DNS.
  4. Add the provider, hostname, and required username, token, or password, then save.
  5. After a few minutes, confirm the hostname resolves to your current public IP. For example, run nslookup myhome.duckdns.org.

Use this hostname as the server address in your VPN client profiles.

Step 3: Plan your subnets

The remote network and home network must not use the same address range. Hotels, coffee shops, and other homes often use 192.168.0.0/24 or 192.168.1.0/24. If your home LAN uses one of those ranges, remote traffic may be sent to the local network instead of through the VPN.

Consider a less common home LAN range and choose a separate VPN client subnet that does not overlap with any of your networks.

NetworkExample subnet
Home LAN192.168.77.0/24
IoT VLAN (optional)192.168.78.0/24
WireGuard VPN clients10.99.0.0/24

If you need to renumber your LAN, do it before distributing client profiles so you do not have to regenerate them later.

Step 4: Create the WireGuard VPN server

  1. Open the UniFi Network application.
  2. Go to Settings > VPN. Older versions may show Settings > Teleport & VPN or Settings > VPN > VPN Server.
  3. Under VPN Server, choose Create New or Add VPN Server.
  4. Select WireGuard.
  5. Configure a descriptive server name, listen port (51820 is the default), VPN client subnet (for example 10.99.0.1/24), and WAN interface. Choose the WAN carefully if you use dual WAN.
  6. Optionally specify DNS servers. Your gateway's LAN IP or another resolver can provide DNS to connected clients.
  7. Save and apply. UniFi gateways generally add the required WAN firewall rule automatically. With a zone-based firewall, review the VPN zone under Settings > Security > Firewall & Security.

You need a UniFi gateway that hosts the VPN server, such as a Dream Machine (UDM, UDM-Pro, UDM-SE, UDR), Cloud Gateway (UCG-Ultra, UCG-Max, UCG-Fiber), or a USG/UXG gateway paired with a UniFi Network controller. Keep UniFi Network up to date and confirm the exact feature support for your gateway model.

Step 5: Create a client profile for each device

Create a separate profile for each device or person so you can revoke access individually.

  1. In the WireGuard server settings, choose Add Client or Create New Client.
  2. Name it clearly, such as Pat-iPhone or Laptop-Work.
  3. Choose which traffic should use the tunnel, then save.
  4. Download the .conf file or display the QR code for a phone.

Split tunnel or full tunnel?

ModeTraffic through VPNWhen to use it
Split tunnelOnly home-bound traffic. AllowedIPs includes your home LAN and VPN subnet, for example 192.168.77.0/24, 10.99.0.0/24.Default choice; regular browsing stays on the current network.
Full tunnelAll internet traffic goes through your home connection. AllowedIPs is 0.0.0.0/0, ::/0.Useful on untrusted public Wi-Fi or when you need traffic to appear to come from home.

If the exported profile has the wrong endpoint, set it to your DDNS hostname and port, for example Endpoint = myhome.duckdns.org:51820. Recent UniFi releases may let you set the server address during setup.

Protect client profiles:A profile contains the client's private key. Treat the file like a password: import it securely, do not email or post it, and delete unnecessary copies afterward.

Step 6: Install and connect the client

Phone (iOS or Android)

  1. Install the WireGuard app from the App Store or Google Play.
  2. Tap +, choose to create from a QR code, and scan the code from UniFi.
  3. Name the tunnel and approve the VPN configuration prompt.
  4. Turn off Wi-Fi so the phone uses cellular, then enable the tunnel.

Windows, macOS, or Linux

  1. Install the WireGuard client from wireguard.com/install.
  2. Import the tunnel from the downloaded .conf file.
  3. Activate the tunnel.

Test the connection

Test from another network, such as cellular, rather than from your home Wi-Fi. Some setups do not support loopback to the public address from inside the home network.

  1. Check the WireGuard app for a recent handshake and increasing data counters.
  2. Ping your gateway's LAN IP, for example ping 192.168.77.1.
  3. Open a home device, such as your NAS web interface or a camera feed.
  4. If you use local hostnames, test DNS resolution too.

Step 7: Use Teleport as a simpler alternative

Teleport is Ubiquiti's easy-mode VPN, built on WireGuard.

  1. Update your gateway and Network app, and link the gateway to your Ubiquiti account.
  2. Open Settings > VPN (or Teleport & VPN) and enable Teleport.
  3. Choose Create Invite and set how long the invite is valid.
  4. Open the invite on the remote device with the WiFiman app installed.
  5. Accept the invite and turn on the connection.

Teleport is convenient for family members who only need access to a few home services. It offers fewer routing controls than a manually configured WireGuard server.

Step 8: Review firewall and access control

VPN users may have broad access to your LAN by default. Limit access, especially when sharing profiles or when devices contain sensitive services.

  • Zone-based firewall: Review rules between the VPN zone and Internal, IoT, and Guest/Hotspot zones. Allow only what is needed, such as a VPN client reaching specific NAS ports.
  • Classic firewall: Create LAN In or LAN Local rules scoped to the VPN subnet.
  • Least privilege: Someone who only needs NAS photos should not automatically reach management interfaces, cameras, or IoT devices.
  • Block access to the gateway admin interface from the VPN subnet if remote administration is not needed.
  • Use per-client VPN IPs to write rules for individual devices or users where supported.

Step 9: Follow security best practices

  • Keep UniFi OS and Network firmware current; enable automatic updates where practical.
  • Use a unique client profile for each device and revoke it immediately if a device is lost.
  • Enable MFA on your Ubiquiti account and use a strong, unique password.
  • Do not expose the controller interface to the internet or forward ports to it. Use the VPN as the access path.
  • Disable VPN servers you do not use, such as old OpenVPN or L2TP configurations.
  • Periodically review system logs or Insights/Flow views for unexpected connection attempts.
  • Prefer WireGuard over L2TP with a simple pre-shared key when both are available.
  • Back up your UniFi configuration under Settings > System > Backups after the VPN is working.

Troubleshooting

SymptomLikely causeWhat to check
Tunnel connects but no handshakePort blocked, wrong endpoint, CGNAT, or double NATVerify your public IP, endpoint hostname, and port. Forward the UDP port upstream if you have double NAT.
Handshake succeeds but LAN devices are unreachableFirewall rule, incorrect AllowedIPs, or overlapping subnetsInclude your LAN subnet in AllowedIPs, review VPN-to-LAN firewall rules, and check for overlapping subnets.
Works on cellular but not on some Wi-Fi networksThat network blocks UDP, or its subnet overlaps your home networkTry another network or a different UDP port allowed by your gateway, or change your home LAN subnet.
Can reach IP addresses but not hostnamesDNS is not configured or the wrong DNS server is being usedSet a DNS server in the VPN configuration, such as your gateway's LAN IP.
Worked, then stopped after a few daysYour public IP changed and DDNS is staleCheck DDNS status on the WAN and confirm the hostname resolves to your current IP.
Internet is slow with the VPN onFull-tunnel traffic is limited by your home's upload speedSwitch to split tunneling or check your ISP upload speed.
Cannot connect after a firmware updateA rule or service may have changedReview the VPN server configuration and WAN firewall rule, then test again.
Works from a phone but not a laptopIncorrect imported profile or local firewallRe-import the profile and check the laptop firewall and other VPN software.

Useful diagnostics include the WireGuard app log, the UniFi Client Devices page (where a connected VPN client appears with its VPN IP), and a gateway packet capture for persistent problems.

Quick reference checklist

  1. Confirm your WAN has a public IP and is not behind CGNAT or double NAT.
  2. Set up DDNS if your public IP changes.
  3. Plan non-overlapping home LAN and VPN subnets.
  4. Create the WireGuard server in UniFi Network.
  5. Create a separate client profile for each device and choose split or full tunnel.
  6. Import the profile by QR code or .conf file into the WireGuard app.
  7. Test from cellular or another network, not your home Wi-Fi.
  8. Limit VPN access to the LAN resources each client needs.
  9. Enable MFA, keep firmware current, and back up your UniFi configuration.

Further reading