{"article":{"id":115005445768,"url":"https://ubnt.zendesk.com/api/v2/help_center/en-us/articles/115005445768.json","html_url":"https://help.ui.com/hc/en-us/articles/115005445768-UniFi-Gateway-WireGuard-VPN-Server","author_id":22221618047,"comments_disabled":true,"draft":false,"promoted":false,"position":37,"vote_sum":-611,"vote_count":2327,"upvote_count":858,"downvote_count":1469,"section_id":27826487543447,"created_at":"2017-04-05T01:52:22Z","updated_at":"2026-10-28T17:35:28Z","name":"UniFi Gateway - WireGuard VPN Server","title":"UniFi Gateway - WireGuard VPN Server","source_locale":"en-us","locale":"en-us","outdated":false,"outdated_locales":[],"edited_at":"2025-07-04T11:03:53Z","user_segment_id":null,"permission_group_id":4235054,"content_tag_ids":[],"label_names":["vpn","remote access","l2tp","usg","udm","unifi-network","bot"],"body":"<p><strong>WireGuard</strong> is a high-performance VPN server found in your Network application's VPN section that allows you to connect to the UniFi network from a remote location. A <a href=\"https://store.ui.com/us/en/collections/unifi-accessory-tech-hosting-and-gateways-large-scale\" target=\"_self\">UniFi Gateway</a> or <a href=\"https://ui.com/consoles\" target=\"_blank\" rel=\"noopener noreferrer\">UniFi Cloud Gateway</a> is required.</p>\n<h2 id=\"h_01HAQ3HQDWK69PBWQ9PK0SEYEH\">How Does it Work?</h2>\n<p>After enabling WireGuard and specifying a port (UDP 51820 by default), add a <strong>Client</strong> and share the configuration file with your desired recipient. Once the recipient has installed the WireGuard <a href=\"https://www.wireguard.com/install/\" target=\"_blank\" rel=\"noopener\">program or mobile app</a>, they can import the configuration and easily remotely access the UniFi network at any time.</p>\n<p class=\"wysiwyg-indent1\"><span class=\"wysiwyg-color-black70\"><em><strong>Note:</strong> On mobile devices, automatically add the WireGuard VPN configuration by scanning the <strong>QR code</strong>.</em></span></p>\n<h2 id=\"h_01HAQ3HQDWGRKNMKG2EJ6CM8AH\">Frequently Asked Questions</h2>\n<div class=\"collapsible\">\n<div class=\"collapsible--header\">1. Should I use Teleport, WireGuard or L2TP?</div>\n<div class=\"collapsible--body\">\n<p>Using <a href=\"https://help.ui.com/hc/en-us/articles/5246403561495\" target=\"_blank\" rel=\"noopener\">Teleport</a> or WireGuard is highly recommended. L2TP is a traditional VPN that is losing support on several different operating systems. In addition, L2TP has several caveats and encounters issues when the server is behind NAT.</p>\n</div>\n</div>\n<div class=\"collapsible\">\n<div class=\"collapsible--header\">2. Is WireGuard secure?</div>\n<div class=\"collapsible--body\">\n<p>WireGuard VPN encrypts your traffic and secures remote access connections. It also uses private and public keys.</p>\n</div>\n</div>\n<div class=\"collapsible\">\n<div class=\"collapsible--header\">3. How does WireGuard compare with other VPNs, and can you use them simultaneously?</div>\n<div class=\"collapsible--body\">\n<p>Wireguard provides higher throughput than traditional VPNs such as L2TP. Wireguard can be used alongside other VPNs.</p>\n</div>\n</div>\n<div class=\"collapsible\">\n<div class=\"collapsible--header\">4. Can WireGuard be used when the UniFi gateway is behind NAT?</div>\n<div class=\"collapsible--body\">\n<p>If the UniFi gateway is behind NAT, then the port used for Wireguard needs to be <strong>forwarded by the upstream router</strong>. The default port for WireGuard is UDP 51820 and this needs to be forwarded to the UniFi gateway's WAN IP address. For example:</p>\n<ul>\n<li>\n<strong>Protocol</strong> - UDP</li>\n<li>\n<strong>External Port</strong> - 51820</li>\n<li>\n<strong>Internal Port </strong>- 51820</li>\n<li>\n<strong>Internal IP</strong> - WAN IP address of the UniFi gateway</li>\n</ul>\n<p>We recommend to use WireGuard on a UniFi gateway that has access to a public IP address. Any performance or port forwarding issues on the upstream router <strong>can cause the VPN to disconnect</strong>.</p>\n</div>\n</div>\n<div class=\"collapsible\">\n<div class=\"collapsible--header\">5. Which clients support WireGuard?</div>\n<div class=\"collapsible--body\">\n<p>WireGuard is supported on many different clients. See the WireGuard <a href=\"https://www.wireguard.com/install/\" target=\"_blank\" rel=\"noopener\">installation page</a> for more information.</p>\n</div>\n</div>","user_segment_ids":[]}}