# Instructions for Creating VPN Connections



# Instructions for Creating VPN connection in Ubuntu

<p class="callout info">Before setting up a VPN connection, in the user tree in the desired user’s card, check the box **Allow remote access via VPN.** To do this, go to **Users -&gt; User &amp; Group**:</p>

[![1. Instructions for Creating VPN connection in Ubuntu.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/nPAzmWJwbZNorTN4-1-instructions-for-creating-vpn-connection-in-ubuntu.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/nPAzmWJwbZNorTN4-1-instructions-for-creating-vpn-connection-in-ubuntu.png)

---

<details id="bkmrk-pptp-protocol-before"><summary>PPTP Protocol</summary>

Before creating a connection in Ubuntu, go to SafeUTM, **Users -&gt; VPN connections,** and check the box **PPTP Connection**:  
[![2. Instructions for Creating VPN connection in Ubuntu.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/jameUxXzfpFg6QqQ-2-instructions-for-creating-vpn-connection-in-ubuntu.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/jameUxXzfpFg6QqQ-2-instructions-for-creating-vpn-connection-in-ubuntu.png)

**Creating a connection in Ubuntu**

1\. Go to **Settings -&gt; Networks** and in the **VPN** line**,** click **(+)**:  
[![3. Instructions for Creating VPN connection in Ubuntu.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/LobD8ntHfpCdpcJn-3-instructions-for-creating-vpn-connection-in-ubuntu.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/LobD8ntHfpCdpcJn-3-instructions-for-creating-vpn-connection-in-ubuntu.png)

2\. In the connection creation window, select **Point-to-Point Tunnel Protocol (PPTP)**:  
[![4. Instructions for Creating VPN connection in Ubuntu.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/McWjRc8VlWWOBEda-4-instructions-for-creating-vpn-connection-in-ubuntu.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/McWjRc8VlWWOBEda-4-instructions-for-creating-vpn-connection-in-ubuntu.png)

3\. In the **Identification** section fill in the following fields:

- **Name** – the connection name.
- **Gateway** – the domain name or IP address of the UTM interface.
- **Username** – the name of the user allowed to connect via VPN.
- **Password** – the user's password. In the right part of the field, select the storage option for the VPN connection password.
- **NT domain** – leave the field empty.  
    [![5. Instructions for Creating VPN connection in Ubuntu.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/ymyUevrAgq5z5HKB-5-instructions-for-creating-vpn-connection-in-ubuntu.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/ymyUevrAgq5z5HKB-5-instructions-for-creating-vpn-connection-in-ubuntu.png)

We recommend that you click **Advanced** and check the following:

- **Allow the following authentication methods** – check the item
- **Use MPPE encryption** – in the Encryption line, select 128-bit (the most protected).
- **Use BSD compression for data** – using the BSD-compress algorithm.
- **Use Deflate compression for data** – using Deflate algorithm.
- **Use TCP Header Compression** – using Van Jacobson's TCP/IP header compression method.  
    [![6. Instructions for Creating VPN connection in Ubuntu.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/nmjlFvQUeVzulhEh-6-instructions-for-creating-vpn-connection-in-ubuntu.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/nmjlFvQUeVzulhEh-6-instructions-for-creating-vpn-connection-in-ubuntu.png)

4\. Click **OK** and **Add**.  
5\. Set the switch of the created VPN connection to the Enabled position:  
[![7. Instructions for Creating VPN connection in Ubuntu.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/ztAsaMuvyk2C5yOx-7-instructions-for-creating-vpn-connection-in-ubuntu.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/ztAsaMuvyk2C5yOx-7-instructions-for-creating-vpn-connection-in-ubuntu.png)

</details>---

<details id="bkmrk-ikev2%2Fipsec-protocol"><summary>IKEv2/IPsec Protocol</summary>

Before creating a connection in Ubuntu, configure SafeUTM:

1\. Go to **Users -&gt; VPN connections**.  
2\. Check the box **IKEv2/IPsec** **Connection** and fill in the **Domain** fields:  
[![8. Instructions for Creating VPN connection in Ubuntu.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/6lFZ5wZvaqbC3gkO-8-instructions-for-creating-vpn-connection-in-ubuntu.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/6lFZ5wZvaqbC3gkO-8-instructions-for-creating-vpn-connection-in-ubuntu.png)

3\. Download the root certificate from **Services -&gt; TLS Certificates**:  
[![9. Instructions for Creating VPN connection in Ubuntu.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/dapxaPqnQuoilSZR-9-instructions-for-creating-vpn-connection-in-ubuntu.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/dapxaPqnQuoilSZR-9-instructions-for-creating-vpn-connection-in-ubuntu.png)

The root certificate will be required to configure the connection of the user's workstation if the root certificate was not obtained via Let’s Encrypt. If necessary, transfer the certificate file to the workstation.

If a certificate issued by Let's Encrypt is used for a VPN connection, then installing a root certificate on the device is not required.

##### Creating a connection in Ubuntu

1\. Open the terminal with the keyboard shortcut Ctrl+Alt+F1 and run the command: `sudo apt install -y network-manager-strongswan libcharon-extra-plugins libstrongswan-extra-plugins`   
2\. After the installation is complete, restart the computer: `sudo reboot`  
3\. Go to **Settings -&gt; Networks**  and in the **VPN** line, click (+):  
[![10. Instructions for Creating VPN connection in Ubuntu.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/DLwICOx18DtouT96-10-instructions-for-creating-vpn-connection-in-ubuntu.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/DLwICOx18DtouT96-10-instructions-for-creating-vpn-connection-in-ubuntu.png)

4\. In the window that opens, select **IPsec\\IKEv2 (strongswan)**:  
[![11. Instructions for Creating VPN connection in Ubuntu.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/lUuzniPFCEbcg1j6-11-instructions-for-creating-vpn-connection-in-ubuntu.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/lUuzniPFCEbcg1j6-11-instructions-for-creating-vpn-connection-in-ubuntu.png)

5\. In **Identification** fill in the following fields:

- **Name** – connection name.
- **Address** – enter the domain specified in **Users -&gt; Authorization -&gt; VPN Connection -&gt; IKEv2/IPsec Connection.**
- **Certificate** – select the previously saved root certificate (if it was not issued by Let's Encrypt).
- **Authentication** – we recommend choosing EAP.  
    **Username** – the name of the user allowed to connect via VPN.
- **Password** – the user's password. In the right part of the field, select the storage option for the VPN connection password.

Check the box **Request an inner IP address** and click **Add:  
[![12. Instructions for Creating VPN connection in Ubuntu.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/66nzuFa2zN9VqO6p-12-instructions-for-creating-vpn-connection-in-ubuntu.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/66nzuFa2zN9VqO6p-12-instructions-for-creating-vpn-connection-in-ubuntu.png)**

 6. Set the switch of the created VPN connection to the Enabled position.

</details>---

<details id="bkmrk-sstp-protocol-before"><summary>SSTP Protocol</summary>

Before creating a connection in Ubuntu, configure SafeUTM:

1\. Go to **Users -&gt; VPN connections**.  
2\. Check the box **SSTP Connection** and fill in **Domain** and **Port** fields:  
[![13. Instructions for Creating VPN connection in Ubuntu.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/xjaRWQEoShCAur0O-13-instructions-for-creating-vpn-connection-in-ubuntu.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/xjaRWQEoShCAur0O-13-instructions-for-creating-vpn-connection-in-ubuntu.png)

##### Creating a connection in Ubuntu

1\. Open the terminal with the keyboard shortcut Ctrl+Alt+F1 and run two commands:

```
sudo apt-add-repository ppa:eivnaes/network-manager-sstp
sudo apt install -y network-manager-sstp sstp-client
```

2\. After the installation is complete, restart the computer: `sudo reboot`  
3\. Having installed the packages, go to **Settings -&gt; Networks,** and in the **VPN** line, click (+):  
[![14. Instructions for Creating VPN connection in Ubuntu.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/KQCWsVAWtyAfrrmt-14-instructions-for-creating-vpn-connection-in-ubuntu.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/KQCWsVAWtyAfrrmt-14-instructions-for-creating-vpn-connection-in-ubuntu.png)

4\. In the window that opens, select **Point-to-Point Tunnel Protocol (SSTP)**:  
[![15. Instructions for Creating VPN connection in Ubuntu.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/VPsR8Jtv2NTXq0Yt-15-instructions-for-creating-vpn-connection-in-ubuntu.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/VPsR8Jtv2NTXq0Yt-15-instructions-for-creating-vpn-connection-in-ubuntu.png)

5\. In **Identification** fill in the following fields:

- **Name** – connection name.
- **Gateway** – specify in the format *domain:\[port selected on UTM\].*
- **Username** – the name of the user allowed to connect via VPN.
- **Password** – the user's password. In the right part of the field, select the storage option for the VPN connection password.
- **NT domain** – leave the field empty.  
    [![16. Instructions for Creating VPN connection in Ubuntu.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/hadL9k0sWW6pExR9-16-instructions-for-creating-vpn-connection-in-ubuntu.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/hadL9k0sWW6pExR9-16-instructions-for-creating-vpn-connection-in-ubuntu.png)

We recommend that you click **Advanced** and check the following:

- **Allow the following authentication methods** – check the item
- **Use MPPE encryption** – in the Encryption line, select 128-bit (the most protected).
- **Use BSD compression for data** – using the BSD-compress algorithm.
- **Use Deflate compression for data** – using Deflate algorithm.
- **Use TCP Header Compression** – using Van Jacobson's TCP/IP header compression method.

6\. Click **Add** and set the switch of the created VPN connection to the Enabled position:  
[![17. Instructions for Creating VPN connection in Ubuntu.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/4hIOMVgmWdEHEaKE-17-instructions-for-creating-vpn-connection-in-ubuntu.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/4hIOMVgmWdEHEaKE-17-instructions-for-creating-vpn-connection-in-ubuntu.png)

</details>---

<details id="bkmrk-l2tp%2Fipsec-protocol-"><summary>L2TP/IPsec Protocol</summary>

**Important**: L2TP IPsec clients behind the same NAT may experience connectivity issues if there is more than one. We recommend using IKEv2 IPSec instead of L2TP IPsec.

Before creating a connection, configure SafeUTM:

1\. Go to **Users -&gt; VPN connections**.  
2\. Check the box **L2TP/IPsec Connection** and copy the **PSK** key:  
[![18. Instructions for Creating VPN connection in Ubuntu.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/h8WhsFe46xVApxPT-18-instructions-for-creating-vpn-connection-in-ubuntu.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/h8WhsFe46xVApxPT-18-instructions-for-creating-vpn-connection-in-ubuntu.png)

##### Creating a connection in Ubuntu

1\. Connect the repository that contains the necessary packages to create an L2TP VPN connection, and then update the information about the repositories. To do this, run the following commands:

```
sudo add-apt-repository ppa:nm-l2tp/network-manager-l2tp
sudo apt update
```

2\. Install the add-on to the standard NetworkManager using two packages: `sudo apt install -y network-manager-l2tp network-manager-l2tp-gnome`  
3\. After the installation is complete, restart the computer: `sudo reboot`  
4\. Having installed the packages, go to **Settings -&gt; Networks** and in the **VPN** line, click (+):  
[![17. Instructions for Creating VPN connection in Ubuntu.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/4hIOMVgmWdEHEaKE-17-instructions-for-creating-vpn-connection-in-ubuntu.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/4hIOMVgmWdEHEaKE-17-instructions-for-creating-vpn-connection-in-ubuntu.png)

5\. In the VPN connection creation window, select **Layer** **2 Tunneling Protocol (L2TP)**:  
[![19. Instructions for Creating VPN connection in Ubuntu.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/5ZIxGecn3tfHTJ2a-19-instructions-for-creating-vpn-connection-in-ubuntu.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/5ZIxGecn3tfHTJ2a-19-instructions-for-creating-vpn-connection-in-ubuntu.png)

6 . In the tab **Identification** fill in the following fields:

- **Name** – connection name.
- **Gateway** – the domain name or IP address of the UTM interface.
- **Type** – user authentication by a password.
- **Username** – the name of the user allowed to connect via VPN.
- **Password** – the user's password. In the right part of the field, select the storage option for the VPN connection password.
- **NT domain** – leave the field empty.  
    [![20. Instructions for Creating VPN connection in Ubuntu.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/ZFvr5lriBbiDyeNr-20-instructions-for-creating-vpn-connection-in-ubuntu.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/ZFvr5lriBbiDyeNr-20-instructions-for-creating-vpn-connection-in-ubuntu.png)

7\. Go to **IPsec settings** and enable **IPsec tunnel to L2TP host** to activate the ability to configure other parameters:

- **Type: Pre-shared key (PSK)** – public key authentication.
- **Pre-shared key** - the key that needs to be copied along the path **Users -&gt; Authorization -&gt; VPN connection** from the field **PSK.**

The section **Advanced** is optional.  
[![21. Instructions for Creating VPN connection in Ubuntu.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/jBbkOoQpwC2BaIRF-21-instructions-for-creating-vpn-connection-in-ubuntu.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/jBbkOoQpwC2BaIRF-21-instructions-for-creating-vpn-connection-in-ubuntu.png)

Having finished configuring L2TP **IPsec Options,** click **OK.**

8\. If necessary, go to **PPR settings** and configure **Authentication**, **Encryption and Compression,** and **Other**:  
[![22. Instructions for Creating VPN connection in Ubuntu.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/LnYYcco0xqGM6rnv-22-instructions-for-creating-vpn-connection-in-ubuntu.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/LnYYcco0xqGM6rnv-22-instructions-for-creating-vpn-connection-in-ubuntu.png)

After setting up **PPR parameters** click OK** and **Apply**.

9\. Set the switch of the created VPN connection to the Enabled position:  
[![23. Instructions for Creating VPN connection in Ubuntu.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/7h9Urvdl67djkbne-23-instructions-for-creating-vpn-connection-in-ubuntu.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/7h9Urvdl67djkbne-23-instructions-for-creating-vpn-connection-in-ubuntu.png)

</details>

# Automatic Connection Creation

<p class="callout info">Before configuring a VPN connection, in the user tree, open the card of the required user and set the **Allow remote access via VPN** flag. To do this, go to the **Users -&gt; User &amp; Group** section:</p>

[![1. Automatic Connection Creation.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/5uJN0lFrLEyeDs2k-1-automatic-connection-creation.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/5uJN0lFrLEyeDs2k-1-automatic-connection-creation.png)

---

<details id="bkmrk-l2tp%2Fipsec-protocol-"><summary>L2TP/IPsec Protocol</summary>

**Important**: L2TP IPsec clients behind the same NAT may experience connectivity issues if there is more than one. [**Instructions**](https://docs.microsoft.com/en-us/troubleshoot/windows-server/networking/configure-l2tp-ipsec-server-behind-nat-t-device)<span style="background-color: #e03e2d;"> </span>can help solve the problem. We recommend using IKEv2 IPSec instead of L2TP IPsec.

You can run the following PowerShell script to automatically create a connection on users' computers running Windows 8.1 and 10. To do this, download the ready-made scripts for connecting your server from **Users -&gt; VPN connections**.

The connection will be created with the following parameters:

1. **L2TP/IPsec** protocol using a PSK key.
2. The parameter **Use the primary gateway in the remote network** is disabled.  
    LANs of the same class that was obtained for a VPN connection by default in Windows 7 and 10 will be accessed via a VPN connection, so you do not need to create additional routes (unless you use different network classes in the office LAN).

Create a file named **safe\_utm\_l2tp.ps1** (in Notepad or Windows PowerShell ISE Editor) and copy the following text into it:

```Powershell
param([switch]$Elevated)
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
if (!$currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator))  {
  if (!$elevated) {
    Start-Process `
            powershell.exe `
            -Verb RunAs `
            -ArgumentList ('-noprofile -noexit -file "{0}" -elevated' -f ( $myinvocation.MyCommand.Definition ))
  }
  exit
}
Enable-NetFirewallRule -Group "@FirewallAPI.dll,-28502"
Add-VpnConnection `
    -Force `
    -Name "SafeUTM L2TP VPN" `
    -TunnelType L2TP `
    -ServerAddress my.domain.com `
    -L2tpPsk "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" `
    -EncryptionLevel "Required" `
    -AuthenticationMethod MSChapV2 `
    -SplitTunneling $False `
    -DnsSuffix activedirectory.domain `
    -RememberCredential
```

**Change the necessary parameters in it to match your settings:**

- **SafeUTM L2TP VPN** – the connection name in the system (can be arbitrary).
- **domain.com** – the domain or IP address of the main external interface of SafeUTM.
- **XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX** – your server's PSK key.
- **domain** – your Active Directory domain (if there is one if not, you need to delete this line from the script).

**You can run the script on the user's computer from the file context menu "Run with PowerShell". Click OK in the elevation dialog (the rights are required to allow access to shared files and printers).**

After that, a connection will be created in the system and shared access to files and printers for all networks will be enabled (otherwise access to file resources in the local network may not be possible).

The user must enter their username/password at the first authorization.

**Possible errors when executing the script**

If the error "Script execution is disabled on this system" appears, you need to enable script execution by running the following command in PowerShell: `Set-ExecutionPolicy Unrestricted`

</details>---

<details id="bkmrk-sstp-protocol-you-ca"><summary>SSTP Protocol</summary>

You can run the following PowerShell script to automatically create a connection on users' computers running Windows 8.1 and 10. To do this, download the ready-made script from **Users -&gt; VPN connections**.

**The connection will be created with the following parameters:**

1. **SSTP** protocol using the PSK key.
2. The parameter **Use the primary gateway in the remote network** is disabled.  
    LANs of the same class that was obtained for VPN connections by default in Windows 7 and 10 will be accessed via a VPN connection, so you do not need to create additional routes (unless you use different network classes in the office LAN).

Create a text file named **safe\_utm\_sstp.ps1** (in Notepad or Windows PowerShell ISE editor) and copy the following text there:

```Powershell
param([switch]$Elevated)
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
if (!$currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator))  {
  if (!$elevated) {
    Start-Process `
            powershell.exe `
            -Verb RunAs `
            -ArgumentList ('-noprofile -noexit -file "{0}" -elevated' -f ( $myinvocation.MyCommand.Definition ))
  }
  exit
}
Enable-NetFirewallRule -Group "@FirewallAPI.dll,-28502"
Add-VpnConnection `
    -Force `
    -Name "SafeUTM SSTP VPN" `
    -TunnelType SSTP `
    -ServerAddress my.domain.com:4443 `
    -EncryptionLevel "Required" `
    -AuthenticationMethod MSChapV2 `
    -SplitTunneling $False `
    -DnsSuffix activedirectory.domain `
    -RememberCredential
```

**Change the necessary parameters in it to match your settings:**

1. **SafeUTM SSTP VPN** – the connection name in the system (can be arbitrary).
2. **my.domain. com:4443** – SafeUTM external interface domain and the port on which you enabled SSTP.
3. **activedirectory.domain** – your Active Directory domain (if there is no domain, you need to delete this line from the script).

**You can run the script on the user's computer from the file context menu "Run with PowerShell". Click OK in the elevation dialog (the rights are required to allow access to shared files and printers).**

After that, a connection will be created in the system and shared access to files and printers for all networks will be enabled (otherwise access to file resources in the local network may not be possible).

The user must enter their username/password at the first authorization.

**Possible errors when executing the script**

If the error "Script execution is disabled on this system" appears, you need to enable script execution by running the following command in PowerShell: `Set-ExecutionPolicy Unrestricted`

</details>---

<details id="bkmrk-ipsec-ikev2-protocol"><summary>IPsec IKEv2 Protocol</summary>

You can run a PowerShell script to automatically create a connection on users' computers running Windows 8.1 and 10. To do this, download the ready-made script from **Users -&gt; VPN connections**.

**The connection using the script will be created with the following parameters:**

1. IKEv2/IPsec Protocol
2. The parameter **Use the primary gateway in the remote network** is disabled. LANs of the same class that was obtained for the default VPN connection in Windows 7 and 10 will be accessed via a VPN connection, so you do not need to create additional routes (unless you use different network classes in the office LAN).

Create a text file named **safe\_utm\_ikev2.ps1** (in Notepad or Windows PowerShell ISE editor) and copy the following text there:

```Powershell
param([switch]$Elevated)
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
if (!$currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator))  {
  if (!$elevated) {
    Start-Process \`
            powershell.exe `
            -Verb RunAs `
            -ArgumentList ('-noprofile -noexit -file "{0}" -elevated' -f ( $myinvocation.MyCommand.Definition ))
  }
  exit
}
Enable-NetFirewallRule -Group "@FirewallAPI.dll,-28502"
Add-VpnConnection `
    -Force `
    -Name "SafeUTM IKEv2 VPN" `
    -TunnelType IKEv2 `
    -ServerAddress my.domain.com `
    -EncryptionLevel "Required" `
    -AuthenticationMethod EAP `
    -SplitTunneling $False `
    -DnsSuffix activedirectory.domain `
    -RememberCredential
```

**Change the necessary parameters in it to match your settings:**

1. **SafeUTM IKEv2 VPN** – the connection name in the system (can be arbitrary).
2. **my.domain.com** – the domain of SafeUTM external interface (A-record for the domain must refer to the IP address of SafeUTM external interface).
3. **activedirectory.domain** – your Active Directory domain (if there is one if not, you need to delete this line from the script).

You can run the script on the user's computer from the file context menu "Run with PowerShell". Click OK in the elevation dialog (the rights are required to allow access to shared files and printers).

After that, a connection will be created in the system, and file and printer sharing will be enabled for all networks (otherwise access to shared folders in the local network will not be possible).

During the first authorization, it is necessary to enter the username/password.

**Possible errors when executing the script**

If the error "Script execution is disabled on this system" appears, you need to enable script execution by running the following command in PowerShell: `Set-ExecutionPolicy Unrestricted`

</details>---

#### VPN connection errors

<details id="bkmrk-if-a-vpn-connection-"><summary>If a VPN connection using IPsec protocols in Windows is automatically terminated after 7 hours and 45 minutes and a "Group policy mapping" error or error 13868 occurs when connecting via IKEv2.</summary>

To restore the connection, the following actions are suitable:

1\. Reconnect. In this case, the connection will be restored, but after 7 hours and 45 minutes, it will be automatically disconnected again. If you do not want the connection to be terminated automatically, follow the steps from the following paragraph.  
2\. Make changes to the registry:

- Open the **Registry editor**.
- Follow the path `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RasMan\Parameters`
- Right-click on the parameter **NegotiateDH2048\_AES256** and click **Change**.
- In the **Value** line, specify value 1: [![2. Automatic Connection Creation.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/w3V4oh7EPXEl6NaA-2-automatic-connection-creation.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/w3V4oh7EPXEl6NaA-2-automatic-connection-creation.png)
- Click **OK**.
- Restart Windows.

If there is no parameter named **NegotiateDH2048\_AES256**, then create it. To do this:

- Right-click on the free registry space in **Parameters** and select **Create -&gt; DWORD**:
- Set the name **NegotiateDH2048\_AES256.**
- Right-click on the created file and select **Change**:
- In the **Value** line, specify value 1:
- Click **OK**.

3\. Restart Windows.

</details>

# Creating a VPN connection in Windows 10

<p class="callout info">Before configuring a VPN connection, in the user tree, open the card of the required user and set the **Allow remote access via VPN** flag. To do this, go to the **Users -&gt; User &amp; Group** section:</p>

[![1. Creating a VPN connection in Windows 10.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/dOVT5oIc6sOWd11n-1-creating-a-vpn-connection-in-windows-10.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/dOVT5oIc6sOWd11n-1-creating-a-vpn-connection-in-windows-10.png)

---

#### Creating a VPN connection in Windows 10

1\. Click on the network connection icon in the system tray, and in the window that appears, select **Network &amp; Internet settings**:  
[![2. Creating a VPN connection in Windows 10.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/nzXDV9jQPXABLZnW-2-creating-a-vpn-connection-in-windows-10.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/nzXDV9jQPXABLZnW-2-creating-a-vpn-connection-in-windows-10.png)

2\. Go to **VPN** and click **Add a VPN connection**:  
[![3. Creating a VPN connection in Windows 10.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/T5fho4aiqV8HXhz1-3-creating-a-vpn-connection-in-windows-10.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/T5fho4aiqV8HXhz1-3-creating-a-vpn-connection-in-windows-10.png)

3\. Fill in the following fields and click **Save**:

<details id="bkmrk-for-pptp-connection-"><summary>For PPTP</summary>

- Connection name - the name of the connection being created;
- Server name or address - VPN server address;
- VPN type - PPTP protocol;
- Login data type - Username and password;
- Username - the name of the user who is allowed to connect via VPN;
- Password - user password.  
    [![4. Creating a VPN connection in Windows 10.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/vmM7Lqdzo9ZgLfLg-4-creating-a-vpn-connection-in-windows-10.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/vmM7Lqdzo9ZgLfLg-4-creating-a-vpn-connection-in-windows-10.png)

When setting up a VPN connection from the Internet, the following parameters must be specified in the VPN connection properties:

- Go to **Settings of adapter parameters.**
- Right-click on the created connection and select **Properties**.
- Go to the tab **Security** and install: 
    - **Data encryption** – mandatory (disable if there is no encryption).
    - **Extensible Authentication Protocol (EAP)** – Microsoft Protected Password (EAP MSCHAPV2).

</details><details id="bkmrk-for-l2tp%2Fipsec-with-"><summary>For L2TP/IPsec with the shared key</summary>

**Important**: L2TP IPsec clients behind the same NAT may experience connectivity issues if there is more than one. Instructions can help solve the problem. We recommend using IKEv2 IPSec instead of L2TP IPsec.

- Connection name - the name of the connection being created;
- Server name or address - VPN server address;
- VPN type - L2TP/IPSec protocol with shared key;
- Shared key - the value of the **PSK** string in the **Users -&gt; VPN connections -&gt; L2TP/IPSec Connection** section;
- Login data type - Username and password;
- Username - the name of the user who is allowed to connect via VPN;
- Password - user password.  
    [![4. Creating a VPN connection in Windows 10.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/vmM7Lqdzo9ZgLfLg-4-creating-a-vpn-connection-in-windows-10.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/vmM7Lqdzo9ZgLfLg-4-creating-a-vpn-connection-in-windows-10.png)

When setting up a VPN connection from the Internet, you need to specify the following parameters in the VPN connection properties:

- Go to Adapter Options Settings;
- Right-click on the created connection and select Properties;
- Go to the Security tab and set: 
    - Data encryption - mandatory (disable if no encryption)
    - Extensible Authentication Protocol (EAP) - Microsoft Secure Password (EAP MSCHAPV2)

If you are creating a VPN connection to UTM via port forwarding, we recommend following these steps:

1. Open **Registry editor**.
2. Go to `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PolicyAgent` and create a DWORD parameter named <span data-slate-fragment="JTdCJTIyb2JqZWN0JTIyJTNBJTIyZG9jdW1lbnQlMjIlMkMlMjJkYXRhJTIyJTNBJTdCJTdEJTJDJTIybm9kZXMlMjIlM0ElNUIlN0IlMjJvYmplY3QlMjIlM0ElMjJibG9jayUyMiUyQyUyMnR5cGUlMjIlM0ElMjJwYXJhZ3JhcGglMjIlMkMlMjJpc1ZvaWQlMjIlM0FmYWxzZSUyQyUyMmRhdGElMjIlM0ElN0IlN0QlMkMlMjJub2RlcyUyMiUzQSU1QiU3QiUyMm9iamVjdCUyMiUzQSUyMnRleHQlMjIlMkMlMjJsZWF2ZXMlMjIlM0ElNUIlN0IlMjJvYmplY3QlMjIlM0ElMjJsZWFmJTIyJTJDJTIydGV4dCUyMiUzQSUyMkFzc3VtZVVEUEVuY2Fwc3VsYXRpb25Db250ZXh0T25TZW5kUnVsZSUyMiUyQyUyMm1hcmtzJTIyJTNBJTVCJTVEJTJDJTIyc2VsZWN0aW9ucyUyMiUzQSU1QiU1RCU3RCU1RCUyQyUyMmtleSUyMiUzQSUyMjBiZmNmZTE4ZDI0NzQyOTBhY2UyYjM5YzExN2IwY2YxJTIyJTdEJTVEJTJDJTIya2V5JTIyJTNBJTIyNTUwNDE4NDUzNGE0NDUxMmE0ZWZjNWViZTE4ZjUxOTIlMjIlN0QlNUQlMkMlMjJrZXklMjIlM0ElMjI2MDJjYjNmNWQ0MDA0MmEwOWM3N2I1ZjlhOWM2Yzc5YiUyMiU3RA==">AssumeUDPEncapsulationContextOnSendRule</span> and set it to 2.
3. Restart Windows.

**Possible problems**

1. The user's username or password is incorrect. Often, when reconnecting, it is suggested to specify the domain. Try to create alphanumeric passwords, preferably in Latin letters, for your accounts. If there are doubts, temporarily set the username and password as "user" and "123456".
2. In order for the packets to go through the VPN tunnel, you need to make sure that in the settings of this connection the box **Use primary gateway in remote network** is checked in **Configuring adapter settings -&gt; Right-click on the connection -&gt; Properties -&gt; Network -&gt; Properties of the option "Internet Protocol version 4 (TCP/IPv4)" -&gt; Advanced.** If it is not necessary to route all packets to this interface, then the route must be written manually.
3. The connection takes place via DNAT, i.e. the external interface of SafeUTM does not have a "white" IP address, and the ports necessary for operation (500 and 4500) are "forwarded" to the external interface of the device located in front of SafeUTM and having a "white" IP address. In this case, the VPN connection will either not be established at all, or there will be periodic interruptions. The solution is to exclude the device before SafeUTM and specify a "white" IP address on the external interface of SafeUTM, to which L2TP/IPsec connections will eventually be made. Otherwise, use the SSTP protocol, because it is easier to publish it using port forwarding.
4. If you reconnect via L2TP in Windows 10 OS, but use the **invalid** PSK key (by entering it in the advanced parameters \[screenshot below\]), the connection will still be established successfully. This is due to the features of the OS.

Make sure that the local network (or address on the network card) on the remote machine does not overlap with your organization's LAN. If it does, there will be no access to your organization's network (traffic through the routing table will go to the physical interface, not to the VPN). The address needs to be changed.

</details><details id="bkmrk-for-sstp-connection-"><summary>For SSTP</summary>

- Connection name - the name of the connection being created;
- Server name or address - VPN server address in the format VPN\_server\_address:port;
- VPN type - SSTP protocol;
- Login data type - Username and password;
- Username - the name of the user who is allowed to connect via VPN;
- Password - user password.  
    [![6. Creating a VPN connection in Windows 10.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/Mwe1LclYVeWG6Ou6-6-creating-a-vpn-connection-in-windows-10.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/Mwe1LclYVeWG6Ou6-6-creating-a-vpn-connection-in-windows-10.png)

</details><details id="bkmrk-for-ikev2-connection"><summary>For IKEv2</summary>

- Connection name - the name of the connection being created;
- Server name or address - VPN server address;
- VPN type - IKEv2 protocol;
- Login data type - Username and password;
- Username - the name of the user who is allowed to connect via VPN;
- Password - user password.  
    [![7. Creating a VPN connection in Windows 10.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/5Cjv2XW1mDHGtCjE-7-creating-a-vpn-connection-in-windows-10.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/5Cjv2XW1mDHGtCjE-7-creating-a-vpn-connection-in-windows-10.png)

When setting up a VPN connection from the Internet, you need to specify the following parameters in the VPN connection properties:

- Go to Adapter Options Settings;
- Right-click on the created connection and select Properties;
- Go to the Security tab and set: 
    - Data encryption - mandatory (disable if no encryption)
    - Extensible Authentication Protocol (EAP) - Microsoft Secure Password (EAP MSCHAPV2)

</details>4\. Activate the connection by left-clicking on the created connection and selecting **Connect**:  
[![8. Creating a VPN connection in Windows 10.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/r0MzUsruZsfi72Uf-8-creating-a-vpn-connection-in-windows-10.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/r0MzUsruZsfi72Uf-8-creating-a-vpn-connection-in-windows-10.png)

5\. To disconnect, click **Disconnect**. If you need to change the created connection, click **Advanced Parameters -&gt; Edit.  
[![9. Creating a VPN connection in Windows 10.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/xvXZ5kaLAzlDN0Fm-9-creating-a-vpn-connection-in-windows-10.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/xvXZ5kaLAzlDN0Fm-9-creating-a-vpn-connection-in-windows-10.png)**

---

#### VPN connection errors

<details id="bkmrk-if-a-vpn-connection-"><summary>If a VPN connection using IPsec protocols in Windows is automatically terminated after 7 hours and 45 minutes and a "Group policy mapping" error or error 13868 occurs when connecting via IKEv2.</summary>

To restore the connection, the following actions are suitable:

1\. Reconnect. In this case, the connection will be restored, but after 7 hours and 45 minutes, it will be automatically disconnected again. If you do not want the connection to be terminated automatically, follow the steps from the following paragraph.  
2\. Make changes to the registry:

- Open the **Registry editor**.
- Follow the path `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RasMan\Parameters`
- Right-click on the parameter **NegotiateDH2048\_AES256** and click **Change**.
- In the **Value** line, specify value 1: [![10. Creating a VPN connection in Windows 10.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/Su8brsrGBFFL76L0-10-creating-a-vpn-connection-in-windows-10.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/Su8brsrGBFFL76L0-10-creating-a-vpn-connection-in-windows-10.png)
- Click **OK**.
- Restart Windows.

If there is no parameter named **NegotiateDH2048\_AES256**, then create it. To do this:

- Right-click on the free registry space in **Parameters** and select **Create -&gt; DWORD**
- Set the name **NegotiateDH2048\_AES256.**
- Right-click on the created file and select **Change**
- In the **Value** line, specify value 1
- Click **OK**.

<div class="pointer-container" id="bkmrk-%C2%A0"><div class="pointer anim is-page-editable"><svg class="svg-icon" data-icon="link" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg><div class="input-group inline block"> <button class="button outline icon" data-clipboard-target="#pointer-url" title="Copy Link" type="button"><svg class="svg-icon" data-icon="copy" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg></button></div><svg class="svg-icon" data-icon="edit" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg></div></div>3\. Restart Windows.

</details><p class="callout info">If you do not want Internet traffic to go to external resources through SafeUTM after connecting via VPN, then in the properties of the VPN connection Network / Internet Protocol TCP / IP version 4 / Advanced, uncheck Use the default gateway on the remote network. Next, to access computers behind SafeUTM, manually enter routes.</p>

# Creating a VPN connection in Windows 7

<p class="callout info">Before configuring a VPN connection, in the user tree, open the card of the required user and set the **Allow remote access via VPN** flag. To do this, go to the **Users -&gt; User &amp; Group** section.</p>

[![1. Creating a VPN connection in Windows 7.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/FY6K7TDIEPEpl9ir-1-creating-a-vpn-connection-in-windows-7.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/FY6K7TDIEPEpl9ir-1-creating-a-vpn-connection-in-windows-7.png)

---

#### Creating a VPN connection in Windows 7

<p class="callout warning">L2TP IPsec clients behind the same NAT may experience connectivity issues if there is more than one. [**Instructions**](https://docs.microsoft.com/en-us/troubleshoot/windows-server/networking/configure-l2tp-ipsec-server-behind-nat-t-device) can help solve the problem. We recommend using IKEv2 IPSec instead of L2TP IPsec.</p>

Before creating a VPN connection for SSTP, L2TP, and IKEv2 protocols, you must install the root certificate locally on the computer:

1\. Download the Let's Encrypt root certificate from [**https://letsencrypt.org/certs/isrgrootx1.pem**](https://letsencrypt.org/certs/isrgrootx1.pem);  
2\. Click **Start**, find and run mmc.exe;  
3\. Click **File -&gt; Add or Remove Snap-in**:  
[![2. Creating a VPN connection in Windows 7.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/ij2ATLhVqbh9jN8T-2-creating-a-vpn-connection-in-windows-7.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/ij2ATLhVqbh9jN8T-2-creating-a-vpn-connection-in-windows-7.png)

4\. Select **Certificates** and click **Add**:  
[![3. Creating a VPN connection in Windows 7.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/Cc8RSBnFqR9MVAul-3-creating-a-vpn-connection-in-windows-7.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/Cc8RSBnFqR9MVAul-3-creating-a-vpn-connection-in-windows-7.png)  
5\. Set the flag in the **computer account** line, click **Next -&gt; Finish -&gt; OK**:  
[![4. Creating a VPN connection in Windows 7.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/yuweAc5Fvdmzvte6-4-creating-a-vpn-connection-in-windows-7.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/yuweAc5Fvdmzvte6-4-creating-a-vpn-connection-in-windows-7.png)  
6\. The **Certificates (local computer)** item will appear in the Console window:

- Select it and right-click on **Trusted Root Certification Authorities**;
- Next **All tasks -&gt; Import**
- In the **Certificate Import Wizard** window, click **Next -&gt; Browse -&gt; Select the one you downloaded in step 1 -&gt; Next -&gt; Next -&gt; Finish**.

##### Create a VPN connection

1\. Select **Network -&gt; Network and Sharing Center**:  
[![5. Creating a VPN connection in Windows 7.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/wXaZnPSs8QSVzDja-5-creating-a-vpn-connection-in-windows-7.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/wXaZnPSs8QSVzDja-5-creating-a-vpn-connection-in-windows-7.png)

2\. Click **Set up a new connection or network**:  
[![6. Creating a VPN connection in Windows 7.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/KNKhE5l8t6eNhlJd-6-creating-a-vpn-connection-in-windows-7.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/KNKhE5l8t6eNhlJd-6-creating-a-vpn-connection-in-windows-7.png)

3\. Select **Connect to a workplace** and **Next**:  
[![7. Creating a VPN connection in Windows 7.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/VAHLO0JUvZeXgkSX-7-creating-a-vpn-connection-in-windows-7.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/VAHLO0JUvZeXgkSX-7-creating-a-vpn-connection-in-windows-7.png)

4\. Click **Use my internet connection (VPN)** and fill in the following fields:

- **Internet address** - enter the name of the VPN server, for example, vpn.test.com
- **Destination name** - write an arbitrary name for the connection

Set the checkbox to **Do not connect now, only install to connect in the future  
[![8. Creating a VPN connection in Windows 7.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/Ikpjeev7CWstuc6j-8-creating-a-vpn-connection-in-windows-7.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/Ikpjeev7CWstuc6j-8-creating-a-vpn-connection-in-windows-7.png)**

5\. In the **Enter username and password** window, fill in the appropriate fields;  
6\. Click **Create**, then **Close**;  
7\. In the **Network and Sharing Center** window, select **Change adapter settings** in the upper left corner:  
[![9. Creating a VPN connection in Windows 7.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/Z2yAr7WBWc1syxzf-9-creating-a-vpn-connection-in-windows-7.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/Z2yAr7WBWc1syxzf-9-creating-a-vpn-connection-in-windows-7.png)

8\. Right-click on the created connection, and select **Properties**:  
[![10. Creating a VPN connection in Windows 7.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/u9I6m1qU3ASsEILW-10-creating-a-vpn-connection-in-windows-7.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/u9I6m1qU3ASsEILW-10-creating-a-vpn-connection-in-windows-7.png)

9\. In the window that opens, do the following:

- On the Network tab, uncheck all items except Internet Protocol Version 4
- On the Security tab: 
    - in the VPN type line, select the desired connection type
    - in the Data encryption line, select mandatory (turn off if there is no encryption)
    - in the Authentication line, select Allow the following protocols
    - leave the flag only in the Microsoft CHAP protocol version 2 (MS-CHAP v2)

If necessary, fill in **Additional properties**

10\. Click **OK** and close the **Network and Sharing Center**;  
11\. In the tray, click **Network**. A window will open with the created VPN connection;  
12\. Right-click on the connection and select **Connect**.

---

#### VPN connection errors

<details id="bkmrk-if-a-vpn-connection-"><summary>If a VPN connection using IPsec protocols in Windows is automatically terminated after 7 hours and 45 minutes and a "Group policy mapping" error or error 13868 occurs when connecting via IKEv2.</summary>

To restore the connection, the following actions are suitable:

1\. Reconnect. In this case, the connection will be restored, but after 7 hours and 45 minutes, it will be automatically disconnected again. If you do not want the connection to be terminated automatically, follow the steps from the following paragraph.  
2\. Make changes to the registry:

- Open the **Registry editor**.
- Follow the path `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RasMan\Parameters`
- Right-click on the parameter **NegotiateDH2048\_AES256** and click **Change**.
- In the **Value** line, specify value 1: [![11. Creating a VPN connection in Windows 7.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/ejdltjDXEc2ljjuB-11-creating-a-vpn-connection-in-windows-7.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/ejdltjDXEc2ljjuB-11-creating-a-vpn-connection-in-windows-7.png)
- Click **OK**.
- Restart Windows.

If there is no parameter named **NegotiateDH2048\_AES256**, then create it. To do this:

- Right-click on the free registry space in **Parameters** and select **Create -&gt; DWORD**
- Set the name **NegotiateDH2048\_AES256.**
- Right-click on the created file and select **Change**
- In the **Value** line, specify value 1
- Click **OK**.

<div class="pointer-container" id="bkmrk-%C2%A0-0"><div class="pointer anim is-page-editable"><svg class="svg-icon" data-icon="link" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg><div class="input-group inline block"> <button class="button outline icon" data-clipboard-target="#pointer-url" title="Copy Link" type="button"><svg class="svg-icon" data-icon="copy" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg></button></div><svg class="svg-icon" data-icon="edit" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg></div></div>3\. Restart Windows.

</details><div class="pointer-container" id="bkmrk-%C2%A0"><div class="pointer anim is-page-editable"><svg class="svg-icon" data-icon="link" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg><div class="input-group inline block"> <button class="button outline icon" data-clipboard-target="#pointer-url" title="Copy Link" type="button"><svg class="svg-icon" data-icon="copy" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg></button></div><svg class="svg-icon" data-icon="edit" role="presentation" viewbox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"></svg></div></div>3\. Restart Windows.

<p class="callout info">If you do not want Internet traffic to go to external resources through SafeUTM after connecting via VPN, then in the properties of the VPN connection **Network / Internet Protocol TCP / IP version 4 / Advanced**, uncheck **Use the default gateway on the remote network**. Next, to access computers behind SafeUTM, manually enter routes.</p>

# Instructions for Creating VPN Connection on Mobile Devices

Before configuring a VPN connection, in the user tree, open the card of the required user and set the **Allow remote access via VPN** flag. To do this, go to the **Users -&gt; User &amp; Group** section:  
[![1. Instructions for Creating VPN Connection on Mobile Devices.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/wrpo4a4WgzzWvDsB-1-instructions-for-creating-vpn-connection-on-mobile-devices.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/wrpo4a4WgzzWvDsB-1-instructions-for-creating-vpn-connection-on-mobile-devices.png)

---

<details id="bkmrk-connecting-via-stron"><summary>Connecting via the StrongSwan app</summary>

1\. Click **Add a VPN profile**:  
[![2. Instructions for Creating VPN Connection on Mobile Devices.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/YbtgYQVs380VOJtj-2-instructions-for-creating-vpn-connection-on-mobile-devices.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/YbtgYQVs380VOJtj-2-instructions-for-creating-vpn-connection-on-mobile-devices.png)

2 . Fill in the fields:

- Server – the domain specified in SafeUTM in **Users -&gt; VPN connections -&gt; IKEv2/IPsec Connection**;
- VPN type – IKEv2 EAP (Login/Password).
- Login – the name of the user allowed to connect via VPN.
- Password – the user's password.  
    [![3. Instructions for Creating VPN Connection on Mobile Devices.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/MCUDM3c1wjYUeq9G-3-instructions-for-creating-vpn-connection-on-mobile-devices.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/MCUDM3c1wjYUeq9G-3-instructions-for-creating-vpn-connection-on-mobile-devices.png)

3\. Click **Save** and then click on the created connection.

</details>---

<details id="bkmrk-connecting-on-androi"><summary>Connecting on Android</summary>

1\. Go to VPN in **Settings -&gt; Connections -&gt; Other settings.** If necessary, use the settings search bar.  
2\. Select the connection type and fill in the following fields:

**For PPTP:**

- Name – connection name.
- Server address – the address of the VPN server.
- Username – the name of the user allowed to connect via VPN.
- Password – the user's password.

**For IKEv2/IPsec MSCHAPv2:**

- Name – connection name.
- Server address – the address of the VPN server.
- IPsec ID – user's login.
- Server Certificate – received from the server.
- IPsec CA Certificate – do not check the server.
- User name – the name of the user allowed to connect via VPN.
- Password – the user's password.  
    [![4. Instructions for Creating VPN Connection on Mobile Devices.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/ptGDZ3vnRwi5vu3Y-4-instructions-for-creating-vpn-connection-on-mobile-devices.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/ptGDZ3vnRwi5vu3Y-4-instructions-for-creating-vpn-connection-on-mobile-devices.png)

**For L2TP/IPsec PSK:**

- Name – connection name.
- Server address – the address of the VPN server.
- IPsec shared key – the value of the **PSK** line in **Users -&gt; VPN Connections -&gt; L2TP/IPsec Connection**

4\. Click **Save** and activate the connection.

</details>---

<details id="bkmrk-connecting-on-ios-1."><summary>Connecting on iOS</summary>

1\. Go to **Settings -&gt; General -&gt; VPN:  
[![5. Instructions for Creating VPN Connection on Mobile Devices.PNG.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/X2eNxerFgxMYSntH-5-instructions-for-creating-vpn-connection-on-mobile-devices-png.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/X2eNxerFgxMYSntH-5-instructions-for-creating-vpn-connection-on-mobile-devices-png.png)**

2\. Click **Add VPN configuration**:  
[![6. Instructions for Creating VPN Connection on Mobile Devices.PNG.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/KIjfdzVXdfJeTQkZ-6-instructions-for-creating-vpn-connection-on-mobile-devices-png.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/KIjfdzVXdfJeTQkZ-6-instructions-for-creating-vpn-connection-on-mobile-devices-png.png)

3\. Select **Type** and fill in the corresponding fields:

**For PPTP:** Starting with iOS 10, Apple has removed support for the PPTP protocol.

- Description – connection name.
- Server – VPN server address.
- Account – the name of the user allowed to connect via VPN.
- Password – the user's password

**For L2TP:**

- Description – connection name.
- Server – VPN server address.
- Account – the name of the user allowed to connect via VPN.
- Password – the user's password.
- The shared key – the value of the **PSK** line in **Users -&gt; VPN connections -&gt; L2TP/IPsec Connection**.  
    [![7. Instructions for Creating VPN Connection on Mobile Devices.PNG.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/wsSwFKCIy5DVnk2x-7-instructions-for-creating-vpn-connection-on-mobile-devices-png.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/wsSwFKCIy5DVnk2x-7-instructions-for-creating-vpn-connection-on-mobile-devices-png.png)

**For IKEv2:**

- Description – connection name.
- Server – VPN server address.
- Remote ID – VPN server address.
- User name – the name of the user allowed to connect via VPN.
- Password – the user's password.  
    [![8. Instructions for Creating VPN Connection on Mobile Devices.PNG.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/kT3i2EAzPC33fCLb-8-instructions-for-creating-vpn-connection-on-mobile-devices-png.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/kT3i2EAzPC33fCLb-8-instructions-for-creating-vpn-connection-on-mobile-devices-png.png)

4\. Click **Done**.  
5\. To connect, slide the **Status** switch to the right.

</details>

# Instructions for creating a connection in Mac OS

Before setting up a VPN connection, in the user tree in the desired users’ card check the box **Allow remote access via VPN.** To do this, go to **Users -&gt; User &amp; Group**:  
[![1. Instructions for creating a connection in Mac OS.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/vIve5kGYlQIsNQ8T-1-instructions-for-creating-a-connection-in-mac-os.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/vIve5kGYlQIsNQ8T-1-instructions-for-creating-a-connection-in-mac-os.png)

---

<details id="bkmrk-pppoe-protocol-to-co"><summary>PPPoE Protocol</summary>

To configure SafeUTM, go to **Users -&gt; VPN connections** and check the box **PPPoE Connection**:  
[![2. Instructions for creating a connection in Mac OS.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/agmS3WoA7R9zFPcd-2-instructions-for-creating-a-connection-in-mac-os.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/agmS3WoA7R9zFPcd-2-instructions-for-creating-a-connection-in-mac-os.png)

**Creating a connection in Mac OS**

1\. Go to **System Preferences -&gt; Network.** 2. Click **Add** in the lower left corner (icon +).  
3\. In the window that appears, fill in:

- **Interface** – PPPoE
- **Ethernet** – for example, Wi-Fi.
- **Service name** – connection name.  
    [![3. Instructions for creating a connection in Mac OS.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/X5cQnygWyazt90Us-3-instructions-for-creating-a-connection-in-mac-os.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/X5cQnygWyazt90Us-3-instructions-for-creating-a-connection-in-mac-os.png)

4\. Click **Create** and fill in:

- **PPPoE service name –** the name of the service.
- **Account name –**
- **Password** **–** the user's password.  
    [![4. Instructions for creating a connection in Mac OS.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/oBAMsKo1opQbKTDs-4-instructions-for-creating-a-connection-in-mac-os.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/oBAMsKo1opQbKTDs-4-instructions-for-creating-a-connection-in-mac-os.png)

5\. Click **Connect**.

</details>---

<details id="bkmrk-ikev2%2Fipsec-protocol"><summary>IKEv2/IPsec Protocol</summary>

Configure SafeUTM:

1\. Go to **Users -&gt; VPN connections**.  
2\. Check the box **IKEv2/IPsec** **Connection** and fill in the **Domain** fields:  
[![5. Instructions for Creating VPN connection in Ubuntu.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/BZoHz8HxnhJExEgi-5-instructions-for-creating-vpn-connection-in-ubuntu.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/BZoHz8HxnhJExEgi-5-instructions-for-creating-vpn-connection-in-ubuntu.png)

**Creating a connection in Mac OS**

1\. Go to **System Preferences -&gt; Network:** 2. Click **Add** in the lower left corner (icon +).  
3\. In the window that appears, fill in the fields:

- **Interface** – VPN
- **VPN type** – IKEv2
- **Service name** – connection name.  
    [![6. Instructions for creating a connection in Mac OS.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/4TUsOixIB3hYKBxt-6-instructions-for-creating-a-connection-in-mac-os.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/4TUsOixIB3hYKBxt-6-instructions-for-creating-a-connection-in-mac-os.png)

4\. Click **Create**.  
5\. Configure the connection parameters:

- **Server address –** the address of the VPN server.
- **Remote ID –** duplicate the address of the VPN server.  
    [![7. Instructions for creating a connection in Mac OS.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/SHbY5FVhkLzZADJ9-7-instructions-for-creating-a-connection-in-mac-os.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/SHbY5FVhkLzZADJ9-7-instructions-for-creating-a-connection-in-mac-os.png)

6\. Select **Authentication settings.** 7. Enter the identification data and click **OK**:

- **Username** **–** the name of the user allowed to connect via VPN.
- **Password** **–** the user's password.  
    [![8. Instructions for creating a connection in Mac OS.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/N9s2w8pE0K90Ia0K-8-instructions-for-creating-a-connection-in-mac-os.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/N9s2w8pE0K90Ia0K-8-instructions-for-creating-a-connection-in-mac-os.png)

8\. Click **OK**.  
9\. Check the box **Show VPN status in the menu bar** and click **Apply**.

</details>---

<details id="bkmrk-l2tp%2Fipsec-protocol-"><summary>L2TP/IPsec Protocol</summary>

**Important**: L2TP IPsec clients behind the same NAT may experience connectivity issues if there is more than one. We recommend using IKEv2 IPSec instead of L2TP IPsec.

Before creating a connection, configure SafeUTM:

1\. Go to **Users -&gt; VPN connections**.  
2\. Check **L2TP/IPsec Connection** and copy the **PSK** key:  
[![9. Instructions for Creating VPN connection in Ubuntu.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/a5YZIoFlMP39D0f4-9-instructions-for-creating-vpn-connection-in-ubuntu.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/a5YZIoFlMP39D0f4-9-instructions-for-creating-vpn-connection-in-ubuntu.png)

**Creating a connection in Mac OS**

1\. Go to **System Preferences -&gt; Network:  
[![10. Instructions for creating a connection in Mac OS.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/5xkPugFGcYLAY6us-10-instructions-for-creating-a-connection-in-mac-os.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/5xkPugFGcYLAY6us-10-instructions-for-creating-a-connection-in-mac-os.png)** 2. Click **Add** in the lower left corner (icon +).  
3\. In the window that appears, fill in:

- **Interface –**
- **VPN type** **–** L2TP via IPsec.
- **Service name** **–** connection name.  
    [![11. Instructions for creating a connection in Mac OS.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/dP9nQvEQRV1F4F4y-11-instructions-for-creating-a-connection-in-mac-os.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/dP9nQvEQRV1F4F4y-11-instructions-for-creating-a-connection-in-mac-os.png)

4\. Click **Create**.  
5\. Fill in the **Server address** and **Account name:  
[![12. Instructions for creating a connection in Mac OS.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/6XD7BXkEqVB1Gr7M-12-instructions-for-creating-a-connection-in-mac-os.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/6XD7BXkEqVB1Gr7M-12-instructions-for-creating-a-connection-in-mac-os.png)**

6\. Check the box **Show VPN status in the menu bar** and select **Authentication settings.** 7. In **User authentication** fill in **Password** and in **Computer Authentication** fill in **Shared Key (Shared Secret).  
[![13. Instructions for creating a connection in Mac OS.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/aDX4f7xXs061mGrc-13-instructions-for-creating-a-connection-in-mac-os.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/aDX4f7xXs061mGrc-13-instructions-for-creating-a-connection-in-mac-os.png)**

8\. Click **OK -&gt; Apply**.

Turn on the VPN connection:

- In the upper-left part of the screen, click on the VPN connection.
- Select *Connect (service name specified in step 3)*:  
    [![14. Instructions for creating a connection in Mac OS.png](https://docs.safedns.com/uploads/images/gallery/2022-09/scaled-1680-/LLe0ZKhbQhxaEq3y-14-instructions-for-creating-a-connection-in-mac-os.png)](https://docs.safedns.com/uploads/images/gallery/2022-09/LLe0ZKhbQhxaEq3y-14-instructions-for-creating-a-connection-in-mac-os.png)

</details>

# Connecting Wi-Fi Keenetic Routers via SSTP

You can connect the user's home network to the VPN of the workplace network directly on the Keenetic router. (If you want to connect the office with Keenetic, follow the instructions).

---

All routers based on KeeneticOS 3.x.x are supported.

1\. Configure the users in SafeUTM and enable SSTP in **Users -&gt; VPN connections**.  
2\. Log in to the Keenetic web management interface: [http://my.keenetic.net](http://my.keenetic.net).  
3\. Install the **SSTP client** system component in the **System components options** menu.  
[![01.png](https://docs.safedns.com/uploads/images/gallery/2022-10/scaled-1680-/utFuxVGMGgcOlY2h-01.png)](https://docs.safedns.com/uploads/images/gallery/2022-10/utFuxVGMGgcOlY2h-01.png)

For more information about the settings, see [**Keenetic documentation**](https://help.keenetic.com/hc/en-us/articles/360000599979-SSTP-client).

4\. Create a connection: go to **Internet -&gt; Other Connections** and click **Add connection.  
[![02.png](https://docs.safedns.com/uploads/images/gallery/2022-10/scaled-1680-/GzwfBsVgN7uKnfyB-02.png)](https://docs.safedns.com/uploads/images/gallery/2022-10/GzwfBsVgN7uKnfyB-02.png)**

Don't check the box **Use it to access the Internet**.  
Enter the connection name, SSTP protocol, server address (**be** **sure to specify the port in the address separated by a colon**), username, and password.

5\. In **Network Rules -&gt; Routes** add routes to your workplace network.  
For example, if the office network is `10.0.0.0/8`, add the following route.  
[![03.png](https://docs.safedns.com/uploads/images/gallery/2022-10/scaled-1680-/IJsjMdJgSVx7Do5o-03.png)](https://docs.safedns.com/uploads/images/gallery/2022-10/IJsjMdJgSVx7Do5o-03.png)

Choose the VPN connection you created as **Interface** and check the box **Add automatically** so that the route is valid only when the VPN connection is active.

6\. Configure DNS for your local domain (for example, Active Directory) so that you can access resources (files and other servers) by DNS names.

In **Network Rules -&gt; Internet Filter -&gt; DNS Servers** specify the DNS server of your domain controller and the domain name.  
[![04.png](https://docs.safedns.com/uploads/images/gallery/2022-10/scaled-1680-/DNgLNj80fOa3qHp0-04.png)](https://docs.safedns.com/uploads/images/gallery/2022-10/DNgLNj80fOa3qHp0-04.png)

The setup is finished.

7\. Use the `ping` utility in the command line to check communication and routing.

`nslookup` - to check the local names resolution of the working network.

If the VPN works, but there is no connection to some resources (for example, file or RDP), use the instructions to diagnose problems.