Update IKEv2 docs

- Connecting multiple IKEv2 clients from behind the same NAT
  requires setting the "local ID" field to match the client name.
  Ref: https://github.com/libreswan/libreswan/issues/237
This commit is contained in:
hwdsl2 2020-07-06 22:42:45 -05:00
parent 93e89919ac
commit 71dc5bab01
2 changed files with 58 additions and 56 deletions

View File

@ -195,7 +195,7 @@ wget https://git.io/ikev2setup -O ikev2.sh && sudo bash ikev2.sh
导出 `.p12` 文件:
```bash
pk12util -o vpnclient.p12 -n "vpnclient" -d sql:/etc/ipsec.d
pk12util -d sql:/etc/ipsec.d -n "vpnclient" -o vpnclient.p12
```
```
@ -245,9 +245,9 @@ wget https://git.io/ikev2setup -O ikev2.sh && sudo bash ikev2.sh
* [Windows 7, 8.x 和 10](#windows-7-8x-和-10)
* [OS X (macOS)](#os-x-macos)
* [iOS (iPhone/iPad)](#ios)
* [Android 10 和更新版本](#android-10-和更新版本)
* [Android 4.x to 9.x](#android-4x-to-9x)
* [iOS (iPhone/iPad)](#ios)
### Windows 7, 8.x 和 10
@ -276,7 +276,8 @@ wget https://git.io/ikev2setup -O ikev2.sh && sudo bash ikev2.sh
1. 单击 **创建**
1. 在 **服务器地址** 字段中输入 `你的 VPN 服务器 IP` (或者域名)。
1. 在 **远程 ID** 字段中输入 `你的 VPN 服务器 IP` (或者域名)。
1. 保持 **本地 ID** 字段空白。
1. 在 **本地 ID** 字段中输入 `你的 VPN 客户端名称`
**注:** 该名称必须和你在 IKEv2 配置过程中指定的客户端名称一致。它与你的 `.p12` 文件名的第一部分相同。
1. 单击 **鉴定设置...** 按钮。
1. 从 **鉴定设置** 下拉菜单中选择 **无**
1. 选择 **证书** 单选按钮,然后选择新的客户端证书。
@ -285,6 +286,32 @@ wget https://git.io/ikev2setup -O ikev2.sh && sudo bash ikev2.sh
1. 单击 **应用** 保存VPN连接信息。
1. 单击 **连接**
### iOS
首先,将生成的 `ikev2vpnca.cer``.p12` 文件安全地传送到你的 iOS 设备,并且逐个导入为 iOS 配置描述文件。要传送文件,你可以使用:
1. AirDrop隔空投送或者
1. 上传到设备,在 "文件" 应用程序中单击它们(必须首先移动到 "On My iPhone" 目录下),然后按照提示导入,或者
1. 将文件放在一个你的安全的托管网站上,然后在 Mobile Safari 中下载并导入它们。
在完成之后,检查并确保新的客户端证书和 `IKEv2 VPN CA` 都显示在设置 -> 通用 -> 描述文件中。
1. 进入设置 -> 通用 -> VPN。
1. 单击 **添加VPN配置...**
1. 单击 **类型** 。选择 **IKEv2** 并返回。
1. 在 **描述** 字段中输入任意内容。
1. 在 **服务器** 字段中输入 `你的 VPN 服务器 IP` (或者域名)。
1. 在 **远程 ID** 字段中输入 `你的 VPN 服务器 IP` (或者域名)。
1. 在 **本地 ID** 字段中输入 `你的 VPN 客户端名称`
**注:** 该名称必须和你在 IKEv2 配置过程中指定的客户端名称一致。它与你的 `.p12` 文件名的第一部分相同。
1. 单击 **用户鉴定** 。选择 **无** 并返回。
1. 启用 **使用证书** 选项。
1. 单击 **证书** 。选择新的客户端证书并返回。
1. 单击右上角的 **完成**
1. 启用 **VPN** 连接。
连接成功后,你可以到 <a href="https://www.ipchicken.com" target="_blank">这里</a> 检测你的 IP 地址,应该显示为`你的 VPN 服务器 IP`。
### Android 10 和更新版本
1. 将生成的 `.p12` 文件安全地传送到你的 Android 设备。
@ -314,31 +341,6 @@ wget https://git.io/ikev2setup -O ikev2.sh && sudo bash ikev2.sh
1. **(重要)** 单击 **Show advanced settings**。向下滚动,找到并启用 **Use RSA/PSS signatures** 选项。
1. 保存新的 VPN 连接,然后单击它以开始连接。
### iOS
首先,将生成的 `ikev2vpnca.cer``.p12` 文件安全地传送到你的 iOS 设备,并且逐个导入为 iOS 配置描述文件。要传送文件,你可以使用:
1. AirDrop (隔空投送),或者
1. 将文件上传到设备,在 "文件" 应用程序中单击它们(必须在 "On My iPhone" 目录下),然后按照提示导入,或者
1. 将文件放在一个你的安全的托管网站上,然后在 Mobile Safari 中下载并导入它们。
在完成之后,检查并确保新的客户端证书和 `IKEv2 VPN CA` 都显示在设置 -> 通用 -> 描述文件中。
1. 进入设置 -> 通用 -> VPN。
1. 单击 **添加VPN配置...**
1. 单击 **类型** 。选择 **IKEv2** 并返回。
1. 在 **描述** 字段中输入任意内容。
1. 在 **服务器** 字段中输入 `你的 VPN 服务器 IP` (或者域名)。
1. 在 **远程 ID** 字段中输入 `你的 VPN 服务器 IP` (或者域名)。
1. 保持 **本地 ID** 字段空白。
1. 单击 **用户鉴定** 。选择 **无** 并返回。
1. 启用 **使用证书** 选项。
1. 单击 **证书** 。选择新的客户端证书并返回。
1. 单击右上角的 **完成**
1. 启用 **VPN** 连接。
连接成功后,你可以到 <a href="https://www.ipchicken.com" target="_blank">这里</a> 检测你的 IP 地址,应该显示为`你的 VPN 服务器 IP`。
## 添加一个客户端证书
如果要为更多的客户端生成证书,只需重新运行 [辅助脚本](#使用辅助脚本)。或者你可以看 [这一小节](#手动在-vpn-服务器上配置-ikev2) 的第 4 步。
@ -432,7 +434,6 @@ wget https://git.io/ikev2setup -O ikev2.sh && sudo bash ikev2.sh
## 已知问题
1. Windows 自带的 VPN 客户端可能不支持 IKEv2 fragmentation。在有些网络上这可能会导致连接错误或其它连接问题。你可以尝试换用 <a href="clients-zh.md" target="_blank">IPsec/L2TP</a><a href="clients-xauth-zh.md" target="_blank">IPsec/XAuth</a> 模式。
1. 不支持同时连接在同一个 NAT比如家用路由器后面的多个 IKEv2 客户端 (<a href="https://github.com/libreswan/libreswan/issues/237" target="_blank">#237</a>)。对于这个用例,请换用 <a href="clients-xauth-zh.md" target="_blank">IPsec/XAuth</a> 模式。
1. Ubuntu 18.04 用户在尝试将生成的 `.p12` 文件导入到 Windows 时可能会遇到错误 "输入的密码不正确"。这是由 `NSS` 中的一个问题导致的。更多信息请看 <a href="https://github.com/hwdsl2/setup-ipsec-vpn/issues/414#issuecomment-460495258" target="_blank">这里</a>
1. 如果你使用 strongSwan Android VPN 客户端,则必须将服务器上的 Libreswan <a href="../README-zh.md#升级libreswan" target="_blank">升级</a>到版本 3.26 或以上。

View File

@ -195,7 +195,7 @@ The following example shows how to manually configure IKEv2 with Libreswan. Comm
Export `.p12` file:
```bash
pk12util -o vpnclient.p12 -n "vpnclient" -d sql:/etc/ipsec.d
pk12util -d sql:/etc/ipsec.d -n "vpnclient" -o vpnclient.p12
```
```
@ -245,9 +245,9 @@ Before continuing, you **must** restart the IPsec service. The IKEv2 setup on th
* [Windows 7, 8.x and 10](#windows-7-8x-and-10)
* [OS X (macOS)](#os-x-macos)
* [iOS (iPhone/iPad)](#ios)
* [Android 10 and newer](#android-10-and-newer)
* [Android 4.x to 9.x](#android-4x-to-9x)
* [iOS (iPhone/iPad)](#ios)
### Windows 7, 8.x and 10
@ -276,7 +276,8 @@ First, securely transfer the generated `.p12` file to your Mac, then double-clic
1. Click **Create**.
1. Enter `Your VPN Server IP` (or DNS name) for the **Server Address**.
1. Enter `Your VPN Server IP` (or DNS name) for the **Remote ID**.
1. Leave the **Local ID** field blank.
1. Enter `Your VPN client name` in the **Local ID** field.
**Note:** This must match exactly the client name you specified during IKEv2 setup. Same as the first part of your `.p12` filename.
1. Click the **Authentication Settings...** button.
1. Select **None** from the **Authentication Settings** drop-down menu.
1. Select the **Certificate** radio button, then select the new client certificate.
@ -285,6 +286,30 @@ First, securely transfer the generated `.p12` file to your Mac, then double-clic
1. Click **Apply** to save the VPN connection information.
1. Click **Connect**.
### iOS
First, securely transfer the generated `ikev2vpnca.cer` and `.p12` files to your iOS device, then import them one by one as iOS profiles. To transfer the files, you may use:
1. AirDrop, or
1. Upload to your device, tap them in the "Files" app (must first move to the "On My iPhone" folder), then follow the prompts to import, or
1. Host the files on a secure website of yours, then download and import them in Mobile Safari.
When finished, check to make sure both the new client certificate and `IKEv2 VPN CA` are listed under Settings -> General -> Profiles.
1. Go to Settings -> General -> VPN.
1. Tap **Add VPN Configuration...**.
1. Tap **Type**. Select **IKEv2** and go back.
1. Tap **Description** and enter anything you like.
1. Tap **Server** and enter `Your VPN Server IP` (or DNS name).
1. Tap **Remote ID** and enter `Your VPN Server IP` (or DNS name).
1. Enter `Your VPN client name` in the **Local ID** field.
**Note:** This must match exactly the client name you specified during IKEv2 setup. Same as the first part of your `.p12` filename.
1. Tap **User Authentication**. Select **None** and go back.
1. Make sure the **Use Certificate** switch is ON.
1. Tap **Certificate**. Select the new client certificate and go back.
1. Tap **Done**.
1. Slide the **VPN** switch ON.
### Android 10 and newer
1. Securely transfer the generated `.p12` file to your Android device.
@ -314,29 +339,6 @@ First, securely transfer the generated `.p12` file to your Mac, then double-clic
1. **(Important)** Tap **Show advanced settings**. Scroll down, find and enable the **Use RSA/PSS signatures** option.
1. Save the new VPN connection, then tap to connect.
### iOS
First, securely transfer the generated `ikev2vpnca.cer` and `.p12` files to your iOS device, then import them one by one as iOS profiles. To transfer the files, you may use:
1. AirDrop, or
1. Upload the files to your device, tap them in the "Files" app (must be in the "On My iPhone" folder), then follow the prompts to import, or
1. Host the files on a secure website of yours, then download and import them in Mobile Safari.
When finished, check to make sure both the new client certificate and `IKEv2 VPN CA` are listed under Settings -> General -> Profiles.
1. Go to Settings -> General -> VPN.
1. Tap **Add VPN Configuration...**.
1. Tap **Type**. Select **IKEv2** and go back.
1. Tap **Description** and enter anything you like.
1. Tap **Server** and enter `Your VPN Server IP` (or DNS name).
1. Tap **Remote ID** and enter `Your VPN Server IP` (or DNS name).
1. Leave the **Local ID** field blank.
1. Tap **User Authentication**. Select **None** and go back.
1. Make sure the **Use Certificate** switch is ON.
1. Tap **Certificate**. Select the new client certificate and go back.
1. Tap **Done**.
1. Slide the **VPN** switch ON.
Once successfully connected, you can verify that your traffic is being routed properly by <a href="https://www.google.com/search?q=my+ip" target="_blank">looking up your IP address on Google</a>. It should say "Your public IP address is `Your VPN Server IP`".
## Add a client certificate
@ -432,7 +434,6 @@ In certain circumstances, you may need to revoke a previously generated VPN clie
## Known issues
1. The built-in VPN client in Windows may not support IKEv2 fragmentation. On some networks, this can cause the connection to fail or have other issues. You may instead try the <a href="clients.md" target="_blank">IPsec/L2TP</a> or <a href="clients-xauth.md" target="_blank">IPsec/XAuth</a> mode.
1. Connecting multiple IKEv2 clients simultaneously from behind the same NAT (e.g. home router) is not supported (<a href="https://github.com/libreswan/libreswan/issues/237" target="_blank">#237</a>). For this use case, please instead use <a href="clients-xauth.md" target="_blank">IPsec/XAuth</a> mode.
1. Ubuntu 18.04 users may encounter the error "The password you entered is incorrect" when trying to import the generated `.p12` file into Windows. This is due to a bug in `NSS`. Read more <a href="https://github.com/hwdsl2/setup-ipsec-vpn/issues/414#issuecomment-460495258" target="_blank">here</a>.
1. If using the strongSwan Android VPN client, you must <a href="../README.md#upgrade-libreswan" target="_blank">upgrade Libreswan</a> on your server to version 3.26 or above.