Differences between revisions 2 and 3
Revision 2 as of 2016-07-11 16:29:09
Size: 1998
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 13: Line 13:
{{{
Line 15: Line 15:
Line 17: Line 16:
}}}
Line 19: Line 19:

{{{localip 172.25.1.1
remoteip 172.25.1.10-20
}}}
Line 31: Line 27:
{{{
Line 34: Line 30:
1
2
ms-dns 8.8.8.8
ms-dns 8.8.4.4
}}}

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

{{{
Line 64: Line 58:
1
2
#使得配置立即生效
sysctl –p
}}}
Line 70: Line 62:
{{{
Line 73: 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 79: Line 69:
{{{
Line 82: Line 72:
1
2
#!/bin/sh
iptables-restore < /etc/iptables-rules
}}}
Line 88: Line 75:

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

Line 97: Line 85:
{{{
Line 100: 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)