Template:Networking rut manual vpn

From Teltonika Networks Wiki

Summary

Virtual Private Network (VPN) is a method of connecting multiple private networks across the Internet. VPNs can serve to achieve many different goals, but some of its main purposes are:

  • access between remote private networks;
  • data encryption;
  • anonymity when browsing the Internet.

This page is an overview of different types of VPNs supported by {{{name}}} routers.

OpenVPN

OpenVPN is an open-source software application that implements virtual private network (VPN) techniques for creating secure point-to-point or site-to-site connections in routed or bridged configurations and remote access facilities. It is often regarding as being the most universal VPN protocol because of its flexibility, support of SSL/TLS security, multiple encryption methods, many networking features and compatibility with most OS platforms.

{{{name}}} routers run OpenVPN version 2.4.5.

For more in-depth guides refer to our OpenVPN configuration examples page.

OpenVPN client


An OpenVPN client is an entity that initiates a connection to an OpenVPN server. To create a new client instance, go to the Services → VPN → OpenVPN section, select Role: Client, enter a custom name and click "Add New". An OpenVPN client instance with the given name will appear in the "OpenVPN Configuration list". A maximum of six OpenVPN client instances are allowed to be added.

To begin configuration, click the "Edit" button next to the client instance. Refer to the figure and table below for information on the OpenVPN client's configuration fields:

[[File:{{{file_openvpn_client_config}}}]]

Field name Value Description
Enable yes | no; Default: no Turns the OpenVPN instance ON or OFF.
TUN/TAP TUN (tunnel) | TAP (bridged); Default: TUN (tunnel) Virtual network device type.
  • TUN - a virtual point-to-point IP link which operates at the network layer (OSI layer 3), generally used when routing is required.
  • TAP - a virtual Ethernet adapter (switch), operates at the data link layer (OSI layer 2), generally used when bridging is required.
Protocol UDP | TCP; Default: UDP Transfer protocol used for the connection.
  • Transmission Control Protocol (TCP) - most commonly used protocol in the Internet protocol suite. It ensures the recipient will receive packets in the order they were sent by numbering, analysing response messages, checking for errors and resending them if an issue occurs. It should be used when reliability is crucial (for example, file transfer).
  • User Datagram Protocol (UDP) - packets are sent to the recipient without error-checking or back-and-forth quality control, meaning that when packets are lost, they are gone forever. This makes it less reliable but faster than TCP; therefore, it should be used when transfer speed is crucial (for example, video streaming, live calls).
Port integer [0..65535]; Default: 1194 TCP/UDP port number used for the connection. Make sure it matches the port number specified on the server side. When you enable the OpenVPN instance, a firewall rule allowing traffic on the selected port is automatically generated on the router.
LZO yes | no; Default: no Enables LZO data compression.
Encryption DES-CBC 64 | RC2-CBC 128 | DES-EDE-CBC 128 | DES-EDE3-CBC 192 | DESX-CBC 192 | BF-CBC 128 | RC2-40-CBC 40 | CAST5-CBC 128 | RC2-40CBC 40 | CAST5-CBC 128 | RC2-64-CBC 64| AES-128-CBC 128 | AES-192-CBC 192 | AES-256-CBC 256 | none; Default: BF-CBC 128 Algorithm used in packet encryption.
Authentication TLS | Static Key | Password | TLS/Password; Default: TLS Authentication mode, used to secure data sessions.
  • Static key is a secret key used for server–client authentication.
  • TLS authentication mode uses X.509 type certificates:
    • Certificate Authority (CA)
    • Client certificate
    • Client key
    All mentioned certificates can be generated using OpenVPN or Open SSL utilities on any type of host machine. One of the most popular utilities used for this purpose is called Easy-RSA.
  • Password is a simple username/password based authentication where the owner of the OpenVPN server provides the login data.
  • TLS/Password uses both TLS and username/password authentication.
TLS: TLS cipher All | DHE+RSA | Custom; Default: All Packet encryption algorithm cipher.
Remote host / IP address ip; Default: none IP address or hostname of an OpenVPN server.
Resolve retry integer | infinite; Default: infinite In case server hostname resolve fails, this field indicates the amount of time (in seconds) to retry the resolve. Specify infinite to retry indefinitely.
Keep alive two integers separated by a space; Default: none Defines two time intervals: one is used to periodically send ICMP request to the OpenVPN server, the other defines a time window, which is used to restart the OpenVPN service, if no ICMP response is received during the window time slice.
Example: 10 120
Static key: Local tunnel endpoint IP ip; Default: none OpenVPN IP address of the local network interface.
Static key: Remote tunnel endpoint IP ip; Default: none OpenVPN IP address of the remote network (server) interface.
Remote network IP address ip; Default: none LAN IP address of the remote network (client).
Remote network IP netmask netmask; Default: none LAN IP subnet mask of the remote network (client).
Password: User name string; Default: none User name used for authentication to the OpenVPN server.
Password: Password string; Default: none Password name used for authentication to the OpenVPN server.
Extra options string; Default: none Extra options to be used by the OpenVPN instance.
TLS/Password: HMAC authentication algorithm none | SHA1 | SHA256 | SHA384 | SHA512; Default: SHA1 HMAC authentication algorithm type.
TLS/Password: Additional HMAC authentication yes | no; Default: no An additional layer of HMAC authentication on top of the TLS control channel to protect against DoS attacks.
TLS/Password: HMAC authentication key .key file; Default: none Uploads an HMAC authentication key file.
TLS/Password: HMAC key direction 0 | 1 | none; Default: 1 The value of the key direction parameter should be complementary on either side (client and server) of the connection. If one side uses 0, the other side should use 1, or both sides should omit the parameter altogether.
TLS/Password: Certificate authority .ca file; Default: none Certificate authority is an entity that issues digital certificates. A digital certificate certifies the ownership of a public key by the named subject of the certificate.
TLS: Client certificate .crt file; Default: none Client certificate is a type of digital certificate that is used by client systems to make authenticated requests to a remote server. Client certificates play a key role in many mutual authentication designs, providing strong assurances of a requester's identity.
TLS: Client key .key file; Default: none Authenticates the client to the server and establishes precisely who they are.
TLS: Private key decryption password (optional) string; Default: none A password used to decrypt the server's private key. Use only if server's .key file is encrypted with a password.
Static key: Static pre-shared key .key file; Default: none Uploads a secret key file used for server–client authentication.

Additional notes:

  • Some configuration fields become available only when certain other parameters are selected. The names of the parameters are followed by a prefix that specifies the authentication type under which they become visible. Different color codes are used for different praefixa:
    • Red for Authentication: TLS
    • Purple for Authentication: Static key
    • Blue for Authentication: Password
  • After changing any of the parameters, don't forget to click the Save button located at the bottom-left of the page.

OpenVPN server


An OpenVPN server is an entity that waits for incoming connections from OpenVPN clients. To create a new server instance, go to the Services → VPN → OpenVPN section, select Role: Server, enter a custom name and click "Add New". An OpenVPN server instance with the given name will appear in the "OpenVPN Configuration list". Only one OpenVPN server instance is allowed to be added.

A server needs to have a public IP address in order to be available from the public network (the Internet).

To begin configuration, click the "Edit" button next to the server instance. Refer to the figure and table below for information on the OpenVPN server's configuration fields:

[[File:{{{file_openvpn_server_config}}}]]

Field name Value Description
Enable yes | no; Default: no Turns the OpenVPN instance ON or OFF.
TUN/TAP TUN (tunnel) | TAP (bridged); Default: TUN (tunnel) Virtual network device type.
  • TUN - a virtual point-to-point IP link which operates at the network layer (OSI layer 3), generally used when routing is required.
  • TAP - a virtual Ethernet adapter (switch), operates at the data link layer (OSI layer 2), generally used when bridging is required.
Protocol UDP | TCP; Default: UDP Transfer protocol used for the connection.
  • Transmission Control Protocol (TCP) - most commonly used protocol in the Internet protocol suite. It ensures the recipient will receive packets in the order they were sent by numbering, analysing response messages, checking for errors and resending them if an issue occurs. It should be used when reliability is crucial (for example, file transfer).
  • User Datagram Protocol (UDP) - packets are sent to the recipient without error-checking or back-and-forth quality control, meaning that when packets are lost, they are gone forever. This makes it less reliable but faster than TCP; therefore, it should be used when transfer speed is crucial (for example, video streaming, live calls).
Port integer [0..65535]; Default: 1194 TCP/UDP port number used for the connection. Make sure it matches the port number specified on the server side. When you enable the OpenVPN instance, a firewall rule allowing traffic on the selected port is automatically generated on the router.
LZO yes | no; Default: no Enables LZO data compression.
Encryption DES-CBC 64 | RC2-CBC 128 | DES-EDE-CBC 128 | DES-EDE3-CBC 192 | DESX-CBC 192 | BF-CBC 128 | RC2-40-CBC 40 | CAST5-CBC 128 | RC2-40CBC 40 | CAST5-CBC 128 | RC2-64-CBC 64| AES-128-CBC 128 | AES-192-CBC 192 | AES-256-CBC 256 | none; Default: BF-CBC 128 Algorithm used for packet encryption.
Authentication TLS | Static Key | TLS/Password; Default: TLS Authentication mode, used to secure data sessions.
  • Static key is a secret key used for server–client authentication.
  • TLS authentication mode uses X.509 type certificates:
    • Certificate Authority (CA)
    • Client certificate
    • Client key
    All mentioned certificates can be generated using OpenVPN or Open SSL utilities on any type of host machine. One of the most popular utilities used for this purpose is called Easy-RSA.
  • TLS/Password uses both TLS and username/password authentication.
Static key: Local tunnel endpoint IP ip; Default: none OpenVPN IP address of the local network interface.
Static key: Remote tunnel endpoint IP ip; Default: none OpenVPN IP address of the remote network (server) interface.
Static key: Remote network IP address ip; Default: none LAN IP address of the remote network (client).
Static key: Remote network IP netmask netmask; Default: none LAN IP subnet mask of the remote network (client).
TLS/TLS/Password: TLS cipher All | DHE+RSA | Custom; Default: All Packet encryption algorithm cipher.
TLS/TLS/Password: Client to client yes | no; Default: no Allows OpenVPN clients to communicate with each other on the VPN network.
TLS/TLS/Password: Keep alive two integers separated by a space; Default: none Defines two time intervals: one is used to periodically send ICMP request by the client to the OpenVPN server, the other defines a time window, which is used to restart the OpenVPN service, if no ICMP response is received during the window time slice.
Example: 10 120
TLS/TLS/Password: Vitual network IP address ip; Default: none IP address of the OpenVPN network.
TLS/TLS/Password: Vitual network netmask netmask; Default: none Subnet mask of the OpenVPN network.
TLS/TLS/Password: Push option OpenVPN options; Default: none Push options are a way to "push" routes and other additional OpenVPN options to connecting clients.
TLS/TLS/Password: Allow duplicate certificates yes | no; Default: no When enabled allows multiple clients to connect using the same certificates.
TLS/Password: User name string; Default: none User name used for authentication to the OpenVPN server.
TLS/Password: Password string; Default: none Password name used for authentication to the OpenVPN server.
Static key: Static pre-shared key .key file; Default: none Uploads a secret key file used for server–client authentication.
TLS/TLS/Password: Certificate authority .ca file; Default: none Certificate authority is an entity that issues digital certificates. A digital certificate certifies the ownership of a public key by the named subject of the certificate.
TLS/TLS/Password: Server certificate .crt file; Default: none A type of digital certificate that is used to identify the OpenVPN server.
TLS/TLS/Password: Server key .key file; Default: none Authenticates clients to the server.
TLS/TLS/Password: Diffie Hellman parameters .pem file; Default: none DH parameters define how OpenSSL performs the Diffie-Hellman (DH) key-exchange.
TLS/TLS/Password: CRL file (optional) .pem file | .crl file; Default: none A certificate revocation list (CRL) file is a list of certificates that have been revoked the the certificate authority (CA). It indicates which certificates are no longer acccepted by the CA and therefore cannot be authenticated to the server.

Additional notes:

  • Some configuration fields become available only when certain other parameters are selected. The names of the parameters are followed by a prefix that specifies the authentication type under which they become visible. Different color codes are used for different praefixa:
    • Red for Authentication: TLS
    • Purple for Authentication: Static key
    • Blue for Authentication: TLS/Password
  • After changing any of the parameters, don't forget to click the Save button located at the bottom-left of the page.

TLS Clients


TLS Clients is a way to differentiate clients by their Common Names (CN), which are found in the client certificate file. It can be used to assign specific VPN addresses to corresponding clients and bind them to their LAN addresses, making the server aware of which client has which LAN IP address.

The TLS Clients section can be found in the OpenVPN Server configuration window, provided that the OpenVPN server uses TLS or TLS/Password authentication methods. To create a new TLS client, type in the new client‘s name in the text field found bellow the TLS Clients tab and press the "Add" button. Refer to the figure and table below for information on the TLS Clients' configuration fields:

[[File:{{{file_openvpn_tls_clients_config}}}]]

Field name Value Description
VPN instance name string; Default: none With what VPN instance should the TLS Client be associated with. When left empty, this field filled automatically.
Endpoint name string; Default: none A custom name for the client.
Common name (CN) string; Default: none Client’s Common Name (CN) found in the client certificate file.
Virtual local endpoint ip; Default: none Client’s local address in the virtual network.
Virtual remote endpoint ip; Default: none Client’s remote address in the virtual network.
Private network ip; Default: none Client’s private network (LAN) IP address.
Private netmask ip; Default: none Client’s private network (LAN) IP netmask.

IPsec

IPsec configuration


[[File:{{{file_ipsec_config}}}]]

Field name Value Description
Enable yes | no; Default: no Turns the IPsec instance ON or OFF.
IKE version IKEv1 | IKEv2; Default: IKEv1 Internet Key Exchange (IKE) version used for key exchange.
  • IKEv1 - more commonly used but contains known issues, for example, dealing with NAT.
  • IKEv2 - updated version with increased and improved capabilities, such as integrated NAT support, supported multihosting, deprecated exchange modes (does not use main or aggressive mode; only 4 messages required to establish a connection).
Mode Main | Aggressive; Default: Main Internet Security and Key Management Protocol (ISAKMP) phase 1 exchange mode.
  • Main - performs three two-way exchanges between the initiator and the receiver (a total of 9 messages).
  • Aggressive - performs fewer exchanges than main mode (a total of 6 messages) by storing most data into the first exchange. In aggressive mode, the information is exchanged before there is a secure channel, making it less secure but faster than main mode.
Type Tunnel | Transport; Default: Tunnel Type of connection.
  • Tunnel - protects internal routing information by encapsulating the entire IP packet (IP header and payload); is commonly used in site-to-site VPN connections; supports NAT traversal.
  • Transport - only encapsulates IP payload data; is use client-to-site VPN connections; does not support NAT traversal; usually implemented with other tunneling protocols (for example, L2TP).
My identifier type FQDN | User FQDN | Address; Default: FQDN Defines the type of identity used in user (IPsec instance) authentication.
  • FQDN - identity defined by fully qualified domain name. It is the complete domain name for a host (for example, something.somedomain.com). Only supported with IKEv2.
  • User FQDN - identity defined by fully qualified username string (for example, [email protected]). Only supported with IKEv2.
  • Address - identity by IP address.
On startup Ignore | Add | Route | Start; Default: Start Defines how the instance should act on router startput.
  • Ignore -
  • -
  • -
My identifier ip | string; Default: none Defines how the user (IPsec instance) will be identified during authentication.
Tunnel: Local IP address/Subnet mask ip/netmask | Default: none Local IP address and subnet mask used to determine which part of the network can be accessed in the VPN network. Netmask range [0..32]. If left empty, IP address will be selected automatically.
Left firewall yes | no; Default: yes Excludes IPsec instance from firewall rules.
Force encapsulation yes | no; Default: no Forces UDP encapsulation for ESP packets even if no NAT situation is detected.
Dead Peer Detection yes | no; Default: no A function used during Internet Key Exchange (IKE) to detect a "dead" peer. It used to reduce traffic by minimizing the number of messages when the opposite peer in unavailable and as failover mechanism.
Dead Peer Detection: Delay (sec) integer; Default: none The frequency of checking whether a peer is still availaible or not.
Dead Peer Detection: Timeout (sec) integer; Default: none Time limit after the IPsec instance will stop checking the availability of a peer and determine it to be "dead" if no response is received.
Remote VPN endpoint host | ip; Default: none IP address or hostname of the remote IPsec instance.
Tunnel: Remote IP address/subnet mask ip/netmask; Default: none Remote network IP address and subnet mask used to determine which part of the network can be accessed in the VPN network. Netmask range [0..32]. This values must differ from the device’s LAN IP.
Right firewall yes | no; Default: yes Excludes remote side IPsec instance from firewall rules.
Transport: Use with DMVPN yes | no; Default: no Adds several necessary options to make DMVPN work.
Enable keepalive yes | no; Default: no When enabled, the instance sends ICMP packets to the specified host at the specified frequency. If no response is received, the router will attempt to restart the connection.
Host host | ip; Default: none Hostname or IP address to which keepalive ICMP packets will be sent to.
Ping period (sec) integer [0..9999999]; Default: none The frequency at which keepalive ICMP packets will be sent to the specified host or IP address.
Allow WebUI access yes | no; Default: no Allows WebUI access for hosts in the VPN network.
Custom options ipsec options; Default: none Provides the possibility to further customize the connection by adding extra IPsec options.

Additional notes:

  • Some configuration fields become available only when certain other parameters are selected. The names of the parameters are followed by a prefix that specifies the authentication type under which they become visible. Different color codes are used for different praefixa:
    • Red for Type: Tunnel
    • Purple for Type: Transport
    • Blue for Dead Peer Detection: Enabled
  • After changing any of the parameters, don't forget to click the Save button located at the bottom-left of the page.

Phase settings


IKE (Internet Key Exchange) is a protocol used to set up security associations (SAs) for the IPsec connection. This process is required before any IPsec tunnel can be established. It is done in two phases:

Phase Mode
Phase 1
  • Establishes a secure channel between peers
  • Authenticates peers
  • Negotiates SA policy
  • Shares secret keys
  • Establishes secure tunnel for phase 2
Main mode (figure 1)
  • 6 packets exchanged
  • Identity protected during exchange
Aggressive mode (figure 2)
  • 3 packets exchanged
  • Identity information exchanged before a secure channel is established
Phase 2
  • Sets up matching IPsec SAs
  • Periodically renegotiates IPsec SAs
Quick mode
  • 3 packets exchanged
  • IPsec SA parameters (ESP/AH, SHA/MD5) established
  • SA lifetime set


Figure 1 Figure 2
[[File:{{{file_ipsec_main_mode}}}]] [[File:{{{file_ipsec_aggressive_mode}}}]]

[[File:{{{file_ipsec_phase}}}]]

Field name Value Description
Encryption algorithm DES | 3DES | AES128 | AES192 | AES256; Default: 3DES Algorithm used for data encryption.
Authentication/Hash algorithm MD5 | SHA1 | SHA256 | SHA384 | SHA512; Default: SHA1 Algorithm used for exchanging authentication and hash information.
DH group/PFS group MODP768 | MODP1024 | MODP1536 | MODP2048 | MODP3072 | MODP4096; Default: MODP1536
Lifetime integer; Default: 8 hours Defines a time period after which the phase will re-initiate its exchange of information.

Pre-shared keys


[[File:{{{file_ipsec_psk}}}]]