Edgerouter site-to-site vpn is a feature that lets two separate networks connect securely over the internet using EdgeRouter devices. In this guide, you’ll find a practical, hands-on approach to planning, configuring, testing, and maintaining a robust IPsec-based site-to-site VPN between two offices or data centers. Think of it as a reliable tunnel that keeps private LAN traffic private as it travels across public networks. Below you’ll find a step-by-step setup, best practices, troubleshooting tips, and real-world considerations for a Canadian context. If you’re looking for an extra layer of protection for your site-to-site traffic, consider NordVPN with this deal: 
Useful URLs and Resources un clickable:
- EdgeRouter documentation – docs.ubnt.com
- IPsec site-to-site overview – en.wikipedia.org/wiki/Virtual_private_network
- OpenVPN project – openvpn.net
- IKEv2/IPsec concepts – en.wikipedia.org/wiki/IKEv2
- Canadian privacy and data protection basics – justice.gc.ca
- Ubiquiti forums and community tips – community.ui.com
- Networking best practices for small businesses – cisco.com
- VLAN and subnet planning basics – infosec.gov
Introduction: what you’ll get in this article
If you’re wondering how to connect two remote sites with a single, secure tunnel using EdgeRouter hardware, you’re in the right place. This guide provides a practical, step-by-step route from planning to wartime-proof testing, with tips tailored for real-world networks in Canada. We’ll cover:
- Why IPsec site-to-site is the right choice for branch-to-branch connectivity
- How to plan subnets, NAT exemptions, and routing for a clean tunnel
- A concrete, copy-paste-able configuration example for EdgeRouter devices
- How to test and verify the tunnel is up, along with common troubleshooting steps
- Security best practices, maintenance tips, and performance considerations
- A transparent comparison of alternatives like WireGuard on EdgeRouter hardware
- A detailed FAQ to clear up common questions and pitfalls
If you want extra protection for your site-to-site traffic, check out NordVPN’s current deal via the banner above. It’s a simple way to add an additional layer of encryption for remote management sessions or admin work when you’re away from the office.
Body
What is Edgerouter site-to-site vpn and why it matters
Edgerouter site-to-site vpn is the process of securely connecting two separate private networks over the public internet using IPsec Internet Protocol Security as the encryption and authentication backbone. Each site runs EdgeRouter devices from Ubiquiti that negotiate a secure tunnel, encapsulate traffic, and route packets between the two LANs as if they were on the same network.
Key concepts you’ll encounter:
- IPsec tunnels: The secure channels that carry traffic between the two sites.
- IKE/IPsec phases: IKE phase 1 for authentication and secure channel setup. IKE phase 2 also called IPsec phase for negotiating encryption and AH/ESP parameters.
- Local and remote networks: The subnets to be reachable across the tunnel, e.g., 192.168.10.0/24 at Site A and 192.168.20.0/24 at Site B.
- PSK vs certificates: Pre-shared keys are simple for smaller deployments. certificates scale better for large organizations.
- NAT traversal: If one or both sites sit behind NAT, edge devices typically handle NAT-T to keep the tunnel alive.
Why this matters, especially for Canadian networks:
- Privacy and security: VPN tunnels protect sensitive internal traffic from eavesdropping while traversing public networks.
- Reliability for multi-site organizations: A well-designed site-to-site VPN reduces latency surprises and keeps inter-site resources reachable.
- Compliance considerations: When data leaves your site, encryption helps meet internal security policies and industry guidelines.
Supported EdgeRouter models and prerequisites
EdgeRouter hardware comes in several varieties, and most support IPsec site-to-site VPN configurations. Common models include EdgeRouter X, EdgeRouter Lite, EdgeRouter 4, EdgeRouter 6P, EdgeRouter 12, and newer EdgeRouter models. Prerequisites to get started:
- A compatible EdgeRouter running EdgeOS with current firmware. Check the latest release notes for IPsec improvements and stability fixes.
- Public static IPs or dynamic DNS at both sites. If you have dynamic IPs, you’ll want a reliable dynamic DNS setup to keep peers reachable.
- A clear subnet plan for both sites that avoids overlapping IP ranges. Overlaps cause routing issues inside the tunnel.
- Administrative access to both EdgeRouter devices and a plan for firewall rules to permit VPN traffic.
- A decision on PSK vs certificate-based authentication. For small to medium deployments, a strong PSK is often enough.
- Basic network hygiene: up-to-date firmware, firewall enabled, and monitored logs.
Pro tip: if you’re aiming for stable remote management, consider keeping management interfaces separate e.g., a dedicated management VLAN and only allow VPN access from trusted admin IPs. Wireguard vpn edgerouter x
Planning your site-to-site VPN topology
Before you flip the switch, sketch the topology. A couple of common patterns:
- Hub-and-spoke: A central site hub connects to several remote sites spokes. This minimizes tunnel configurations and simplifies routing.
- Full mesh: Every site has a tunnel to every other site. This provides redundancy but increases configuration complexity.
- Subnet design: Use non-overlapping private subnets e.g., Site A 192.168.10.0/24, Site B 192.168.20.0/24. If you have cloud networks or data centers, map them into your on-prem subnets with care.
Routing and firewall considerations:
- Static routes or dynamic routing like OSPF can be used across the VPN. For most EdgeRouter setups, static routes paired with policy-based routing works well.
- NAT exemptions: You typically disable NAT between VPN peers so traffic keeps its original source/destination on the subnets behind each site.
- Firewall rules: Permit VPN traffic in both directions, and lock down admin access to trusted networks. A common rule is to allow IPsec ESP, AH if used, ISAKMP IKE, and UDP 500/4500 for IPsec NAT-T.
Networking sanity checks:
- Ensure the tunnel local address aligns with each site’s public IP or dynamic DNS hostname.
- Confirm the remote network’s subnet is correct and reachable from the local tunnel endpoints.
- Consider MTU and fragmentation: VPN packets can push MTU beyond a device’s capability. adjusting MTU or enabling DF-bit handling helps.
Step-by-step: How to configure Edgerouter site-to-site VPN IPsec, PSK
Below is a practical, copy-paste-ready outline for a typical two-site IPsec VPN using EdgeRouter devices. This example uses a simple pre-shared key PSK and a common AES256/SHA256 setup. Adjust the IPs, subnets, and PSK to fit your environment.
- Define IKE IKEv2 group and ESP group
set vpn ipsec ike-group IKE-GROUP1 proposal 1 encryption aes256
set vpn ipsec ike-group IKE-GROUP1 proposal 1 hash sha256
set vpn ipsec ike-group IKE-GROUP1 proposal 1 lifetime 3600
set vpn ipsec esp-group ESP-GROUP1 proposal 1 encryption aes256
set vpn ipsec esp-group ESP-GROUP1 proposal 1 hash sha256
set vpn ipsec esp-group ESP-GROUP1 proposal 1 lifetime 3600
2 Enable IPsec on the interface you use to reach the internet choose the correct interface
set vpn ipsec interface eth0
3 Define the remote peer Site B and authentication
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 "YourStrongPSKHere"
set vpn ipsec site-to-site peer 203.0.113.2 ike-group IKE-GROUP1
set vpn ipsec site-to-site peer 203.0.113.2 default-lspi 1
Note: replace 203.0.113.2 with Site B’s public IP or dynamic DNS host.
4 Local and remote identities and subnets
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 tunnel 1 local prefix 192.168.10.0/24
set vpn ipsec site-to-site peer 203.0.113.2 tunnel 1 remote prefix 192.168.20.0/24
set vpn ipsec site-to-site peer 203.0.113.2 tunnel 1 esp-group ESP-GROUP1
5 Optional: PFS perfect forward secrecy and dead peer detection
set vpn ipsec ike-group IKE-GROUP1 proposal 1 dh-group 14
set vpn ipsec site-to-site peer 203.0.113.2 pfsgroup 14
set vpn ipsec options keepalive 15
6 Firewall and NAT exemptions
- Create a firewall rule to allow VPN traffic in and out, and then a NAT exemption rule so traffic between the two VPN subnets doesn’t get NATed:
set firewall name VPN-INPUT rule 10 action accept
set firewall name VPN-INPUT rule 10 stateful true
set firewall name VPN-OUTPUT default-action accept
set nat source rule 1000 source address 192.168.10.0/24
set nat source rule 1000 destination address 192.168.20.0/24
set nat source rule 1000 translation address masquerade
7 Commit and save
commit
save
Troubleshooting tips if the tunnel doesn’t come up:
- Check the status with: show vpn ipsec sa
- Look at logs for IKE negotiation outcomes: show log | match ipsec or show log | match "IPsec"
- Verify that both ends’ subnets don’t overlap and that the local-address on each side is correct.
- Confirm both PSK values match and that IKE-group/ESP-group settings align.
- Ensure that NAT-T is not required but that both sides support it when one side is behind NAT.
Testing and verification
- Basic ping tests: From Site A, ping a host in Site B’s LAN e.g., 192.168.20.1. If you get replies, your tunnel is likely up.
- IPsec SA status: show vpn ipsec sa to see active Security Associations.
- Traceroute: traceroute to a remote subnet can help confirm that traffic is flowing through the VPN and not via the public internet.
Advanced testing options:
- Run traffic capture on the EdgeRouter interfaces to confirm that encrypted VPN traffic is traversing the intended path.
- Use path MTU discovery tests to avoid fragmentation issues. If you see ICMP fragmentation needed, adjust MTU or enable fragmentation handling.
Testing scenarios: real-world checks you should perform
- Inter-site routing checks: Ensure routes on both sides point to the correct remote subnet for traffic destined to the other site.
- DNS resolution through the tunnel: If you rely on internal DNS, check that hostnames resolve correctly via the remote site when appropriate.
- Admin tasks over VPN: If you’re managing devices remotely, confirm you can reach management interfaces through the tunnel.
- Failover testing: If you have a backup link, test that the VPN gracefully remains up or recovers quickly when a link fails.
Common pitfalls and troubleshooting
- Subnet overlap: If your Site A and Site B use overlapping IP spaces, you will see routing issues or traffic that never reaches the tunnel. Rework subnets before continuing.
- NAT and firewall misconfigurations: Ensure you’re not NATting traffic between the VPN peers unless you intend to. firewall rules should explicitly permit VPN-related traffic.
- Dynamic IP addresses: If either site uses a dynamic IP, the tunnel will fail to connect until the dynamic DNS update is in place and the EdgeRouter is configured to connect to the updated host.
- Incorrect PSK or phase mismatches: Always double-check the PSK and IKE/ESP group settings on both ends.
- MTU and fragmentation: VPN tunnels can push packet sizes that exceed hardware limits. reduce MTU or enable proper fragmentation handling to avoid dropped packets.
- Logging and monitoring gaps: Without ongoing monitoring, a VPN issue can go unnoticed for hours. Consider setting up alerts for VPN tunnel status changes.
Security best practices and maintenance
- Use strong, unique PSKs and rotate them periodically. For larger deployments, switch to certificates and a PKI for authentication.
- Keep EdgeRouter firmware up to date. Firmware updates often include security and stability improvements for VPN features.
- Harden firewall settings: restrict admin access, enable logging for VPN events, and apply principle of least privilege for management interfaces.
- Separate management networks from user networks to minimize exposure in case of a compromised VPN.
- Enable Dead Peer Detection DPD and keepalive to quickly detect a failed tunnel and re-establish it.
- Regular audits: Review tunnel configurations, subnets, and routing tables to prevent drift over time.
Performance considerations and optimization
- Hardware matters: EdgeRouter models with higher CPU and memory will sustain more VPN tunnels and higher throughput. Expect consumer-grade devices to handle a couple of parallel tunnels at typical office speeds. enterprise models scale much better.
- Encryption overhead: AES-256 and SHA-256 are secure and common but come with CPU cost. If you hit performance ceilings, consider tuning ESP parameters or testing a lighter cipher suite e.g., AES-128 if security requirements allow.
- Keepalive intervals and DPD: Tuning keepalive frequency can reduce reconnection time on unstable links, but set a sensible value to avoid unnecessary traffic.
- MTU tuning: If you’re seeing occasional packet loss, reduce the MTU on the VPN interface to prevent fragmentation.
- Split-tunneling vs full-tunneling: Decide whether all traffic should go through the VPN full-tunnel or only specific subnets split-tunnel. Split-tunneling reduces VPN load but may expose some traffic to the public internet.
Alternative approaches and comparisons
- WireGuard on EdgeRouter: Some EdgeRouter devices can run WireGuard with additional packages or firmware, but the official, out-of-the-box experience for site-to-site “as a feature” is IPsec. WireGuard can offer simpler configuration and lower overhead on some hardware, but compatibility and maintenance considerations across sites may complicate rollout.
- OpenVPN site-to-site: OpenVPN is another option, particularly if you’re already using OpenVPN in other parts of your network. It can be easier to manage across some environments but might require more CPU overhead on EdgeRouter devices depending on configurations.
- Cloud VPN services: If you’re connecting to cloud environments AWS, Azure, Google Cloud, compare IPsec site-to-site against cloud-native VPN alternatives to ensure consistent security posture and latency.
Canada-specific considerations
- Connectivity and latency: In Canada, reaching data centers in different provinces or cross-border with the US can introduce notable latency. Plan your topology with realistic RTTs in mind, and design subnets to minimize unnecessary cross-site traffic.
- Privacy and compliance: While VPNs protect traffic from eavesdropping, ensure you’re not accidentally logging sensitive internal data beyond what’s necessary for maintenance. Align VPN usage with internal policies and applicable privacy guidelines.
- Internet service constraints: Some ISPs may have CGNAT or other issues that complicate VPN connectivity. If you rely on consumer-grade internet to connect multiple sites, consider business-grade connections with static IPs to reduce churn risk.
- Cross-border data considerations: If you’re routing sensitive data into or through the United States, be mindful of data sovereignty policies and vendor agreements. Encrypting traffic at multiple layers VPN + application-level encryption can add defense in depth.
Frequently Asked Questions
# What is Edgerouter site-to-site vpn?
Edgerouter site-to-site vpn is a configuration on EdgeRouter devices that creates a secure IPsec tunnel between two private LANs over the internet, enabling seamless inter-site communication.
# Do EdgeRouter devices support IPsec site-to-site VPN?
Yes. EdgeRouter devices support IPsec site-to-site VPN configurations, including IKEv1/II and ESP, with PSK or certificate-based authentication depending on the model and firmware.
# Can I use dynamic IP addresses for site-to-site VPN?
Yes, but it’s easier if one or both sites use dynamic DNS so the remote peers can resolve the changing public IP address. Some setups also support IPsec with dynamic peers using a hostname.
# How do I configure IKEv2 on EdgeRouter?
EdgeRouter configurations typically use the IPsec module with an ike-group block that defines encryption, hash, and lifetime. The exact commands depend on your firmware version, but the pattern is to create an IKE group, assign it to the tunnel, and then define the peer with a PSK or certificate.
# What’s the difference between site-to-site VPN and client VPN?
Site-to-site VPN connects entire networks LANs across sites so devices on opposite sides can talk as if they were on the same network. Client VPN connects individual devices to a remote network, typically for remote access rather than inter-site connectivity.
# How do I test if the VPN is up?
Check the IPsec SA status with show vpn ipsec sa, ping hosts on the remote LAN, and view system logs for IKE/IPsec negotiation messages. You can also use traceroute to verify traffic routing.
# How do I handle overlapping subnets?
Overlap causes routing confusion. Rework one side’s LAN addresses so they don’t intersect with the other side’s subnets. If changing subnets isn’t feasible, use NAT or different VPN tunnel instances with unique routes.
# What encryption should I use for IPsec?
AES-256 with SHA-256 is a common, strong choice. You can opt for AES-128 for lighter hardware loads if your security requirements allow. Always pair encryption with a strong integrity hash.
# How do I rotate PSKs on EdgeRouter?
Change the PSK on both peers under the site-to-site peer configuration, then re-establish the tunnel. After updating, monitor logs to confirm both sides reconcile and the tunnel comes back up.
# Can I run multiple tunnels on one EdgeRouter?
Yes. You can configure multiple IPsec site-to-site tunnels to connect to different remote networks. Make sure the local subnet plans and peer definitions don’t conflict and that the device has enough CPU headroom for the expected throughput.
Closing notes
Building a reliable Edgerouter site-to-site VPN takes careful planning, precise configuration, and ongoing maintenance. With the right topology, security practices, and testing discipline, you’ll have a resilient bridge between your offices or data centers that behaves predictably under normal load and during failures. If you’re new to VPNs, start small—one tunnel between two sites—and scale up as you validate performance and reliability. And if you want an extra layer of privacy for admin tasks or remote access, the NordVPN deal shown above can be a good companion to your security stack.
Frequently asked questions are just the start. If you keep encountering edge cases or need a deeper dive into a specific EdgeRouter model, the community forums and official documentation are invaluable resources. Stay curious, test often, and document changes so your network remains stable as you grow.
好用的vpn排名最新2025-2026版:全方位测评、使用场景与购买指南