Skip to content

UniFi

Connect an office behind a UniFi gateway to a Vipilink network with one IPsec tunnel between a Vipilink gateway and the UniFi gateway. The tunnel is route-based: UniFi sends traffic for the Vipilink network into the tunnel, and Vipilink sends traffic for the office subnet back through it.

Before you start

  • A Vipilink network with at least one active gateway.
  • A UniFi gateway with a public IP on its WAN, managed in the UniFi Network app, and an admin account.
  • The Vipilink network subnet and the office subnet must not overlap.

The screens on this page are from UniFi Network 10.0 on a UniFi Gateway (UXG Fiber).

Example used on this page

Item Example value
Vipilink network Cloud, subnet 10.14.0.0/16
Vipilink gateway New Jersey
Office subnet behind the UniFi gateway 172.20.50.0/24
Tunnel name in Vipilink HQUniFi
Site-to-site VPN name in UniFi vipilink-cloud

Replace these with your own values.

Settings that must match

Both sides of the tunnel must use the same values. This page uses the Vipilink defaults. UniFi's Auto settings use IKEv1, AES-128 and SHA1, so you set UniFi to Manual.

Setting Vipilink UniFi
IKE version V2 Key Exchange Version IKEv2
Phase 1 encryption and integrity aes256, sha256 IKE AES-256, SHA256
Phase 1 Diffie-Hellman group 14 IKE DH Group 14
Phase 1 lifetime IKE Lifetime 8h IKE Lifetime 28800
Phase 2 encryption and integrity aes256, sha256 ESP AES-256, SHA256
Phase 2 Diffie-Hellman group 14 ESP DH Group 14, Perfect Forward Secrecy (PFS) on
Phase 2 lifetime Tunnel Lifetime 1h ESP Lifetime 3600
Pre-shared key Pre-Shared Key Pre-Shared Key
  1. In the Vipilink console, go to Networks → Networks and open your network. Copy the public IP shown on the gateway card. You need it in UniFi.
  2. On the gateway card, click the ... menu and choose Add Tunnel.
  3. Choose IPsec Site-to-Site Tunnel and click Continue. Then choose Single-Tunnel and click Continue.
  4. Fill in the form:

    Field Value
    Tunnel Name HQUniFi. Letters and numbers only.
    Pre-Shared Key Click Generate and copy the key. You enter the same key in UniFi.
    Remote Public IP The UniFi gateway WAN IP
    Remote ID The UniFi gateway WAN IP
    Vipilink Side Subnets Any
    Remote Side Subnets Any

    A route-based UniFi tunnel uses 0.0.0.0/0 on both sides, so both subnet settings stay on Any. You tell Vipilink which subnet is behind the tunnel in Step 3.

  5. Keep the Advanced Settings defaults.

    IPsec Site-to-Site Tunnel form filled in for UniFi

  6. Click Add Tunnel. The tunnel card shows Down until the UniFi side is set up.

Step 2: Create the site-to-site VPN in UniFi

  1. In the UniFi Network app, open Settings → VPN, choose the Site-to-Site VPN tab and click Create New.

    UniFi VPN settings with the Site-to-Site VPN tab and Create New highlighted

  2. Fill in the form:

    Field Value
    VPN Type IPsec
    Name vipilink-cloud
    Pre-Shared Key Replace the generated key with the key from Vipilink
    Local IP Your WAN. UniFi fills in its IP.
    Remote IP / Hostname The Vipilink gateway public IP from Step 1
    VPN Method Route Based
    Tunnel IP Off
    Remote Networks Static, then enter the Vipilink network subnet, for example 10.14.0.0/16, and click Add
  3. Under Advanced, choose Manual and set:

    Field Value
    Key Exchange Version IKEv2
    IKE Encryption AES-256, Hash SHA256, DH Group 14, Lifetime 28800
    ESP Encryption AES-256, Hash SHA256, DH Group 14, Lifetime 3600
    Perfect Forward Secrecy (PFS) On

    Keep Local Authentication ID, Remote Authentication ID and Maximum Transmission Unit on Auto, and Route Distance at its default.

    UniFi site-to-site VPN form with the IPsec, route-based and manual settings highlighted

  4. Click Add. The VPN shows in the list. Its Status changes to Online when the tunnel is up.

    Site-to-Site VPN list with vipilink-cloud online

Tell Vipilink which subnet is behind the tunnel.

  1. On the network card, click the ... menu and choose Route Table.
  2. Click Add Routes, choose the HQUniFi tunnel, enter the office subnet, for example 172.20.50.0/24, and click Add Routes.

    Add Routes dialog with the HQUniFi tunnel and the office subnet

  3. The route appears in the table with the type Manual.

    Route Table with the office subnet routed through HQUniFi

Step 4: Let users reach the office subnet

If the network uses split tunneling in Manual mode, add the office subnet so connected users send that traffic through Vipilink:

  1. On the network card, click the ... menu and choose Split Tunneling.
  2. Under Manual, enter the office subnet, for example 172.20.50.0/24, and press Enter.
  3. Click Apply.

Split Tunneling dialog with the office subnet added

In Automatic (Full tunnel) mode there is nothing to change.

If the network's firewall is on, add a rule that allows users to reach the office subnet.

Step 5: Allow the traffic in the UniFi firewall

UniFi puts site-to-site VPNs in the VPN zone, and its default policies allow traffic between the VPN and Internal zones. If you or someone else changed those policies, Vipilink users can't reach the office. Add an explicit policy so the access doesn't depend on the defaults:

  1. Go to Settings → Policy Engine → Policy Table and click Create New Policy.
  2. Fill in the form:

    Field Value
    Type Firewall
    Name Allow Vipilink to Office LAN
    Source Zone VPN, then IP, Specific, the Vipilink network subnet, for example 10.14.0.0/16
    Action Allow, with Auto Allow Return Traffic on
    Destination Zone Internal, then IP, Specific, the office subnet, for example 172.20.50.0/24
    Port (source and destination) Any
    Match Opposite Off
    IP Version IPv4
    Protocol All
    Connection State All
    Match IPsec Off
    Schedule Always
    Description For example Lets Vipilink users reach the office LAN

    Create Policy, top: type, name, source zone, action and destination zone

    Create Policy, bottom: IP version and description

  3. Click Apply Policy at the bottom of the form. The policy table shows your policy and a second one for the opposite direction, which UniFi adds on its own for the return traffic.

    Policy Table filtered to the two Vipilink policies

Do this only if Intrusion Prevention is on and it blocks traffic between Vipilink users and the office.

  1. Go to Settings → CyberSecure, open the Protection tab, and under Detection Exclusions click Create New.
  2. Fill in the Detection Exclusion:

    Field Value
    Traffic Direction Both
    Type Subnet
    Subnet The Vipilink network subnet, for example 10.14.0.0/16

    Detection Exclusion with the Vipilink subnet

  3. Click Apply Changes in the dialog, then Apply Changes at the bottom of the page.

    Detection Exclusions list with the Vipilink subnet

Excluded traffic is not checked by intrusion prevention.

Step 7: Check the connection

  1. In UniFi, the vipilink-cloud VPN shows Online in the Site-to-Site VPN list (see Step 2).
  2. In the Vipilink console, the tunnel card shows Up.

    Vipilink network with the HQUniFi tunnel up

  3. Connect a device to the network with the Vipilink agent and reach a device in the office, for example with ping to a private IP.

    Terminal pinging an office IP while the Vipilink agent is connected

Troubleshooting

Problem What to check
Tunnel stays Down The pre-shared key is the same on both sides. In Vipilink, Remote Public IP and Remote ID are the UniFi WAN IP. In UniFi, Remote IP / Hostname is the Vipilink gateway public IP, Advanced is Manual, and the values match the table above.
Tunnel is Up but nothing responds The Vipilink route table has the office subnet. UniFi Remote Networks has the Vipilink network subnet. If split tunneling is Manual, the office subnet is in the list. No UniFi policy blocks the VPN zone.
Some traffic is dropped Intrusion prevention may be blocking it. See Step 6.

For every field of the Vipilink tunnel form, see IPsec tunnel.