# IPsec Configuration

## Overview

This guide explains how to configure an IPsec VPN tunnel between RouterOS and CONTROL. The configuration process involves setting up both endpoints to establish a secure site-to-site connection.

---

## Part 1: RouterOS Configuration

### Initial Access

1. Log in to RouterOS using your default credentials
2. Navigate to **IP** → **IPsec** in the left-side menu

<a href="https://docs.zequenze.com/uploads/images/gallery/2024-04/ixOdjSjE6bwYC75N-image.png" target="_blank" rel="noopener"><img src="https://docs.zequenze.com/uploads/images/gallery/2026-04/CuYYcOqSUK63efqi-tmp-bjgfjvp.png" alt="image.png"></a>

---

### Step 1: Configure Profiles (Phase 1)

The profile defines Phase 1 parameters for the IPsec connection.

1. Click the **Profiles** tab in the center panel
2. Click **Add New** to create a new profile

<a href="https://docs.zequenze.com/uploads/images/gallery/2024-04/1Hr9ZYc0VSWZwVVt-image.png" target="_blank" rel="noopener"><img src="https://docs.zequenze.com/uploads/images/gallery/2026-04/J0EejcKqTM0Pw0a3-tmpgeibx115.png" alt="image.png"></a>

3. Configure the following Phase 1 parameters:

   - **Name**: Enter a descriptive name to identify the profile (e.g., "profile-to-ctl01.dev")
   - **Hash Algorithms**: Select a hash algorithm that matches the configuration on the remote endpoint
   - **Encryption Algorithm**: Choose an encryption algorithm that matches the remote endpoint configuration
   - **Lifetime**: Leave the default value (measured in seconds)
   - **NAT Traversal**: Enable this option if the router is behind NAT
   - **DPD Interval**: Leave the default value for Dead Peer Detection and note this number
   - **DPD Maximum Failures**: Leave the default value

4. Click **Apply**, then click **OK**

<a href="https://docs.zequenze.com/uploads/images/gallery/2024-04/XZ7tMqKa7ZOfiiWO-image.png" target="_blank" rel="noopener"><img src="https://docs.zequenze.com/uploads/images/gallery/2026-04/RsYVnEKUZMtmgHDd-tmpza6hj-wz.png" alt="image.png"></a>

---

### Step 2: Configure Peers

The peer configuration defines the remote VPN endpoint.

1. Click the **Peers** tab
2. Click **Add New**

<a href="https://docs.zequenze.com/uploads/images/gallery/2024-04/oG4s3ulGxOb1EMrO-image.png" target="_blank" rel="noopener"><img src="https://docs.zequenze.com/uploads/images/gallery/2026-04/azRGqWvpywgd1c1B-tmp11axrenm.png" alt="image.png"></a>

3. Configure the following fields:

   - **Name**: Enter a name to identify the remote peer
   - **Address**: Enter the remote public IP address (e.g., 35.35.35.22/32)
   - **Profile**: Select the profile created in Step 1
   - **Exchange Mode**: Select the exchange mode (IKE2 is recommended)

4. Click **Apply**, then click **OK**

<a href="https://docs.zequenze.com/uploads/images/gallery/2024-04/2w72Jc7gb71K8EJ5-image.png" target="_blank" rel="noopener"><img src="https://docs.zequenze.com/uploads/images/gallery/2026-04/MTdMS8AQFJSwGHch-tmppf5v6lqa.png" alt="image.png"></a>

---

### Step 3: Configure Identities

The identities configuration defines authentication credentials.

1. Click the **Identities** tab
2. Click **Add New**

<a href="https://docs.zequenze.com/uploads/images/gallery/2024-04/qMvIKN2zAE37nI4l-image.png" target="_blank" rel="noopener"><img src="https://docs.zequenze.com/uploads/images/gallery/2026-04/9vmP3sBTtOFHth6P-tmpurrkq4e4.png" alt="image.png"></a>

3. Configure the following fields:

   - **Peer**: Select the peer configured in Step 2
   - **Auth. Method**: Select "pre shared key"
   - **Secret**: Enter the pre-shared key that will be configured on both endpoints

4. Click **Apply**, then click **OK**

<a href="https://docs.zequenze.com/uploads/images/gallery/2024-04/27Cmwwp1auCA0TUM-image.png" target="_blank" rel="noopener"><img src="https://docs.zequenze.com/uploads/images/gallery/2026-04/HRejTJs2WSah8fCe-tmpsuuu6fhl.png" alt="image.png"></a>

---

### Step 4: Configure Proposals (Phase 2)

The proposal defines Phase 2 parameters for the IPsec connection.

1. Click the **Proposals** tab
2. Click **Add New**

<a href="https://docs.zequenze.com/uploads/images/gallery/2024-04/9Md51XaHNkLXoZ2m-image.png" target="_blank" rel="noopener"><img src="https://docs.zequenze.com/uploads/images/gallery/2026-04/pcSs9XqIZWqPm4Zc-tmp463hqmmv.png" alt="image.png"></a>

3. Configure the following Phase 2 parameters:

   - **Name**: Enter a name to identify this proposal
   - **Auth. Algorithms**: Select the authentication algorithm to be used on both endpoints
   - **Encr. Algorithms**: Select the encryption algorithm to be used on both endpoints
   - **Lifetime**: Set the lifetime for Phase 2
   - **PFS Group**: Select the Diffie-Hellman group for Perfect Forward Secrecy (PFS). This determines the session key generation during key exchange

4. Click **Apply**, then click **OK**

<a href="https://docs.zequenze.com/uploads/images/gallery/2024-04/7MJlKzftoRObZPZv-image.png" target="_blank" rel="noopener"><img src="https://docs.zequenze.com/uploads/images/gallery/2026-04/AMWw1pMppUb3z103-tmp-0hz65w9.png" alt="image.png"></a>

---

### Step 5: Configure Policies

The policy defines which traffic should pass through the VPN tunnel.

1. Click the **Policies** tab
2. Click **Add New**

<a href="https://docs.zequenze.com/uploads/images/gallery/2024-04/QXUnmuT8JS2qOPU6-image.png" target="_blank" rel="noopener"><img src="https://docs.zequenze.com/uploads/images/gallery/2026-04/uftHIY8tUUtTfv3m-tmpth97u6i4.png" alt="image.png"></a>

3. Configure the following fields:

   - **Peer**: Select the peer configured in Step 2
   - **Tunnel**: Enable this option to establish the tunnel between both sites
   - **Src. Address**: Enter the local IP address or network that will pass through the tunnel
   - **Dst. Address**: Enter the remote IP address or network that will be received from the other end
   - **Level**: Select "unique"
   - **Proposal**: Select the proposal created in Step 4

4. Click **Apply**, then click **OK**

<a href="https://docs.zequenze.com/uploads/images/gallery/2024-04/vTa8HCosm3z0e4a2-image.png" target="_blank" rel="noopener"><img src="https://docs.zequenze.com/uploads/images/gallery/2026-04/y65Hn1rNMWCcpcyW-tmpl37egfwm.png" alt="image.png"></a>

---

## Part 2: CONTROL Configuration

### Initial Navigation

1. Navigate to the **Links** section in the left-side menu
2. Select the **Services** tab at the top
3. Click the **+Add** button

<a href="https://docs.zequenze.com/uploads/images/gallery/2024-04/eOAzuU6goAPyNv67-image.png" target="_blank" rel="noopener"><img src="https://docs.zequenze.com/uploads/images/gallery/2026-04/N5xen64Of2fUFymR-tmp30xojx5q.png" alt="image.png"></a>

---

### Step 1: Create IPsec Security Service (Phase 1)

1. Configure the basic information:

   - **Name**: Enter a name to identify Phase 1
   - **Short-name/code**: Enter a short identifier for quick reference
   - **Organization**: Select the organization that will use this connection
   - **Type**: Select "IPsec Security"

2. Click **Save** at the bottom

<a href="https://docs.zequenze.com/uploads/images/gallery/2024-04/rxPwMfv7Up9KStZC-image.png" target="_blank" rel="noopener"><img src="https://docs.zequenze.com/uploads/images/gallery/2026-04/IA8ttMP2VWlMpPtn-tmph13-3k3.png" alt="image.png"></a>

3. Configure the Phase 1 parameters to match your RouterOS configuration:

   - **Authentication method**: Select "PSK"
   - **IKE version**: Select "Version 2"
   - **Encryption algorithm**: Enter "aes256"
   - **Integrity algorithm**: Enter "sha256" or "sha2_256"
   - **Diffie Hellman group (PFS)**: Enter "modp1024"
   - **Lifetime**: Enter 1200 (equivalent to 20 minutes)
   - **Key negotiation retries**: Enter "0"
   - **Aggressive Mode**: Enable this option

4. Click **Save and close** at the bottom

<a href="https://docs.zequenze.com/uploads/images/gallery/2024-04/9heogVcoLs3ZiE3d-image.png" target="_blank" rel="noopener"><img src="https://docs.zequenze.com/uploads/images/gallery/2026-04/lt3PF7Q9rEV9RRi5-tmpdm8yiu5a.png" alt="image.png"></a>

---

### Step 2: Create IPsec Configuration Service (Phase 2)

1. In the **Services** tab, click **+Add** again to create another service

2. Configure the basic information:

   - **Name**: Enter a name to identify Phase 2
   - **Short-name/code**: Enter a short identifier for quick reference
   - **Organization**: Select the organization that will use this connection
   - **Type**: Select "IPsec Configuration"

<a href="https://docs.zequenze.com/uploads/images/gallery/2024-04/NIVU6yjXNNTh2meF-image.png" target="_blank" rel="noopener"><img src="https://docs.zequenze.com/uploads/images/gallery/2026-04/BihahtpS2Hj3GXSy-tmpsmx3sjru.png" alt="image.png"></a>

3. Configure the Phase 2 parameters to match your RouterOS configuration:

   - **Tunnel type**: Select "Tunnel (ESP)"
   - **Encryption algorithm**: Enter "aes256"
   - **Integrity algorithm**: Enter "sha256" or "sha2_256"
   - **Diffie Hellman group (PFS)**: Enter "modp1024"
   - **Lifetime**: Enter 1200 (equivalent to 20 minutes)

<a href="https://docs.zequenze.com/uploads/images/gallery/2024-04/8pq4eJMotkyxJNdr-image.png" target="_blank" rel="noopener"><img src="https://docs.zequenze.com/uploads/images/gallery/2026-04/VgFVGEd2CWiWOU2B-tmpd3o-gqiv.png" alt="image.png"></a>

---

### Step 3: Create Association

1. In the **Links** section, select the **Association** tab
2. Click the **+Add** button

<a href="https://docs.zequenze.com/uploads/images/gallery/2024-04/Ncl0ExRDg2Oszj4r-image.png" target="_blank" rel="noopener"><img src="https://docs.zequenze.com/uploads/images/gallery/2026-04/JZUIC94IlmvcIiyg-tmpkjp8ev8s.png" alt="image.png"></a>

3. Configure the following fields:

   - **Name**: Enter a name to identify this association
   - **Short-name / code**: Enter a short identifier for quick reference
   - **Type**: Leave "IPSec VPN" selected
   - **Local gateway type**: Leave "Private IP" selected
   - **Remote gateway address**: Enter the remote public IP address you are connecting to
   - **Remote gateway id**: Enter the WAN interface IP of the RouterOS device
   - **Secret**: Enter the pre-shared key (must match the secret configured in RouterOS)
   - **Security service**: Select the IPsec Security service created in Step 1
   - **Configuration service**: Select the IPsec Configuration service created in Step 2
   - **Server**: Select the internal server to use
   - **Organization**: Select the organization that will use this connection

<a href="https://docs.zequenze.com/uploads/images/gallery/2024-04/DXFGEOo6ITxGXA25-image.png" target="_blank" rel="noopener"><img src="https://docs.zequenze.com/uploads/images/gallery/2026-04/tKjtJkVXYhjqNJ8q-tmpqs6mbsml.png" alt="image.png"></a>

---

### Step 4: Create Link

1. In the **Links** section, ensure you are on the **Links** tab
2. Click the **+Add** button

<a href="https://docs.zequenze.com/uploads/images/gallery/2024-04/BTDjb4fBIfge0jTD-image.png" target="_blank" rel="noopener"><img src="https://docs.zequenze.com/uploads/images/gallery/2026-04/xVtJCpKpXoSPYEGN-tmp9jxsvcsh.png" alt="image.png"></a>

3. Configure the following fields:

   - **Name**: Enter a name to identify this link
   - **Short-name / code**: Enter a short identifier
   - **Active**: Enable this option to activate the link
   - **Association**: Select the association created in Step 3
   - **Local network**: Enter the local Zequenze IP address
     - For CONTROL: typically `172.31.255.254/32`
     - For GATE: typically `172.31.255.253/32`
     - (Verify the correct IP internally before configuring)
   - **Remote network**: Enter the remote network or IP address that will pass through the tunnel to Zequenze
   - **Check services**: Select "PING Connectivity test" to validate tunnel communication
   - **Check address/hostname**: Enter a remote IP address that is always active for connectivity testing (typically the remote gateway, e.g., 192.168.106.154)
   - **Organization**: Select the organization that will use this VPN connectivity

<a href="https://docs.zequenze.com/uploads/images/gallery/2024-04/N61Uyxx64ZHFuU3t-image.png" target="_blank" rel="noopener"><img src="https://docs.zequenze.com/uploads/images/gallery/2026-04/0XKIq1W3zfkX9dou-tmpwuwdvwwk.png" alt="image.png"></a>

---

## Verification and Summary

### RouterOS Connection Status

Once the configuration is complete, you should see the connection established in RouterOS as shown below:

<a href="https://docs.zequenze.com/uploads/images/gallery/2024-04/W0SCa5Qw275CHJ1F-image.png" target="_blank"><img src="https://docs.zequenze.com/uploads/images/gallery/2026-04/9mGwjvrB1MgmpNOf-tmpi2cstgdj.png" alt="image.png"></a>

### CONTROL Connection Status

The Link within CONTROL should appear as follows when successfully established:

<a href="https://docs.zequenze.com/uploads/images/gallery/2024-04/xwmCCa4PQMT1jj6x-image.png" target="_blank"><img src="https://docs.zequenze.com/uploads/images/gallery/2026-04/yz3wfDqEwNkSwMqu-tmp-mb8dpe4.png" alt="image.png"></a>

This completes the IPsec VPN tunnel configuration between RouterOS and CONTROL. The tunnel should now be active and passing traffic between the configured networks.