Skip to content

Commit cda2886

Browse files
committed
2016-08-18完善VPN
1 parent 0877318 commit cda2886

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

VPN.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,7 @@ push "dhcp-option DOMAIN-SEARCH ec2.drawbrid.ge"
210210
### 配置内核和防火墙,开启nat功能,启动服务
211211

212212
- 开启路由转发功能
213-
- 修改配置信息该值改为 1:
214-
- `net.ipv4.ip_forward=1` # 默认是注释掉的,要取消注释,也有出现是没有注释,但是默认是0:`net.ipv4.ip_forward=0`
215-
- 其他方式更改值:`sed -i '/net.ipv4.ip_forward/s/0/1/' /etc/sysctl.conf`
213+
- `sed -i '/net.ipv4.ip_forward/s/0/1/' /etc/sysctl.conf`
216214
- 刷新配置:`sudo sysctl -p`
217215

218216
辨别你的 VPS 是属于那种虚拟方式,主流有:Xen KVM OpenVZ,方法:
@@ -226,12 +224,11 @@ push "dhcp-option DOMAIN-SEARCH ec2.drawbrid.ge"
226224
- 设置IP转发,若你的 VPS 虚拟方案是:Xen 或 KVM的请输入:(eth0要根据具体的网卡标示来,可以通过ifconfig查看),其中:10.192.170.0/16 表示客户端连接上去后从这个区间中分配给客户端的IP地址
227225
- `iptables -t nat -A POSTROUTING -s 10.192.170.0/16 -o eth0 -j MASQUERADE`
228226

229-
- 若你的 VPS 虚拟方案是:OpenVZ 的请输入:(45.32.90.12是你VPS的IP
230-
- `iptables -t nat -A POSTROUTING -s 10.192.170.0/16 -j SNAT --to-source 45.32.90.12`
227+
- 若你的 VPS 虚拟方案是:OpenVZ 的请输入:(45.32.90.22是你VPS的IP
228+
- `iptables -t nat -A POSTROUTING -s 10.192.170.0/16 -j SNAT --to-source 45.32.90.22`
231229
- 保存防火墙配置
232230
- `service iptables save`
233231
- `service iptables restart`
234-
- `chkconfig iptables on`
235232

236233

237234
### 启动openvpn并设置为开机启动
@@ -262,7 +259,7 @@ http://code.google.com/p/tunnelblick/
262259
client #这个client不是自定义名称 不能更改
263260
dev tun #要与前面server.conf中的配置一致。
264261
proto udp #要与前面server.conf中的配置一致。
265-
remote 45.32.90.12 1194 #将45.32.90.12替换为你VPS的IP,端口也与前面的server.conf中配置一致。
262+
remote 45.32.90.22 1194 #将45.32.90.22替换为你VPS的IP,端口也与前面的server.conf中配置一致。
266263
resolv-retry infinite
267264
nobind
268265
persist-key

0 commit comments

Comments
 (0)