Skip to content

Commit 3dc711b

Browse files
committed
Update docs
1 parent 8a3f22b commit 3dc711b

File tree

4 files changed

+97
-47
lines changed

4 files changed

+97
-47
lines changed

README-zh.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,19 +145,19 @@ sh vpnsetup.sh
145145

146146
*其他语言版本: [English](README.md#important-notes), [简体中文](README-zh.md#重要提示).*
147147

148-
**Windows 用户** 在首次连接之前需要<a href="docs/clients-zh.md#windows-错误-809" target="_blank">修改注册表</a>,以解决 VPN 服务器和/或客户端与 NAT(比如家用路由器)的兼容问题。
148+
**Windows 用户** 在首次连接之前需要 <a href="docs/clients-zh.md#windows-错误-809" target="_blank">修改注册表</a>,以解决 VPN 服务器或客户端与 NAT(比如家用路由器)的兼容问题。
149149

150150
**Android 用户** 如果遇到连接问题,请尝试 <a href="docs/clients-zh.md#android-mtumss-问题" target="_blank">这些步骤</a>。
151151

152-
同一个 VPN 账户可以在你的多个设备上使用。但是由于 IPsec/L2TP 的局限性,如果需要同时连接在同一个 NAT (比如家用路由器)后面的多个设备到 VPN 服务器,你必须仅使用 <a href="docs/clients-xauth-zh.md" target="_blank">IPsec/XAuth 模式</a>。
152+
同一个 VPN 账户可以在你的多个设备上使用。但是由于 IPsec/L2TP 的局限性,如果需要同时连接在同一个 NAT(比如家用路由器)后面的多个设备到 VPN 服务器,你必须仅使用 <a href="docs/clients-xauth-zh.md" target="_blank">IPsec/XAuth 模式</a>,或者配置 <a href="docs/ikev2-howto-zh.md" target="_blank">IKEv2</a>。
153153

154-
如果需要添加,修改或者删除 VPN 用户账户,请参见 <a href="docs/manage-users-zh.md" target="_blank">管理 VPN 用户</a>。该文档包含辅助脚本,以方便管理 VPN 用户。
154+
如果需要查看或更改 VPN 用户账户,请参见 <a href="docs/manage-users-zh.md" target="_blank">管理 VPN 用户</a>。该文档包含辅助脚本,以方便管理 VPN 用户。
155155

156156
对于有外部防火墙的服务器(比如 <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-security-groups.html" target="_blank">EC2</a>/<a href="https://cloud.google.com/vpc/docs/firewalls" target="_blank">GCE</a>),请为 VPN 打开 UDP 端口 500 和 4500。阿里云用户请参见 <a href="https://github.com/hwdsl2/setup-ipsec-vpn/issues/433" target="_blank">#433</a>。
157157

158158
在 VPN 已连接时,客户端配置为使用 <a href="https://developers.google.com/speed/public-dns/" target="_blank">Google Public DNS</a>。如果偏好其它的域名解析服务,编辑 `/etc/ppp/options.xl2tpd``/etc/ipsec.conf` 并替换 `8.8.8.8``8.8.4.4`,然后重启服务器。高级用户可以在运行 VPN 脚本时定义 `VPN_DNS_SRV1``VPN_DNS_SRV2`(可选)。
159159

160-
使用内核支持有助于提高 IPsec/L2TP 性能。它在[所有受支持的系统](#系统要求)上可用。Ubuntu 系统需要安装 `linux-modules-extra-$(uname -r)`(或者 `linux-image-extra`软件包,然后运行 `service xl2tpd restart`
160+
使用内核支持有助于提高 IPsec/L2TP 性能。它在所有 [受支持的系统](#系统要求) 上可用。Ubuntu 系统需要安装 `linux-modules-extra-$(uname -r)`(或者 `linux-image-extra`软件包并运行 `service xl2tpd restart`
161161

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

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,19 +145,19 @@ Enjoy your very own VPN! :sparkles::tada::rocket::sparkles:
145145

146146
*Read this in other languages: [English](README.md#important-notes), [简体中文](README-zh.md#重要提示).*
147147

148-
**Windows users**: This <a href="docs/clients.md#windows-error-809" target="_blank">one-time registry change</a> is required if the VPN server and/or client is behind NAT (e.g. home router).
148+
**Windows users**: A <a href="docs/clients.md#windows-error-809" target="_blank">one-time registry change</a> is required if the VPN server or client is behind NAT (e.g. home router).
149149

150150
**Android users**: If you encounter connection issues, try <a href="docs/clients.md#android-mtumss-issues" target="_blank">these steps</a>.
151151

152-
The same VPN account can be used by your multiple devices. However, due to an IPsec/L2TP limitation, if you wish to connect multiple devices simultaneously from behind the same NAT (e.g. home router), you must use only <a href="docs/clients-xauth.md" target="_blank">IPsec/XAuth mode</a>.
152+
The same VPN account can be used by your multiple devices. However, due to an IPsec/L2TP limitation, if you wish to connect multiple devices simultaneously from behind the same NAT (e.g. home router), you must use only <a href="docs/clients-xauth.md" target="_blank">IPsec/XAuth mode</a>, or set up <a href="docs/ikev2-howto.md" target="_blank">IKEv2</a>.
153153

154-
If you wish to add, edit or remove VPN user accounts, see <a href="docs/manage-users.md" target="_blank">Manage VPN Users</a>. Helper scripts are included for convenience.
154+
If you wish to view or update VPN user accounts, see <a href="docs/manage-users.md" target="_blank">Manage VPN Users</a>. Helper scripts are included for convenience.
155155

156156
For servers with an external firewall (e.g. <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-security-groups.html" target="_blank">EC2</a>/<a href="https://cloud.google.com/vpc/docs/firewalls" target="_blank">GCE</a>), open UDP ports 500 and 4500 for the VPN. Aliyun users, see <a href="https://github.com/hwdsl2/setup-ipsec-vpn/issues/433" target="_blank">#433</a>.
157157

158158
Clients are set to use <a href="https://developers.google.com/speed/public-dns/" target="_blank">Google Public DNS</a> when the VPN is active. If another DNS provider is preferred, replace `8.8.8.8` and `8.8.4.4` in both `/etc/ppp/options.xl2tpd` and `/etc/ipsec.conf`, then reboot your server. Advanced users can define `VPN_DNS_SRV1` and optionally `VPN_DNS_SRV2` when running the VPN setup script.
159159

160-
Using kernel support could improve IPsec/L2TP performance. It is available on [all supported OS versions](#requirements). Ubuntu users should install the `linux-modules-extra-$(uname -r)` (or `linux-image-extra`) package, then run `service xl2tpd restart`.
160+
Using kernel support could improve IPsec/L2TP performance. It is available on [all supported OS](#requirements). Ubuntu users should install the `linux-modules-extra-$(uname -r)` (or `linux-image-extra`) package and run `service xl2tpd restart`.
161161

162162
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.
163163

docs/manage-users-zh.md

Lines changed: 45 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,47 @@
22

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

5-
在默认情况下,将只创建一个用于 VPN 登录的用户账户。如果你需要添加,更改或者删除用户,请阅读本文档。
5+
在默认情况下,将只创建一个用于 VPN 登录的用户账户。如果你需要查看或管理用户,请阅读本文档。
66

7-
## 使用辅助脚本
7+
- [查看或更改 IPsec PSK](#查看或更改-ipsec-psk)
8+
- [查看 VPN 用户](#查看-vpn-用户)
9+
- [使用辅助脚本管理 VPN 用户](#使用辅助脚本管理-vpn-用户)
10+
- [手动管理 VPN 用户](#手动管理-vpn-用户)
811

9-
你可以使用这些脚本来更方便地管理 VPN 用户:[add_vpn_user.sh](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/extras/add_vpn_user.sh), [del_vpn_user.sh](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/extras/del_vpn_user.sh)[update_vpn_users.sh](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/extras/update_vpn_users.sh)。它们将同时更新 IPsec/L2TP 和 IPsec/XAuth ("Cisco IPsec") 模式的用户。如果你需要更改 IPsec PSK,请阅读下一节。
12+
## 查看或更改 IPsec PSK
13+
14+
IPsec PSK(预共享密钥)保存在文件 `/etc/ipsec.secrets`。所有的 VPN 用户将共享同一个 IPsec PSK。该文件的格式如下:
15+
16+
```bash
17+
%any %any : PSK "你的IPsec预共享密钥"
18+
```
19+
20+
如果要更换一个新的 PSK,可以编辑此文件。**不要**在值中使用这些字符:`\ " '`
21+
22+
完成后必须重启服务:
23+
24+
```bash
25+
service ipsec restart
26+
service xl2tpd restart
27+
```
28+
29+
## 查看 VPN 用户
30+
31+
在默认情况下,VPN 安装脚本将为 `IPsec/L2TP``IPsec/XAuth ("Cisco IPsec")` 模式创建相同的用户。
32+
33+
对于 `IPsec/L2TP`,VPN 用户信息保存在文件 `/etc/ppp/chap-secrets`。该文件的格式如下:
34+
35+
```bash
36+
"用户名1" l2tpd "密码1" *
37+
"用户名2" l2tpd "密码2" *
38+
... ...
39+
```
40+
41+
对于 `IPsec/XAuth ("Cisco IPsec")`,VPN 用户信息保存在文件 `/etc/ipsec.d/passwd`。这个文件中的密码以加盐哈希值的形式保存。更多详情请见 [手动管理 VPN 用户和 PSK](#手动管理-vpn-用户和-psk)
42+
43+
## 使用辅助脚本管理 VPN 用户
44+
45+
你可以使用这些脚本来更方便地管理 VPN 用户:[add_vpn_user.sh](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/extras/add_vpn_user.sh), [del_vpn_user.sh](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/extras/del_vpn_user.sh)[update_vpn_users.sh](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/extras/update_vpn_users.sh)。它们将同时更新 IPsec/L2TP 和 IPsec/XAuth ("Cisco IPsec") 模式的用户。将下面的命令的参数换成你自己的值。
1046

1147
**注:** VPN 用户信息保存在文件 `/etc/ppp/chap-secrets``/etc/ipsec.d/passwd`。脚本在修改这些文件之前会先做备份,使用 `.old-日期-时间` 为后缀。
1248

@@ -22,7 +58,9 @@ wget -O add_vpn_user.sh https://raw.githubusercontent.com/hwdsl2/setup-ipsec-vpn
2258
```bash
2359
# 所有变量值必须用 '单引号' 括起来
2460
# *不要* 在值中使用这些字符: \ " '
25-
sudo sh add_vpn_user.sh 'username_to_add' 'password_to_add'
61+
sudo sh add_vpn_user.sh '要添加的用户名' '密码'
62+
# 或者
63+
sudo sh add_vpn_user.sh '要更新的用户名' '新密码'
2664
```
2765

2866
### 删除一个 VPN 用户
@@ -37,7 +75,7 @@ wget -O del_vpn_user.sh https://raw.githubusercontent.com/hwdsl2/setup-ipsec-vpn
3775
```bash
3876
# 所有变量值必须用 '单引号' 括起来
3977
# *不要* 在值中使用这些字符: \ " '
40-
sudo sh del_vpn_user.sh 'username_to_delete'
78+
sudo sh del_vpn_user.sh '要删除的用户名'
4179
```
4280

4381
### 更新所有的 VPN 用户
@@ -73,13 +111,7 @@ VPN_PASSWORDS='密码1 密码2 ...' \
73111
sh update_vpn_users.sh
74112
```
75113

76-
## 手动管理 VPN 用户和 PSK
77-
78-
首先,IPsec PSK (预共享密钥)保存在文件 `/etc/ipsec.secrets`。如果要更换一个新的 PSK,可以编辑此文件。完成后必须重启服务(见下面)。所有的 VPN 用户将共享同一个 IPsec PSK。
79-
80-
```bash
81-
%any %any : PSK "你的IPsec预共享密钥"
82-
```
114+
## 手动管理 VPN 用户
83115

84116
对于 `IPsec/L2TP`,VPN 用户信息保存在文件 `/etc/ppp/chap-secrets`。该文件的格式如下:
85117

@@ -89,7 +121,7 @@ sh update_vpn_users.sh
89121
... ...
90122
```
91123

92-
你可以添加更多用户,每个用户对应文件中的一行。**不要**在用户名,密码或 PSK 中使用这些字符`\ " '`
124+
你可以添加更多用户,每个用户对应文件中的一行。**不要**在值中使用这些字符`\ " '`
93125

94126
对于 `IPsec/XAuth ("Cisco IPsec")`,VPN 用户信息保存在文件 `/etc/ipsec.d/passwd`。该文件的格式如下:
95127

@@ -106,10 +138,3 @@ sh update_vpn_users.sh
106138
# 将你的密码用 '单引号' 括起来
107139
openssl passwd -1 '密码1'
108140
```
109-
110-
最后,如果你更改了 PSK,则必须重启服务。对于添加,更改或者删除 VPN 用户,一般不需重启。
111-
112-
```bash
113-
service ipsec restart
114-
service xl2tpd restart
115-
```

docs/manage-users.md

Lines changed: 44 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,53 @@
22

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

5-
By default, a single user account for VPN login is created. If you wish to add, edit or remove users, read this document.
5+
By default, a single user account for VPN login is created. If you wish to view or manage users, read this document.
66

7-
## Using helper scripts
7+
- [View or update the IPsec PSK](#view-or-update-the-ipsec-psk)
8+
- [View VPN users](#view-vpn-users)
9+
- [Manage VPN users using helper scripts](#manage-vpn-users-using-helper-scripts)
10+
- [Manually manage VPN users](#manually-manage-vpn-users)
811

9-
You may use these scripts to more easily manage VPN users: [add_vpn_user.sh](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/extras/add_vpn_user.sh), [del_vpn_user.sh](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/extras/del_vpn_user.sh) and [update_vpn_users.sh](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/extras/update_vpn_users.sh). They will update users for both IPsec/L2TP and IPsec/XAuth ("Cisco IPsec"). For changing the IPsec PSK, read the next section.
12+
## View or update the IPsec PSK
13+
14+
The IPsec PSK (pre-shared key) is stored in `/etc/ipsec.secrets`. All VPN users will share the same IPsec PSK. The format of this file is:
15+
16+
```bash
17+
%any %any : PSK "your_ipsec_pre_shared_key"
18+
```
19+
20+
To change to a new PSK, just edit this file. DO NOT use these special characters within values: `\ " '`
21+
22+
You must restart services when finished:
23+
24+
```bash
25+
service ipsec restart
26+
service xl2tpd restart
27+
```
28+
29+
## View VPN users
30+
31+
By default, the VPN setup scripts will create the same VPN user for both `IPsec/L2TP` and `IPsec/XAuth ("Cisco IPsec")` modes.
32+
33+
For `IPsec/L2TP`, VPN users are specified in `/etc/ppp/chap-secrets`. The format of this file is:
34+
35+
```bash
36+
"username1" l2tpd "password1" *
37+
"username2" l2tpd "password2" *
38+
... ...
39+
```
40+
41+
For `IPsec/XAuth ("Cisco IPsec")`, VPN users are specified in `/etc/ipsec.d/passwd`. Passwords in this file are salted and hashed. See [Manually manage VPN users and PSK](#manually-manage-vpn-users-and-psk) for more details.
42+
43+
## Manage VPN users using helper scripts
44+
45+
You may use these scripts to more easily manage VPN users: [add_vpn_user.sh](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/extras/add_vpn_user.sh), [del_vpn_user.sh](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/extras/del_vpn_user.sh) and [update_vpn_users.sh](https://github.com/hwdsl2/setup-ipsec-vpn/blob/master/extras/update_vpn_users.sh). They will update users for both IPsec/L2TP and IPsec/XAuth ("Cisco IPsec"). Replace command parameters below with your own values.
1046

1147
**Note:** VPN users are stored in `/etc/ppp/chap-secrets` and `/etc/ipsec.d/passwd`. The scripts will backup these files before making changes, with `.old-date-time` suffix.
1248

1349
### Add or edit a VPN user
1450

15-
Add a new VPN user or update an existing VPN user with a new password.
51+
Add a new VPN user, or update an existing VPN user with a new password.
1652

1753
```bash
1854
# Download the script
@@ -22,7 +58,9 @@ wget -O add_vpn_user.sh https://raw.githubusercontent.com/hwdsl2/setup-ipsec-vpn
2258
```bash
2359
# All values MUST be placed inside 'single quotes'
2460
# DO NOT use these special characters within values: \ " '
25-
sudo sh add_vpn_user.sh 'username_to_add' 'password_to_add'
61+
sudo sh add_vpn_user.sh 'username_to_add' 'password'
62+
# OR
63+
sudo sh add_vpn_user.sh 'username_to_update' 'new_password'
2664
```
2765

2866
### Delete a VPN user
@@ -73,13 +111,7 @@ VPN_PASSWORDS='password1 password2 ...' \
73111
sh update_vpn_users.sh
74112
```
75113

76-
## Manually manage VPN users and PSK
77-
78-
First, the IPsec PSK (pre-shared key) is stored in `/etc/ipsec.secrets`. To change to a new PSK, just edit this file. You must restart services when finished (see below). All VPN users will share the same IPsec PSK.
79-
80-
```bash
81-
%any %any : PSK "your_ipsec_pre_shared_key"
82-
```
114+
## Manually manage VPN users
83115

84116
For `IPsec/L2TP`, VPN users are specified in `/etc/ppp/chap-secrets`. The format of this file is:
85117

@@ -106,10 +138,3 @@ Passwords in this file are salted and hashed. This step can be done using e.g. t
106138
# Put your password inside 'single quotes'
107139
openssl passwd -1 'password1'
108140
```
109-
110-
Finally, you must restart services if changing the PSK. For add/edit/remove VPN users, this is normally not required.
111-
112-
```bash
113-
service ipsec restart
114-
service xl2tpd restart
115-
```

0 commit comments

Comments
 (0)