setup vpn ubiquiti security gateway

Guide: Set Up VPN on Ubiquiti Security Gateway

By Ashley Martin
AD

In today's interconnected digital landscape, cybersecurity has never been more paramount. One robust solution for enhancing network security is the deployment of a Virtual Private Network (VPN) on your Ubiquiti Security Gateway (USG). By setting up a VPN on your USG, you can create a secure, private network connection, protecting your data and enabling secure remote access. Let's delve into the details of how to configure a VPN on your Ubiquiti Security Gateway.

Before we proceed, ensure that you have a thorough understanding of your network setup and requirements. A proper understanding of your network infrastructure and traffic patterns is crucial for a efficient VPN configuration. Additionally, familiarize yourself with the Ubiquiti Network's Device Discovery Protocol (UDDP) and the USG's web interface for a smooth setup process.

Understanding VPN Protocols

Before diving into the setup, it's essential to grasp the different VPN protocols, as the choice of protocol will depend on your network requirements and the devices connecting to the VPN. The primary VPN protocols used are:

AD
How To: Deploying a Ubiquiti UniFi Home Network including Multiple WiFi Access Points (Part 1) - Free Time
How To: Deploying a Ubiquiti UniFi Home Network including Multiple WiFi Access Points (Part 1) - Free Time
an image of a computer screen with many items on it
an image of a computer screen with many items on it
Ubiquiti Networks Unifi Security Gateway Router, White, Ethernet (Rj-45) | Color: Tan/White | Size: Os
Ubiquiti Networks Unifi Security Gateway Router, White, Ethernet (Rj-45) | Color: Tan/White | Size: Os

Site-to-Site VPN

A Site-to-Site VPN creates a secure tunnel between your USG and a remote network, merging the two networks as if they were on the same LAN. This option is ideal for connecting multiple offices or remote locations.

Site-to-Site VPNs can use either IPsec or GRE protocol. IPsec is the most secure and widely used, while GRE is simpler to set up but provides less security.

VPN (Virtual Private Network) : Complete Guide to Secure Internet Access...
VPN (Virtual Private Network) : Complete Guide to Secure Internet Access...
Ubiquiti Mini Home Lab
Ubiquiti Mini Home Lab
How To: Ubiquiti UniFi Security Gateway Pro 4 & Intrusion Prevention (IPS) - Free Time
How To: Ubiquiti UniFi Security Gateway Pro 4 & Intrusion Prevention (IPS) - Free Time

Remote Access VPN

A Remote Access VPN, on the other hand, allows individual devices like smartphones or laptops to connect securely to your network from any location. The USG supports both SSL VPN (over Port 443) and L2TP/IPSec for remote access.

For secure and mobile-friendly access, SSL VPN is usually the preferred choice, as it doesn't require manual setup on client devices and can pass through firewalls with ease.

AD

Setting Up VPN on Ubiquiti Security Gateway

Now that we've covered the basics of VPN protocols let's dive into setting up a VPN on your Ubiquiti Security Gateway. We'll focus on the most common scenario: configuring an IPsec Site-to-Site VPN.

What is an Internet Gateway (IGW)? 🌐 | AWS Networking Explained for Beginners
What is an Internet Gateway (IGW)? 🌐 | AWS Networking Explained for Beginners
Dream Machine Pro - Ubiquiti Store
Dream Machine Pro - Ubiquiti Store
Ubiquiti UniFi Setup at Home 90 Days Later, and Thoughts of Side Hustling
Ubiquiti UniFi Setup at Home 90 Days Later, and Thoughts of Side Hustling
the router is white and has four ports on each side, with two green lights
the router is white and has four ports on each side, with two green lights
a large stack of electronic equipment sitting on top of a table
a large stack of electronic equipment sitting on top of a table
there are many different types of electronic equipment on the shelf in front of the table
there are many different types of electronic equipment on the shelf in front of the table

The steps below assume you have already logged in to the USG's web interface and have a basic understanding of network configuration. If not, refer to the official Ubiquiti documentation for initial setup.

Creating a Site-to-Site VPN Profile

1. Navigate to the 'Services' menu and click on 'VPN'. Under the 'Site-to-Site VPN' tab, click on 'Add New' to create a new VPN profile.

AD

2. Fill in the necessary details like VPN Name, Local Network (your network's IP range), and Remote Network (the IP range of the remote network). Select the appropriate Protocol (IPsec) and Phase 1 & Phase 2 Encryption/Hash/Authentication settings as per your network requirements.

UniFi UCG-Fiber 10-Inch Rack Mount | Compact 1U Ubiquiti Cloud Gateway Fiber Mount
UniFi UCG-Fiber 10-Inch Rack Mount | Compact 1U Ubiquiti Cloud Gateway Fiber Mount
🔒 Basic Site-to-Multi-Site VPN (Hub-and-Spoke) Topology Need to securely connect multiple branch offices to your Head Office or Data Center? A Hub-and-Spoke Site-to-Site VPN is one of the most common enterprise designs for secure and scalable connectivity. In this topology: ✅ A central Hub (Head Office) establishes encrypted IPsec VPN tunnels with multiple branch offices (Spokes). ✅ Each branch maintains its own local LAN while securely accessing resources at the Head Office. ✅ All communic... Computer Knowledge, Data Center
🔒 Basic Site-to-Multi-Site VPN (Hub-and-Spoke) Topology Need to securely connect multiple branch offices to your Head Office or Data Center? A Hub-and-Spoke Site-to-Site VPN is one of the most common enterprise designs for secure and scalable connectivity. In this topology: ✅ A central Hub (Head Office) establishes encrypted IPsec VPN tunnels with multiple branch offices (Spokes). ✅ Each branch maintains its own local LAN while securely accessing resources at the Head Office. ✅ All communic... Computer Knowledge, Data Center
How To: Home Network 4.0 with Ubiquiti Unifi Dream Machine Pro, Switch Pro, Flex Mini, Smart Power Plug & UPS Review & Calibration - Free Time
How To: Home Network 4.0 with Ubiquiti Unifi Dream Machine Pro, Switch Pro, Flex Mini, Smart Power Plug & UPS Review & Calibration - Free Time

Configure the Remote Site

3. On the remote USG, replicate the steps above to create a matching VPN profile. Ensure that the Local and Remote Networks are swapped from the initial configuration to create a viable connection between the two sites.

4. Once both profiles are created, save the changes, and apply them. The USG will generate encryption keys, and the VPN tunnel should establish within a few minutes.

AD

Testing the VPN Connection

5. To verify the connection, ping an internal IP from one site to the other. If the ping is successful, the VPN tunnel is established correctly.

6. Additionally, monitor the USG's web interface under 'Status' > 'VPN' to ensure the VPN status is 'Up'.

Configuring a VPN on your Ubiquiti Security Gateway can be a daunting task, but with the right understanding and careful planning, it can effectively bolster your network's security. As your network's needs evolve, consider exploring other VPN protocols and advanced features offered by the USG for a comprehensive security solution.

AD