Skip to content

Commit 4d371e3

Browse files
committed
Update docs
1 parent cec1dde commit 4d371e3

6 files changed

Lines changed: 70 additions & 44 deletions

File tree

README-zh.md

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Ubuntu & Debian
3939
</summary>
4040

4141
```bash
42-
wget https://git.io/vpnsetup -O vpn.sh && sudo sh vpn.sh
42+
wget https://git.io/vpnsetup -O vpn.sh && sudo sh vpn.sh && sudo bash /opt/src/ikev2.sh --auto
4343
```
4444
</details>
4545

@@ -49,7 +49,7 @@ CentOS & RHEL
4949
</summary>
5050

5151
```bash
52-
wget https://git.io/vpnsetup-centos -O vpn.sh && sudo sh vpn.sh
52+
wget https://git.io/vpnsetup-centos -O vpn.sh && sudo sh vpn.sh && sudo bash /opt/src/ikev2.sh --auto
5353
```
5454
</details>
5555

@@ -59,18 +59,12 @@ Amazon Linux 2
5959
</summary>
6060

6161
```bash
62-
wget https://git.io/vpnsetup-amzn -O vpn.sh && sudo sh vpn.sh
62+
wget https://git.io/vpnsetup-amzn -O vpn.sh && sudo sh vpn.sh && sudo bash /opt/src/ikev2.sh --auto
6363
```
6464
</details>
6565

6666
你的 VPN 登录凭证将会被自动随机生成,并在安装完成后显示在屏幕上。
6767

68-
在安装成功之后,推荐 <a href="docs/ikev2-howto-zh.md" target="_blank">配置 IKEv2</a>:
69-
70-
```bash
71-
wget https://git.io/ikev2setup -O ikev2.sh && sudo bash ikev2.sh --auto
72-
```
73-
7468
如需了解其它安装选项,以及如何配置 VPN 客户端,请继续阅读以下部分。
7569

7670
<a name="quick-start-note"></a>
@@ -153,7 +147,11 @@ wget https://git.io/vpnsetup-amzn -O vpn.sh && sudo sh vpn.sh
153147
```
154148
</details>
155149

156-
在安装成功之后,推荐 <a href="docs/ikev2-howto-zh.md" target="_blank">配置 IKEv2</a>。
150+
在安装成功之后,推荐 <a href="docs/ikev2-howto-zh.md" target="_blank">配置 IKEv2</a>:
151+
152+
```bash
153+
sudo bash /opt/src/ikev2.sh --auto
154+
```
157155

158156
**选项 2:** 编辑脚本并提供你自己的 VPN 登录凭证:
159157

@@ -199,7 +197,11 @@ sudo sh vpn.sh
199197

200198
**注:** 一个安全的 IPsec PSK 应该至少包含 20 个随机字符。
201199

202-
在安装成功之后,推荐 <a href="docs/ikev2-howto-zh.md" target="_blank">配置 IKEv2</a>。
200+
在安装成功之后,推荐 <a href="docs/ikev2-howto-zh.md" target="_blank">配置 IKEv2</a>:
201+
202+
```bash
203+
sudo bash /opt/src/ikev2.sh --auto
204+
```
203205

204206
**选项 3:** 将你自己的 VPN 登录凭证定义为环境变量:
205207

@@ -252,7 +254,11 @@ sh vpn.sh
252254
```
253255
</details>
254256

255-
在安装成功之后,推荐 <a href="docs/ikev2-howto-zh.md" target="_blank">配置 IKEv2</a>。
257+
在安装成功之后,推荐 <a href="docs/ikev2-howto-zh.md" target="_blank">配置 IKEv2</a>:
258+
259+
```bash
260+
sudo bash /opt/src/ikev2.sh --auto
261+
```
256262

257263
**注:** 如果无法通过 `wget` 下载,你也可以打开 <a href="vpnsetup.sh" target="_blank">vpnsetup.sh</a>,<a href="vpnsetup_centos.sh" target="_blank">vpnsetup_centos.sh</a> 或者 <a href="vpnsetup_amzn.sh" target="_blank">vpnsetup_amzn.sh</a>,然后点击右方的 **`Raw`** 按钮。按快捷键 `Ctrl-A` 全选, `Ctrl-C` 复制,然后粘贴到你喜欢的编辑器。
258264

@@ -364,6 +370,13 @@ sudo VPN_DNS_NAME='vpn.example.com' bash ikev2.sh --auto
364370

365371
你可以使用这些 VPN 内网 IP 进行通信。但是请注意,为 VPN 客户端分配的 IP 是动态的,而且客户端设备上的防火墙可能会阻止这些流量。
366372

373+
在默认配置下,允许客户端之间的流量。如果你想要 \*不允许\* 客户端之间的流量,可以在 VPN 服务器上运行以下命令。将它们添加到 `/etc/rc.local` 以便在重启后继续有效。
374+
375+
```
376+
iptables -I FORWARD 2 -i ppp+ -o ppp+ -s 192.168.42.0/24 -d 192.168.42.0/24 -j DROP
377+
iptables -I FORWARD 3 -s 192.168.43.0/24 -d 192.168.43.0/24 -j DROP
378+
```
379+
367380
### 更改 IPTables 规则
368381

369382
如果你想要在安装后更改 IPTables 规则,请编辑 `/etc/iptables.rules` 和/或 `/etc/iptables/rules.v4` (Ubuntu/Debian),或者 `/etc/sysconfig/iptables` (CentOS/RHEL)。然后重启服务器。

README.md

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Ubuntu & Debian
3939
</summary>
4040

4141
```bash
42-
wget https://git.io/vpnsetup -O vpn.sh && sudo sh vpn.sh
42+
wget https://git.io/vpnsetup -O vpn.sh && sudo sh vpn.sh && sudo bash /opt/src/ikev2.sh --auto
4343
```
4444
</details>
4545

@@ -49,7 +49,7 @@ CentOS & RHEL
4949
</summary>
5050

5151
```bash
52-
wget https://git.io/vpnsetup-centos -O vpn.sh && sudo sh vpn.sh
52+
wget https://git.io/vpnsetup-centos -O vpn.sh && sudo sh vpn.sh && sudo bash /opt/src/ikev2.sh --auto
5353
```
5454
</details>
5555

@@ -59,18 +59,12 @@ Amazon Linux 2
5959
</summary>
6060

6161
```bash
62-
wget https://git.io/vpnsetup-amzn -O vpn.sh && sudo sh vpn.sh
62+
wget https://git.io/vpnsetup-amzn -O vpn.sh && sudo sh vpn.sh && sudo bash /opt/src/ikev2.sh --auto
6363
```
6464
</details>
6565

6666
Your VPN login details will be randomly generated, and displayed on the screen when finished.
6767

68-
After successful installation, it is recommended to <a href="docs/ikev2-howto.md" target="_blank">set up IKEv2</a>:
69-
70-
```bash
71-
wget https://git.io/ikev2setup -O ikev2.sh && sudo bash ikev2.sh --auto
72-
```
73-
7468
For other installation options and how to set up VPN clients, read the sections below.
7569

7670
<a name="quick-start-note"></a>
@@ -153,7 +147,11 @@ wget https://git.io/vpnsetup-amzn -O vpn.sh && sudo sh vpn.sh
153147
```
154148
</details>
155149

156-
After successful installation, it is recommended to <a href="docs/ikev2-howto.md" target="_blank">set up IKEv2</a>.
150+
After successful installation, it is recommended to <a href="docs/ikev2-howto.md" target="_blank">set up IKEv2</a>:
151+
152+
```bash
153+
sudo bash /opt/src/ikev2.sh --auto
154+
```
157155

158156
**Option 2:** Edit the script and provide your own VPN credentials:
159157

@@ -199,7 +197,11 @@ sudo sh vpn.sh
199197

200198
**Note:** A secure IPsec PSK should consist of at least 20 random characters.
201199

202-
After successful installation, it is recommended to <a href="docs/ikev2-howto.md" target="_blank">set up IKEv2</a>.
200+
After successful installation, it is recommended to <a href="docs/ikev2-howto.md" target="_blank">set up IKEv2</a>:
201+
202+
```bash
203+
sudo bash /opt/src/ikev2.sh --auto
204+
```
203205

204206
**Option 3:** Define your VPN credentials as environment variables:
205207

@@ -252,7 +254,11 @@ sh vpn.sh
252254
```
253255
</details>
254256

255-
After successful installation, it is recommended to <a href="docs/ikev2-howto.md" target="_blank">set up IKEv2</a>.
257+
After successful installation, it is recommended to <a href="docs/ikev2-howto.md" target="_blank">set up IKEv2</a>:
258+
259+
```bash
260+
sudo bash /opt/src/ikev2.sh --auto
261+
```
256262

257263
**Note:** If unable to download via `wget`, you may also open <a href="vpnsetup.sh" target="_blank">vpnsetup.sh</a>, <a href="vpnsetup_centos.sh" target="_blank">vpnsetup_centos.sh</a> or <a href="vpnsetup_amzn.sh" target="_blank">vpnsetup_amzn.sh</a>, and click the **`Raw`** button on the right. Press `Ctrl-A` to select all, `Ctrl-C` to copy, then paste into your favorite editor.
258264

@@ -364,6 +370,13 @@ When connecting using `IPsec/XAuth ("Cisco IPsec")` or `IKEv2` mode, the VPN ser
364370

365371
You may use these internal VPN IPs for communication. However, note that the IPs assigned to VPN clients are dynamic, and firewalls on client devices may block such traffic.
366372

373+
Client-to-client traffic is allowed by default. If you want to \*disallow\* client-to-client traffic, run the following commands on the VPN server. Add them to `/etc/rc.local` to persist after reboot.
374+
375+
```
376+
iptables -I FORWARD 2 -i ppp+ -o ppp+ -s 192.168.42.0/24 -d 192.168.42.0/24 -j DROP
377+
iptables -I FORWARD 3 -s 192.168.43.0/24 -d 192.168.43.0/24 -j DROP
378+
```
379+
367380
### Modify IPTables rules
368381

369382
If you want to modify the IPTables rules after install, edit `/etc/iptables.rules` and/or `/etc/iptables/rules.v4` (Ubuntu/Debian), or `/etc/sysconfig/iptables` (CentOS/RHEL). Then reboot your server.

docs/clients-xauth-zh.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
*其他语言版本: [English](clients-xauth.md), [简体中文](clients-xauth-zh.md).*
44

5-
**注:** 你也可以 [配置 IKEv2](ikev2-howto-zh.md)(推荐),或者使用 [IPsec/L2TP 模式](clients-zh.md) 连接
5+
**注:** 你也可以使用 [IKEv2](ikev2-howto-zh.md)(推荐)或者 [IPsec/L2TP](clients-zh.md) 模式连接
66

77
在成功 <a href="../README-zh.md" target="_blank">搭建自己的 VPN 服务器</a> 之后,按照下面的步骤来配置你的设备。IPsec/XAuth ("Cisco IPsec") 在 Android, iOS 和 OS X 上均受支持,无需安装额外的软件。Windows 用户可以使用免费的 <a href="https://www.shrew.net/download/vpn" target="_blank">Shrew Soft 客户端</a>。如果无法连接,请首先检查是否输入了正确的 VPN 登录凭证。
88

@@ -18,7 +18,7 @@ IPsec/XAuth 模式也称为 "Cisco IPsec"。该模式通常能够比 IPsec/L2TP
1818

1919
## Windows
2020

21-
**注:** 你也可以 [配置 IKEv2](ikev2-howto-zh.md)(推荐),或者使用 [IPsec/L2TP 模式](clients-zh.md) 连接。无需安装额外的软件。
21+
**注:** 你也可以使用 [IKEv2](ikev2-howto-zh.md)(推荐)或者 [IPsec/L2TP](clients-zh.md) 模式连接。无需安装额外的软件。
2222

2323
1. 下载并安装免费的 <a href="https://www.shrew.net/download/vpn" target="_blank">Shrew Soft VPN 客户端</a>。在安装时请选择 **Standard Edition**
2424
**注:** 该 VPN 客户端 **不支持** Windows 10。

docs/clients-xauth.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
*Read this in other languages: [English](clients-xauth.md), [简体中文](clients-xauth-zh.md).*
44

5-
**Note:** You may also [set up IKEv2](ikev2-howto.md) (recommended), or connect using [IPsec/L2TP mode](clients.md).
5+
**Note:** You may also connect using [IKEv2](ikev2-howto.md) (recommended) or [IPsec/L2TP](clients.md) mode.
66

77
After <a href="https://github.com/hwdsl2/setup-ipsec-vpn" target="_blank">setting up your own VPN server</a>, follow these steps to configure your devices. IPsec/XAuth ("Cisco IPsec") is natively supported by Android, iOS and OS X. There is no additional software to install. Windows users can use the free <a href="https://www.shrew.net/download/vpn" target="_blank">Shrew Soft client</a>. In case you are unable to connect, first check to make sure the VPN credentials were entered correctly.
88

@@ -18,7 +18,7 @@ IPsec/XAuth mode is also called "Cisco IPsec". This mode is generally **faster t
1818

1919
## Windows
2020

21-
**Note:** You may also [set up IKEv2](ikev2-howto.md) (recommended), or connect using [IPsec/L2TP mode](clients.md). No additional software is required.
21+
**Note:** You may also connect using [IKEv2](ikev2-howto.md) (recommended) or [IPsec/L2TP](clients.md) mode. No additional software is required.
2222

2323
1. Download and install the free <a href="https://www.shrew.net/download/vpn" target="_blank">Shrew Soft VPN client</a>. When prompted during install, select **Standard Edition**.
2424
**Note:** This VPN client does NOT support Windows 10.

docs/clients-zh.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
*其他语言版本: [English](clients.md), [简体中文](clients-zh.md).*
44

5-
**注:** 你也可以 [配置 IKEv2](ikev2-howto-zh.md)(推荐),或者使用 [IPsec/XAuth 模式](clients-xauth-zh.md) 连接
5+
**注:** 你也可以使用 [IKEv2](ikev2-howto-zh.md)(推荐)或者 [IPsec/XAuth](clients-xauth-zh.md) 模式连接
66

77
在成功 <a href="../README-zh.md" target="_blank">搭建自己的 VPN 服务器</a> 之后,按照下面的步骤来配置你的设备。IPsec/L2TP 在 Android, iOS, OS X 和 Windows 上均受支持,无需安装额外的软件。设置过程通常只需要几分钟。如果无法连接,请首先检查是否输入了正确的 VPN 登录凭证。
88

@@ -18,7 +18,7 @@
1818

1919
## Windows
2020

21-
**注:** 你也可以 [配置 IKEv2](ikev2-howto-zh.md)(推荐)。
21+
**注:** 你也可以使用 [IKEv2](ikev2-howto-zh.md) 模式连接(推荐)。
2222

2323
### Windows 10 and 8.x
2424

@@ -88,7 +88,7 @@ Add-VpnConnection -Name 'My IPsec VPN' -ServerAddress '你的 VPN 服务器 IP'
8888

8989
## OS X
9090

91-
**注:** 你也可以 [配置 IKEv2](ikev2-howto-zh.md)(推荐),或者使用 [IPsec/XAuth 模式](clients-xauth-zh.md) 连接
91+
**注:** 你也可以使用 [IKEv2](ikev2-howto-zh.md)(推荐)或者 [IPsec/XAuth](clients-xauth-zh.md) 模式连接
9292

9393
1. 打开系统偏好设置并转到网络部分。
9494
1. 在窗口左下角单击 **+** 按钮。
@@ -114,7 +114,7 @@ Add-VpnConnection -Name 'My IPsec VPN' -ServerAddress '你的 VPN 服务器 IP'
114114

115115
## Android
116116

117-
**注:** 你也可以 [配置 IKEv2](ikev2-howto-zh.md)(推荐),或者使用 [IPsec/XAuth 模式](clients-xauth-zh.md) 连接
117+
**注:** 你也可以使用 [IKEv2](ikev2-howto-zh.md)(推荐)或者 [IPsec/XAuth](clients-xauth-zh.md) 模式连接
118118

119119
1. 启动 **设置** 应用程序。
120120
1. 单击 **网络和互联网**。或者,如果你使用 Android 7 或更早版本,在 **无线和网络** 部分单击 **更多...**
@@ -139,7 +139,7 @@ VPN 连接成功后,会在通知栏显示图标。最后你可以到 <a href="
139139

140140
## iOS
141141

142-
**注:** 你也可以 [配置 IKEv2](ikev2-howto-zh.md)(推荐),或者使用 [IPsec/XAuth 模式](clients-xauth-zh.md) 连接
142+
**注:** 你也可以使用 [IKEv2](ikev2-howto-zh.md)(推荐)或者 [IPsec/XAuth](clients-xauth-zh.md) 模式连接
143143

144144
1. 进入设置 -> 通用 -> VPN。
145145
1. 单击 **添加VPN配置...**
@@ -178,7 +178,7 @@ VPN 连接成功后,网络状态图标上会出现 VPN 指示。最后你可
178178

179179
## Linux
180180

181-
**注:** 你也可以 [配置 IKEv2](ikev2-howto-zh.md)(推荐)。
181+
**注:** 你也可以使用 [IKEv2](ikev2-howto-zh.md) 模式连接(推荐)。
182182

183183
### Ubuntu Linux
184184

@@ -346,7 +346,7 @@ OS X (macOS) 用户: 如果可以成功地使用 IPsec/L2TP 模式连接,但
346346

347347
为了节约电池,iOS 设备 (iPhone/iPad) 在屏幕变黑(睡眠模式)之后不久就会自动断开 Wi-Fi 连接。这会导致 IPsec VPN 断开。该行为是被 <a href="https://discussions.apple.com/thread/2333948" target="_blank">故意设计的</a> 并且不能被配置。
348348

349-
如果需要 VPN 在设备唤醒后自动重连,你可以 <a href="ikev2-howto-zh.md" target="_blank">配置 IKEv2</a> 并启用 "VPN On Demand" 功能。或者你也可以另外尝试使用 <a href="https://github.com/Nyr/openvpn-install" target="_blank">OpenVPN</a>,它支持 <a href="https://docs.openvpn.net/connecting/connecting-to-access-server-with-apple-ios/faq-regarding-openvpn-connect-ios/" target="_blank">一些选项</a> 比如 "Reconnect on Wakeup" 和 "Seamless Tunnel"。
349+
如果需要 VPN 在设备唤醒后自动重连,你可以使用 [IKEv2](ikev2-howto-zh.md) 模式连接(推荐)并启用 "VPN On Demand" 功能。或者你也可以另外尝试使用 <a href="https://github.com/Nyr/openvpn-install" target="_blank">OpenVPN</a>,它支持 <a href="https://docs.openvpn.net/connecting/connecting-to-access-server-with-apple-ios/faq-regarding-openvpn-connect-ios/" target="_blank">一些选项</a> 比如 "Reconnect on Wakeup" 和 "Seamless Tunnel"。
350350

351351
Android 设备在进入睡眠模式不久后也会断开 Wi-Fi 连接,如果你没有启用选项 "睡眠期间保持 WLAN 开启" 的话。该选项在 Android 8 (Oreo) 和更新版本中不再可用。另外,你也可以尝试打开 "始终开启 VPN" 选项以保持连接。详情请看 <a href="https://support.google.com/android/answer/9089766?hl=zh-Hans" target="_blank">这里</a>。
352352

@@ -410,7 +410,7 @@ ipsec whack --trafficstatus
410410

411411
## 使用命令行配置 Linux VPN 客户端
412412

413-
在成功 <a href="../README-zh.md" target="_blank">搭建自己的 VPN 服务器</a> 之后,按照下面的步骤来使用命令行配置 Linux VPN 客户端。另外,你也可以 [配置 IKEv2](ikev2-howto-zh.md)(推荐),或者 [使用图形界面](#linux) 配置。以下步骤是基于 [Peter Sanford 的工作](https://gist.github.com/psanford/42c550a1a6ad3cb70b13e4aaa94ddb1c)。这些命令必须在你的 VPN 客户端上使用 `root` 账户运行。
413+
在成功 <a href="../README-zh.md" target="_blank">搭建自己的 VPN 服务器</a> 之后,按照下面的步骤来使用命令行配置 Linux VPN 客户端。另外,你也可以使用 [IKEv2](ikev2-howto-zh.md) 模式连接(推荐),或者 [使用图形界面配置](#linux) 。以下步骤是基于 [Peter Sanford 的工作](https://gist.github.com/psanford/42c550a1a6ad3cb70b13e4aaa94ddb1c)。这些命令必须在你的 VPN 客户端上使用 `root` 账户运行。
414414

415415
要配置 VPN 客户端,首先安装以下软件包:
416416

0 commit comments

Comments
 (0)