Yes, you can set up a VPN on the Ubiquiti EdgeRouter X.
If you’re here, you’re likely trying to secure a home lab, small office, or remote branch using the EdgeRouter X’s solid performance and affordable price. In this guide, I’ll walk you through a practical, tested approach to Ubiquiti edgerouter x vpn setup—covering IPsec site-to-site VPNs the most common for linking two networks and remote-access options for individual devices behind the router. By the end, you’ll have a working VPN tunnel with clear steps, safety tips, and troubleshooting routes. Think of this as a no-fluff, real-world setup that you can follow step by step.
If you want extra protection while you test VPNs, you may want a reliable consumer VPN to use on top of the EdgeRouter when you don’t want to commit to a full site-to-site VPN just yet. Here’s a deal I’ve found that can save you money while you experiment: NordVPN 77% OFF + 3 Months Free. It’s linked here as a quick option to keep your traffic private on the devices you’re testing with. NordVPN deal
Introduction: what you’ll learn in this guide
- A clear plan for choosing the right VPN setup on EdgeRouter X site-to-site vs. remote access
- A practical, copy-paste-friendly set of commands for IPsec site-to-site VPN
- How to define LAN and WAN networks, plus how to route traffic across the VPN
- How to harden VPN security with strong crypto settings and firewall rules
- How to test connectivity and verify the tunnel is up
- Common issues and proven fixes you can rely on
Useful URLs and Resources non-clickable
- Ubiquiti EdgeRouter X Documentation – ubnt.com
- EdgeOS VPN Guide – help.ubnt.com
- IPsec VPN Overview – en.wikipedia.org/wiki/IPsec
- StrongSwan IPsec general reference – strongswan.org
- Ubiquiti Community Forums – community.ui.com
- NordVPN – nordvpn.com
What EdgeRouter X is and why you’d use it for VPN
- Hardware at a glance: EdgeRouter X is a compact, affordable router with five Gigabit Ethernet ports and a capable 1 Gbps firewall throughput rating. It’s perfect for small offices or home networks where you want more control than consumer-grade devices and you don’t mind a CLI for advanced features.
- VPN capabilities: EdgeRouter X runs EdgeOS a Vyatta-derived OS and supports IPsec VPNs natively. It lets you configure site-to-site VPNs to connect two networks securely and OpenVPN-based remote-access options if you enable OpenVPN server features via EdgeOS. This makes it a versatile choice for a growing network that needs secure site-to-site connectivity and, if desired, remote access for individual devices.
- VPN architectures you can use with EdgeRouter X
- IPsec Site-to-Site VPN: This is the most common use-case in small offices because it connects two distinct networks for example, your home network to a branch office as if they were one. It uses strong encryption to keep traffic private as it traverses the internet, and it’s well-supported by EdgeRouter X.
- OpenVPN Server Remote Access: If you want individual devices to connect from anywhere, an OpenVPN server on EdgeRouter X is a solid option. This lets you create client profiles and push routes to your LAN. Note: OpenVPN setup can be more involved and may require OpenVPN client configs on devices.
- Planning and prerequisites for a smooth Ubiquiti edgerouter x vpn setup
- Network plan: Map out your LAN subnets for example, 192.168.1.0/24 for your EdgeRouter X side and 192.168.2.0/24 for the remote site. Decide which subnets will be routed through the VPN and which will remain direct.
- Public IPs: You’ll need the public IP address of the remote site’s router or a static IP on both ends. If either side has a dynamic IP, consider a dynamic DNS DDNS service to keep the tunnel aligned.
- Security basics: Choose a strong pre-shared key PSK for IPsec or, for more complex deployments, move toward certificates. For OpenVPN, generate secure client certificates.
- Firewall posture: Plan a few firewall rules to allow VPN negotiation traffic IKE, ESP, and any related UDP ports. Don’t leave ports open by default. granting VPN traffic only to the VPN zones/stubs reduces exposure.
- Performance expectations: VPN encryption adds CPU load. EdgeRouter X can handle IPsec well, but real-world tunnel throughput depends on your WAN speed, remote peer capabilities, and chosen cipher suites. Expect roughly a fraction of your raw WAN speed under heavy VPN load.
- Step-by-step guide: IPsec Site-to-Site VPN EdgeRouter X
Note: These steps assume you’re connecting EdgeRouter X at your site Site A to a remote site Site B. Replace the example IPs, subnets, and PSKs with your actual data. Commands below are EdgeOS-style and can be executed via SSH or the local console.
High-level plan
- Define IKE and ESP groups crypto profiles
- Create a site-to-site peer with remote public IP and PSK
- Bind the tunnel to the local and remote LAN subnets
- Create firewall rules to allow VPN traffic
- Add a route to push traffic for the remote subnet through the VPN
- Test the tunnel and perform leak tests
Commands copy-paste-ready blocks with placeholders
-
Enable VPN interfaces for IPsec IKE/ESP groups
set vpn ipsec ike-group IKE-1 proposal 1 encryption aes256
set vpn ipsec ike-group IKE-1 proposal 1 hash sha256
set vpn ipsec ike-group IKE-1 lifetime 3600
set vpn ipsec esp-group ESP-1 proposal 1 encryption aes256
set vpn ipsec esp-group ESP-1 proposal 1 hash sha256
set vpn ipsec esp-group ESP-1 lifetime 3600 -
Define the IPsec site-to-site peer
set vpn ipsec site-to-site peer 203.0.113.2 authentication mode pre-shared-secret
set vpn ipsec site-to-site peer 203.0.113.2 authentication pre-shared-secret ‘YourStrongP@ssw0rd’
set vpn ipsec site-to-site peer 203.0.113.2 ike-group IKE-1
set vpn ipsec site-to-site peer 203.0.113.2 esp-group ESP-1
set vpn ipsec site-to-site peer 203.0.113.2 local-address 198.51.100.1
set vpn ipsec site-to-site peer 203.0.113.2 remote-address 198.51.100.2
local and remote LANs
set vpn ipsec site-to-site peer 203.0.113.2 tunnel 1 local prefix 192.168.1.0/24
set vpn ipsec site-to-site peer 203.0.113.2 tunnel 1 remote prefix 192.168.2.0/24
- NAT and firewall integration
Optional: ensure VPN traffic isn’t NATed in a way that breaks remote access
set nat source rule 100 outbound-interface eth0
set nat source rule 100 translation-address 192.168.1.0/24
set firewall group address-group VPN-LOCAL-networks address 192.168.2.0/24
Allow IKE and IPsec ESP/UDP ports example: UDP 500/4500 and ESP
set firewall name WAN-IN rule 100 action accept
set firewall name WAN-IN rule 100 description ‘Allow IKE/IPsec’
set firewall name WAN-IN rule 100 protocol udp
set firewall name WAN-IN rule 100 destination port 500
set firewall name WAN-IN rule 101 protocol udp
set firewall name WAN-IN rule 101 destination port 4500
set firewall name WAN-IN rule 102 protocol esp
-
Apply a static route for remote subnet through VPN if needed
set protocols static route 192.168.2.0/24 next-hop a.b.c.d # remote gateway through VPN -
Commit and save
commit
save
Notes
- The exact interface names and prefixes will depend on your network. If your remote site uses a different subnet, adjust the 192.168.x.x prefixes accordingly.
- If your remote peer uses IKEv2, you can adjust ike-group to match. Some devices require IKEv2 with certain lifetimes. if you hit handshake issues, tune lifetime and DH group values.
- If you’re behind double-NAT, you may need to expose the remote peer’s public IP in a way that the tunnel can be established.
Checkpoints and testing
- Check tunnel status: you can run show vpn ipsec sa or equivalent EdgeOS commands to verify tunnels are up.
- Ping tests: from a device on Site A 192.168.1.x ping a device on Site B 192.168.2.x. If you don’t get replies, confirm firewall allowances, route tables, and the tunnel status.
- Traceroute: if a tunnel exists, traceroute across the VPN should show the remote LAN path rather than a public hop.
- Step-by-step guide: OpenVPN remote-access on EdgeRouter X optional
If you want remote-access for individual devices rather than site-to-site, you can enable an OpenVPN server on EdgeRouter X. This option is a bit more involved and depends on your EdgeOS version, but it’s a reliable way to give single devices secure, encrypted access to your LAN.
- Install and configure OpenVPN server on EdgeRouter X
- Create a server config and generate client certificates
- Create firewall rules to allow OpenVPN
- Export client profiles to devices that will connect
- Test from a remote client
Commands illustrative. you’ll tailor to your EdgeOS version
-
Install OpenVPN components if needed
set service openvpn disable
set interfaces openvpn vtun0 mode server
set interfaces openvpn vtun0 server subnet 10.8.0.0/24
set interfaces openvpn vtun0 server push-route 192.168.1.0/24
set interfaces openvpn vtun0 local-endpoint 198.51.100.1 -
Generate server and client certificates using easy-rsa or integrated tools
set vpn openvpn server to enable
set vpn openvpn server mode server
set vpn openvpn server server-subnet 10.8.0.0/24
set vpn openvpn server port 1194
set vpn openvpn server protocol udp
set vpn openvpn server tls-auth enable # optional for extra security
set vpn openvpn client-config-dir /config/openvpn/ccd -
Firewall for OpenVPN
set firewall name WAN-IN rule 200 action accept
set firewall name WAN-IN rule 200 protocol udp
set firewall name WAN-IN rule 200 destination port 1194 -
Start OpenVPN and ensure it’s active
-
Client profiles: generate a .ovpn file or certificate for devices. Distribute to users.
Testing OpenVPN remote access
- Connect a client with the .ovpn file and verify access to 192.168.1.0/24 at Site A through the tunnel.
- Confirm there are no leaks by running a site-to-site compatibility test to ensure traffic isn’t leaking to the public internet when the VPN is active.
Security tuning and best practices
- Use strong authentication: choose lengthy PSKs for IPsec or implement certificate-based authentication if possible.
- TLS and crypto: prefer AES-256 for encryption and SHA-256 or better for integrity over older ciphers.
- Turn on dead-peer detection DPD and keep-alive settings to quickly recover from network hiccups.
- Regularly update EdgeRouter X firmware to get security patches and improvements.
- Minimize exposed surfaces: only allow VPN-related traffic through WAN, and keep the rest of the firewall tight.
- Protocol choice and performance considerations
- IPsec is the go-to for reliable, site-to-site connections on EdgeRouter X. It’s generally fast, very interoperable, and well-supported on both ends.
- OpenVPN remote access is excellent for individual devices but can be slightly heavier on the CPU depending on the cipher you choose. AES-256-GCM is a good balance of speed and security on modern devices. if you’re seeing slowdowns, consider reducing encryption to AES-128-GCM if your devices support it or enabling hardware acceleration where available.
- IKEv2 can offer quick renegotiation and strong security, but compatibility with all remote peers is essential. If you’re working with a specific remote gateway, verify compatibility first.
- Real-world tips and troubleshooting
- If the tunnel simply won’t establish, double-check:
- Public IP addresses both sides and port accessibility through firewalls and NAT.
- Correct PSK or certificate use on both sides.
- Local vs. remote subnet configurations don’t overlap and are correctly defined.
- If you’re using dynamic DNS, ensure updates are timely and the remote peer is pointed to the current address.
- If you’re seeing recurring handshake failures, review the ike-group and esp-group parameters. Some devices require a specific DH group e.g., modp1024 vs modp2048. Tuning these can resolve stubborn connections.
- Logs are your friend: check EdgeRouter logs for “IKE negotiation failed” or “no response” messages. The logs usually point to auth or lifetime mismatches.
- Performance expectations and scaling
- EdgeRouter X is capable but budget-focused. In practice, you’ll see VPN throughput lower than raw line speed due to encryption overhead. With AES-256 and SHA-256, expect VPN performance in the 100–400 Mbps range depending on CPU load, VPN type IPsec vs OpenVPN, and how many tunnels you’re running simultaneously.
- If you need higher throughput or more tunnels, you might consider upgrading to a higher-end EdgeRouter model e.g., EdgeRouter 4/6/12 series or distributing VPNs across multiple devices to balance load.
- Security hygiene and maintenance
- Rotate PSKs and certificates on a regular schedule annually or sooner if you suspect a compromise.
- Use unique PSKs for each VPN tunnel, not a single shared secret across all peers.
- Regularly review firewall rules and logs to catch any unusual or unauthorized attempts to reach VPN endpoints.
- Glossary of key terms you’ll see in EdgeRouter VPN setup
- IKE Internet Key Exchange: The negotiation protocol for IPsec, establishing a secure channel for shared keys.
- ESP Encapsulation Security Payload: The protocol that carries encrypted data in IPsec tunnels.
- DH group: The Diffie-Hellman group used to establish keys. larger groups mean stronger security but higher CPU load.
- PSK Pre-Shared Key: A shared secret used for authentication in IPsec. For OpenVPN, you’ll typically use certificates instead.
- NAT traversal NAT-T: A method that allows IPsec to work through NAT devices by encapsulating ESP packets in UDP.
- Quick checklist for a successful Ubiquiti edgerouter x vpn setup
- Plan subnets and VPN type site-to-site vs remote access
- Gather remote peer details IP, subnet, PSK or certs
- Configure IKE/ESP groups with strong crypto
- Define the IPsec peer and tunnel mappings
- Set up necessary firewall rules and NAT considerations
- Add static routes for VPN networks
- Test tunnel status and connectivity with devices on both sides
- Harden the setup with best practices and keep firmware up to date
Frequently Asked Questions
What is the EdgeRouter X best used for with VPN?
EdgeRouter X is ideal for small offices or home labs where you want more control and better VPN capabilities than consumer routers. It handles IPsec site-to-site reliably and can host an OpenVPN server for remote access if you need to connect individual devices securely.
Can I run IPsec site-to-site VPN between my EdgeRouter X and a consumer router?
Yes, you can. Many consumer routers support IPsec as a VPN peer. You’ll configure the EdgeRouter X with a matching IPsec setup IKE and ESP groups, PSK/certs and set the remote side’s subnet accordingly. Just ensure the other device supports IPsec in a compatible mode IKE v1/v2, encryption, and hashes.
How do I choose between IPsec and OpenVPN on EdgeRouter X?
IPsec is typically simpler for site-to-site connections and tends to offer better performance with less CPU overhead on EdgeRouter X. OpenVPN is a good option for remote access or for devices that don’t play nicely with IPsec, but it can be heavier on the CPU and slightly more complex to configure.
Do I need a static IP for VPN on EdgeRouter X?
A static IP makes VPNs easier to manage because the remote peer can connect to a fixed address. If you have a dynamic IP, you can use DDNS Dynamic DNS on the router and update the remote peer with the changing address. This is common for home setups.
What are the security best practices for EdgeRouter X VPN?
- Use AES-256 and SHA-256 for encryption and integrity.
- Prefer certificate-based authentication for OpenVPN if possible. use strong PSKs for IPsec.
- Enable DPD Dead Peer Detection to quickly recover from dropped tunnels.
- Regularly update firmware and monitor firewall logs for unusual activity.
How do I test my IPsec site-to-site VPN after setup?
Ping devices on the remote subnet from a device on the local subnet. If pings succeed, run traceroute to verify traffic is routing through the tunnel. Check EdgeRouter logs for IKE/ESP SA establishment status and troubleshoot any handshake messages if necessary. Ubiquiti edge router site to site vpn setup guide for reliable inter-office links and optimized ipsec tunnels
Can EdgeRouter X handle multiple VPN tunnels at once?
Yes, you can run more than one IPsec site-to-site tunnel, but keep an eye on CPU and memory. Each additional tunnel adds encryption overhead. If you reach performance limits, you may need to distribute tunnels across more capable devices or adjust cipher suites and MTU settings.
How do I secure OpenVPN on EdgeRouter X?
Enable TLS-auth if available for extra security, use server certificates, and push restrictive client routes. Keep the OpenVPN port closed to only the required clients and use strong credentials or certificates. Regularly rotate client certs and server keys.
What if my VPN tunnel keeps dropping every few minutes?
Check:
- IKE/ESP lifetimes and rekey settings on both sides
- Network stability: intermittent WAN drops cause VPNs to renegotiate
- Firewall rules that might be blocking ESP or IKE keep-alive packets
- NAT traversal status if you’re behind NAT
Where can I find official EdgeRouter VPN documentation?
Start with Ubiquiti’s EdgeRouter X documentation and the EdgeOS VPN guide on ubnt.com/help and help.ubnt.com. The community forums are also a great place to see real-world setups and troubleshooting tips.
Conclusion Note: not included in structure, but closing tips
If you’ve followed the IPsec site-to-site steps and tested the tunnel, you’ve got a solid VPN foundation on your EdgeRouter X. You can then expand with remote-access OpenVPN if you need individual devices to connect, or you can add more tunnels for additional sites. Keep your firmware up to date, maintain tight firewall rules, and periodically audit your VPN configurations to keep things secure and reliable. Edge client vpn
— End of guide —