IPsec Remote Access VPN Example Using IKEv2 with EAP-MSCHAPv2¶
IKEv2 Server Configuration¶
There are several components to the server configuration for mobile clients:
Creating a certificate structure for the VPN
Configuring the IPsec Mobile Client settings
Creating the phase 1 and phase 2 for the client connection
Adding IPsec firewall rules.
Create user credentials for the VPN
IKEv2 Certificate Structure¶
A certificate created by the ACME package (ACME package) will be natively trusted by many clients and can be used in place of a manually created private CA and server certificate.
Create a Server Certificate¶
Follow these directions exactly, paying close attention to how the server certificate is created at each step. If any one part is incorrect, some or all clients may fail to connect.
Navigate to System > Cert Manager, Certificates tab
Click Add to create a new certificate
Set the options as follows:
Create an internal Certificate
- Descriptive Name
- Certificate Authority
Mobile IPsec CA
- Common Name
The hostname of the firewall as it exists in DNS, e.g.
If clients will connect by IP address, place the IP address here instead.
- Certificate Type
- Alternative Names
The WAN IP address of the firewall , e.g.
Add more Alternative Names as needed for additional hostnames or IP addresses on the firewall that clients may use to connect.
Mobile Client Settings¶
The next step is to choose an IP address range to use for mobile clients. Ensure that IP addresses do not overlap any existing network.
The IP addresses used by mobile clients must differ from those in use at the site hosting the mobile tunnel as well as the LAN from which the client will be connecting.
This example uses
10.3.200.0/24, but it can be any unused subnet.
Navigate to VPN > IPsec, Mobile Clients tab
- Enable IPsec Mobile Client Support
Set the authentication options as follows:
- User Authentication
Local Database as seen in Figure Mobile Clients Authentication.
This setting is not needed for EAP-MSCHAPv2, but it must have something selected.
RADIUS servers defined in the User Manager (User Management and Authentication) can be selected here for authenticating users when using EAP-RADIUS.
Set the Client Configuration options
These settings may be pushed to the client, such as the client IP address and DNS servers. These options are shown in Figure Mobile Clients Pushed Settings. Support for these options varies between clients, but is common and well-supported in most current operating systems.
- Virtual Address Pool
- Virtual IPv6 Address Pool
- Network List
- DNS Default Domain
- Split DNS
- DNS Servers
For additional information these options work, see Client Configuration.
Click Create Phase 1 at the top of the screen if it appears
The phase 1 configuration for mobile clients must be configured as follows:
Mobile IPsecor another suitable description
- Key Exchange Version
- Internet Protocol
IPv4 for this example as it only uses an IPv4 WAN
- Authentication Method
- My identifier
- Choose Fully Qualified Domain Name from the drop-down list and then
enter the hostname of the firewall,
This must match the value in the server certificate.
- Peer Identifier
- My Certificate
Choose the IPsec server certificate created earlier
- Encryption Algorithm
Add multiple combinations of encryption, hash, and DH options to accommodate various clients with different requirements. Click Add Algorithm to add more entries. They should be added with the most secure and preferred options first.
A good starting set of options is:
Algorithm AES256-GCM, Hash SHA256, DH Group 16
Algorithm AES256-GCM, Hash SHA256, DH Group 2
Algorithm AES 256, Hash SHA256, DH Group 14
Algorithm AES 256, Hash SHA1, DH Group 14
- Life Time
Set to Enable to allow clients to roam between IP addresses, otherwise set to Disable.
Click Show Phase 2 Entries to expand the list of mobile phase 2 entries
Click Add P2 to add a new mobile phase 2.
- Local Network
Set to LAN subnet or another local network.
To tunnel all traffic over the VPN, use Network and enter
0.0.0.0with a mask of 0
- Encryption algorithms
Set to combinations of options which will be accepted by all possible clients. A good starting set is:
- Hash algorithms
Similar to the algorithm, select all options required by clients:
SHA256, SHA384, SHA512
14 (2048 bit)
Apple iOS does not support PFS in phase 2 when configuring a VPN manually as demonstrated in Configuring IPsec IKEv2 Remote Access VPN Clients on iOS. Most other clients require PFS to be enabled. The best practice is to use a VPN profile from the Apple Configurator or IPsec Export Package which can support the use of PFS rather than creating a VPN connection manually.
Add another phase 2 entry but this time for IPv6. The settings are identical to the previous entry with the following changes:
- Local Network
LAN subnet as before or use the network value
::with a mask of 0 to tunnel all traffic.
Click Apply changes
The tunnel setup for mobile clients is complete.
Mobile IPsec User Creation¶
The next step is to add users for use by EAP-MSCHAPv2.
Navigate to VPN > IPsec, Pre-Shared Keys tab
Click Add to add a new key
Configure the options as follows:
The username for the client.
This can be expressed in multiple ways, such as an e-mail address like
- Secret Type
- Pre-Shared Key
The password for the client, for example
Repeat as many times as needed for additional VPN users.
A complete user is shown in Figure Mobile IPsec User.
As with the static site-to-site tunnels, mobile tunnels also require firewall rules at Firewall > Rules on the IPsec tab. In this instance the source of the traffic would be the subnet chosen for the mobile clients and the destination will be the LAN network, or any if tunneling all traffic.
For more details, IPsec and firewall rules.
Each mobile client device needs a VPN instance or client configured. In some cases a third-party IPsec client may be required. There are many different IPsec clients available for use, some free, and some commercial applications. With IKEv2, as used in this example, many operating systems have native VPN clients and do not need extra software.
Common clients are covered at Configuring IPsec IKEv2 Remote Access VPN Clients.