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.
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:
| Option | Best for | Pros | Cons |
|---|---|---|---|
| WireGuard | Most people; recommended default | Fast, modern cryptography, low battery use, and simple configuration. | Requires the WireGuard app and a separate profile for each device. |
| Teleport | Family members who want quick access | Simple invite links, uses the UniFi mobile app, and is built on WireGuard. | Requires a UniFi account and offers fewer controls. |
| OpenVPN | Legacy clients or devices that only support OpenVPN | Widely supported. | Slower and more involved to set up. |
| L2TP/IPsec | Devices using a built-in VPN client | Native clients are available on Windows, macOS, iOS, and Android. | Older, slower, and sometimes blocked; less recommended. |
| Site-to-Site / Site Magic | Connecting two UniFi locations | Always-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.
- In UniFi Network, open your gateway's WAN details and note its WAN IP address.
- From a device on your home network, visit a trusted “what is my IP” service.
- 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, or192.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.
- Create an account with a DDNS provider such as No-IP, DuckDNS, Dynu, or Cloudflare with your own domain.
- Create a hostname, for example
myhome.duckdns.org. - In UniFi Network, open Settings > Internet (older versions may use Settings > Networks > WAN), select your WAN, and find Dynamic DNS.
- Add the provider, hostname, and required username, token, or password, then save.
- 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.
| Network | Example subnet |
|---|---|
| Home LAN | 192.168.77.0/24 |
| IoT VLAN (optional) | 192.168.78.0/24 |
| WireGuard VPN clients | 10.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
- Open the UniFi Network application.
- Go to Settings > VPN. Older versions may show Settings > Teleport & VPN or Settings > VPN > VPN Server.
- Under VPN Server, choose Create New or Add VPN Server.
- Select WireGuard.
- 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. - Optionally specify DNS servers. Your gateway's LAN IP or another resolver can provide DNS to connected clients.
- 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.
- In the WireGuard server settings, choose Add Client or Create New Client.
- Name it clearly, such as
Pat-iPhoneorLaptop-Work. - Choose which traffic should use the tunnel, then save.
- Download the
.conffile or display the QR code for a phone.
Split tunnel or full tunnel?
| Mode | Traffic through VPN | When to use it |
|---|---|---|
| Split tunnel | Only 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 tunnel | All 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.
Step 6: Install and connect the client
Phone (iOS or Android)
- Install the WireGuard app from the App Store or Google Play.
- Tap +, choose to create from a QR code, and scan the code from UniFi.
- Name the tunnel and approve the VPN configuration prompt.
- Turn off Wi-Fi so the phone uses cellular, then enable the tunnel.
Windows, macOS, or Linux
- Install the WireGuard client from wireguard.com/install.
- Import the tunnel from the downloaded
.conffile. - 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.
- Check the WireGuard app for a recent handshake and increasing data counters.
- Ping your gateway's LAN IP, for example
ping 192.168.77.1. - Open a home device, such as your NAS web interface or a camera feed.
- 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.
- Update your gateway and Network app, and link the gateway to your Ubiquiti account.
- Open Settings > VPN (or Teleport & VPN) and enable Teleport.
- Choose Create Invite and set how long the invite is valid.
- Open the invite on the remote device with the WiFiman app installed.
- 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
| Symptom | Likely cause | What to check |
|---|---|---|
| Tunnel connects but no handshake | Port blocked, wrong endpoint, CGNAT, or double NAT | Verify your public IP, endpoint hostname, and port. Forward the UDP port upstream if you have double NAT. |
| Handshake succeeds but LAN devices are unreachable | Firewall rule, incorrect AllowedIPs, or overlapping subnets | Include 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 networks | That network blocks UDP, or its subnet overlaps your home network | Try another network or a different UDP port allowed by your gateway, or change your home LAN subnet. |
| Can reach IP addresses but not hostnames | DNS is not configured or the wrong DNS server is being used | Set a DNS server in the VPN configuration, such as your gateway's LAN IP. |
| Worked, then stopped after a few days | Your public IP changed and DDNS is stale | Check DDNS status on the WAN and confirm the hostname resolves to your current IP. |
| Internet is slow with the VPN on | Full-tunnel traffic is limited by your home's upload speed | Switch to split tunneling or check your ISP upload speed. |
| Cannot connect after a firmware update | A rule or service may have changed | Review the VPN server configuration and WAN firewall rule, then test again. |
| Works from a phone but not a laptop | Incorrect imported profile or local firewall | Re-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
- Confirm your WAN has a public IP and is not behind CGNAT or double NAT.
- Set up DDNS if your public IP changes.
- Plan non-overlapping home LAN and VPN subnets.
- Create the WireGuard server in UniFi Network.
- Create a separate client profile for each device and choose split or full tunnel.
- Import the profile by QR code or .conf file into the WireGuard app.
- Test from cellular or another network, not your home Wi-Fi.
- Limit VPN access to the LAN resources each client needs.
- Enable MFA, keep firmware current, and back up your UniFi configuration.
Further reading
- Ubiquiti Help Center: search for “WireGuard VPN Server” and “Teleport” for current screenshots and menu paths.
- WireGuard quick start documentation.