Differences between revisions 1 and 3 (spanning 2 versions)
Revision 1 as of 2016-07-11 16:27:55
Size: 1984
Editor: JunHu
Comment:
Revision 3 as of 2016-07-11 16:32:12
Size: 1448
Editor: JunHu
Comment:
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 12: Line 13:
{{{
sudo aptitude install pptpd
sudo aptitude install pptpd
}}}
Line 13: Line 18:
sudo aptitude install pptpd
1
sudo aptitude install pptpd
Line 18: Line 20:
{{{
Line 21: Line 23:
1
2
localip 172.25.1.1
remoteip 172.25.1.10-20
}}}
Line 27: Line 27:
{{{
Line 30: Line 30:
1
2
ms-dns 8.8.8.8
ms-dns 8.8.4.4
}}}

Line 36: Line 35:
{{{
Line 39: Line 38:
1
2
#帐号 服务器 密码 IP地址
user pptpd mm1234 *
}}}
Line 45: Line 42:
{{{
service pptpd restart
}}}
Line 46: Line 46:
service pptpd restart
1
service pptpd restart
Line 53: Line 50:
{{{
Line 55: Line 52:
1
net.ipv4.ip_forward=1 //这行的注释去掉
}}}
Line 59: Line 55:

{{{
Line 60: Line 58:
1
2
#使得配置立即生效
sysctl –p
}}}
Line 66: Line 62:
{{{
Line 69: Line 65:
1
2
iptables -t nat -A POSTROUTING -s 172.25.1.0/24 -o eth0 -j MASQUERADE
iptables-save > /etc/iptables-rules
}}}
Line 75: Line 69:
{{{
Line 78: Line 72:
1
2
#!/bin/sh
iptables-restore < /etc/iptables-rules
}}}
Line 84: Line 75:

{{{
Line 85: Line 78:
1
2
#给予文件执行权限
chmod 0755 /etc/network/if-pre-up.d/iptables
}}}

Line 93: Line 85:
{{{
Line 96: Line 88:
1
2
iptables -I FORWARD -p tcp --syn -i ppp+ -j TCPMSS --set-mss 1456
iptables-save > /etc/iptables-rules
}}}

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

3、 设置dns,编辑 /etc/ppp/pptpd-options

ms-dns 8.8.8.8
ms-dns 8.8.4.4

4、 添加用户,编辑 /etc/ppp/chap-secrets

#帐号   服务器    密码     IP地址
user   pptpd    mm1234  *

5、 重启pptpd

service pptpd restart

以上我们完成了vpn服务配置,但不能连接到外网,接下来继续做nat转换设置

7、编辑 /etc/sysctl.conf

net.ipv4.ip_forward=1 //这行的注释去掉

#使得配置立即生效

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

9、新建 /etc/network/if-pre-up.d/iptables,添加内容

iptables-restore < /etc/iptables-rules

#给予文件执行权限

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

JunHu: JunHu/Memo/Ubunto1404PptpServer (last edited 2016-07-11 16:32:12 by JunHu)