⇤ ← Revision 1 as of 2016-07-11 16:27:55
1984
Comment:
|
1998
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
see [http://www.anrip.com/post/1511] | http://www.anrip.com/post/1511 |
Line 5: | Line 5: |
环境:Ubuntu Server 14.04 网卡:eth0 软件:pptpd |
环境:Ubuntu Server 14.04 网卡:eth0 软件:pptpd |
Line 10: | Line 10: |
Line 14: | Line 15: |
1 | |
Line 16: | Line 17: |
Line 18: | Line 20: |
{{{localip 172.25.1.1 remoteip 172.25.1.10-20 }}} |
|
Line 19: | Line 24: |
{{{ | |
Line 21: | Line 27: |
1 2 localip 172.25.1.1 remoteip 172.25.1.10-20 |
}}} |
http://www.anrip.com/post/1511
Ubuntu安装pptpd服务(PPTP VPN Server)
- 环境:Ubuntu Server 14.04 网卡:eth0 软件:pptpd
步骤:
1、 安装pptpd
sudo aptitude install pptpd
sudo aptitude install pptpd
2、 设置虚拟ip,编辑 /etc/pptpd.conf
{{{localip 172.25.1.1 remoteip 172.25.1.10-20 }}}
localip 172.25.1.1 remoteip 172.25.1.10-20
3、 设置dns,编辑 /etc/ppp/pptpd-options
ms-dns 8.8.8.8 ms-dns 8.8.4.4 1 2 ms-dns 8.8.8.8 ms-dns 8.8.4.4 4、 添加用户,编辑 /etc/ppp/chap-secrets
#帐号 服务器 密码 IP地址 user pptpd mm1234 * 1 2 #帐号 服务器 密码 IP地址 user pptpd mm1234 * 5、 重启pptpd
service pptpd restart 1 service pptpd restart 以上我们完成了vpn服务配置,但不能连接到外网,接下来继续做nat转换设置
7、编辑 /etc/sysctl.conf
net.ipv4.ip_forward=1 //这行的注释去掉 1 net.ipv4.ip_forward=1 //这行的注释去掉
#使得配置立即生效 sysctl –p 1 2 #使得配置立即生效 sysctl –p 8、向iptables添加NAT规则
iptables -t nat -A POSTROUTING -s 172.25.1.0/24 -o eth0 -j MASQUERADE iptables-save > /etc/iptables-rules 1 2 iptables -t nat -A POSTROUTING -s 172.25.1.0/24 -o eth0 -j MASQUERADE iptables-save > /etc/iptables-rules 9、新建 /etc/network/if-pre-up.d/iptables,添加内容
#!/bin/sh iptables-restore < /etc/iptables-rules 1 2 #!/bin/sh iptables-restore < /etc/iptables-rules
#给予文件执行权限 chmod 0755 /etc/network/if-pre-up.d/iptables 1 2 #给予文件执行权限 chmod 0755 /etc/network/if-pre-up.d/iptables 解决部分网站打不开的问题
10、根据实际情况设置mss
iptables -I FORWARD -p tcp --syn -i ppp+ -j TCPMSS --set-mss 1456 iptables-save > /etc/iptables-rules 1 2 iptables -I FORWARD -p tcp --syn -i ppp+ -j TCPMSS --set-mss 1456 iptables-save > /etc/iptables-rules