Tutorials · Security

How to Connect Two Offices With a Site-to-Site IPsec VPN

Link branch and head office securely over the Internet: plan subnets, match IKE and IPsec settings, and route traffic through the tunnel.

Advanced18 min6 steps

Before you start

  • A VPN-capable gateway or firewall at each site
  • Public IP addresses (or DDNS) at each site
  • Non-overlapping LAN subnets

Step by step

  1. Plan addressing

    Each site needs a unique subnet, for example 10.1.0.0/16 for head office and 10.2.0.0/16 for the branch. Overlapping subnets break routing.

  2. Choose crypto settings

    Use IKEv2 with AES-256 (or AES-GCM), SHA-256 or better and Diffie-Hellman group 14 or higher. Both sides must match.

  3. Configure phase 1 (IKE)

    Enter the peer's public IP, the authentication method (pre-shared key or certificate) and the IKE proposal.

  4. Configure phase 2 (IPsec)

    Define local and remote subnets and the IPsec proposal, and enable perfect forward secrecy.

  5. Add routes and firewall rules

    Route the remote subnet through the tunnel and allow only the required traffic between sites.

  6. Test and monitor

    Ping across the tunnel, test applications and enable dead-peer detection so the tunnel recovers automatically.

Pro tips

  • Use certificates or long random pre-shared keys.
  • Combine with 4G LTE backup for branches that must stay connected.
How to Connect Two Offices With a Site-to-Site IPsec VPN | Navijin Tutorials