你的位置:首页 > 软件开发 > 操作系统 > 在 Vultr VPS 中 以 Debian 8 i386 (jessie) 为 操作系统 平台 手动 搭建 PPTP VPN 全过程

在 Vultr VPS 中 以 Debian 8 i386 (jessie) 为 操作系统 平台 手动 搭建 PPTP VPN 全过程

发布时间:2015-05-19 20:00:19
更新服务器并安装 PPTP 服务 apt-get update apt-get upgrade apt-get install pptpd编辑  /etc/pptpd.conf找到 #localip 以及 #remoteip 行,删除#并设置 ...

更新服务器并安装 PPTP 服务 

apt-get update 

apt-get upgrade 

apt-get install pptpd


编辑  /etc/pptpd.conf

找到 #localip 以及 #remoteip 行,删除#并设置 ip 地址

localip 172.16.31.254

remoteip 172.16.31.234-238 


编辑  /etc/sysctl.conf

去掉 #net.ipv4.ip_forward=1 的#号,开启ipv4 forward

修改完成后执行  sysctl -p


编辑  /etc/ppp/pptpd-options

修改dns服务器地址

ms-dns 8.8.8.8

ms-dns 8.8.4.4


编辑  /etc/ppp/chap-secrets

添加 PPTP 账号

[注

  格式为:

    username1 pptpd password *

    username2 pptpd password 172.16.31.234

  第一列是用户名,第二列是服务器名(默认 pptpd ,注意和 /etc/ppp/pptpd-options 文件中 name 行的值保持一致)

  第三列是密码,第四列是 IP 限制(不限制用 * 表示)

  第一行格式为不固定客户端ip地址,第二行格式为固定客户端ip地址

]


使用 iptables 来建立 NAT

安装iptables  apt-get install iptables

向 nat 表中加入一条规则

iptables -t nat -A POSTROUTING -s 172.16.31.0/24 -o eth0 -j MASQUERADE

[注

  eth0是网卡名字,可以通过命令 ifconfig 查看得到

]

设置 MTU

iptables -I FORWARD -p tcp --syn -i ppp+ -j TCPMSS --set-mss 1356

 [注

  Vultr 建议

  Note: We recommend configuring a MTU of 1450 on your private network. Using a larger MTU will result in poor performance.

]


iptables 的规则会在下次重启时被清除,为防止重启机器后iptables丢失,运行

iptables-save > /etc/iptables-rules

编辑 /etc/network/interfaces 文件

找到 eth0 那一节,在对 eth0 的设置最末尾加上下面这句:

pre-up iptables-restore < /etc/iptables-rules

这样当网卡 eth0 被加载的时候就会自动载入我们预先用 iptables-save 保存下的配置


重启 PPTP 服务

/etc/init.d/pptpd restart


编辑  /etc/rc.local

添加开机启动

/etc/init.d/pptpd restart


特此感谢大牛们提供的思路与代码!

参考博文,不分先后:

Debian搭建vpn - 时光旅行的懒猫 - 博客园

Debian搭建VPN - 麦田守望者

Debian PPTP VPN 配置教程 - reizhi

 

 


原标题:在 Vultr VPS 中 以 Debian 8 i386 (jessie) 为 操作系统 平台 手动 搭建 PPTP VPN 全过程

关键词:ie

ie
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。