1.检查是否支持pptp
modprobe ppp-compress-18 && echo ok
2 安装ppp,pptpd
yum install -y epel-release ppp pptpd
3.修改 /etc/pptpd.conf 文件
localip 192.168.1.204
remoteip 192.168.1.60-70
4.修改 /etc/ppp/options.pptpd 文件
ms-dns 114.114.114.114
ms-dns 8.8.8.8
5.修改 /etc/ppp/chap-secrets 文件
test pptpd 123456 *
6.修改 /etc/sysctl.conf 文件
net,ipv4.ip_forward = 1
sysctl -p
7.添加防火墙规则
iptables -I FORWARD -p tcp --syn -i ppp+ -j TCPMSS --set-mss 1356 ##PS:至于为什么要修改MSS,请参考 http://www.361way.com/pptp-mtu-mss/5173.html
8.重启 pptpd 服务
systemctl restart pptpd
-----------------------------------------------------------------------------------------------------------------
错误619
在centos服务器上查看日志,统一错误如下:
Aug 31 11:07:36 pptpd[9162]: CTRL: PTY read or GRE write failed (pty,gre)=(6,7)
Aug 31 11:07:36 pptpd[9162]: CTRL: Client 14.16.135.232 control connection finished
Aug 31 11:07:47 pptpd[9214]: CTRL: Client 14.16.135.232 control connection started
Aug 31 11:07:47 pptpd[9214]: CTRL: Starting call (launching pppd, opening GRE)
Aug 31 11:07:47 pppd[9215]: Plugin /usr/lib64/pptpd/pptpd-logwtmp.so loaded.
Aug 31 11:07:47 pppd[9215]: pppd 2.4.5 started by root, uid 0
Aug 31 11:07:47 pppd[9215]: Using interface ppp0
Aug 31 11:07:47 pppd[9215]: Connect: ppp0 <--> /dev/pts/1
Aug 31 11:07:47 NetworkManager[640]: <info> (ppp0): new Generic device (carrier: UNKNOWN, driver: 'unknown', ifindex: 20) 问题1
Aug 31 11:08:17 pppd[9215]: LCP: timeout sending Config-Requests 问题2
Aug 31 11:08:17 pppd[9215]: Connection terminated.
Aug 31 11:08:17 pppd[9215]: Modem hangup
Aug 31 11:08:17 pppd[9215]: Exit.
Aug 31 11:08:17 pptpd[9214]: GRE: read(fd=6,buffer=7f234b1cb480,len=8196) from PTY failed: status = -1 error = Input/output error, usually caused by unexpected termination of pppd, check option syntax and pppd logs
Aug 31 11:08:17 pptpd[9214]: CTRL: PTY read or GRE write failed (pty,gre)=(6,7)
Aug 31 11:08:17 pptpd[9214]: CTRL: Client 14.16.135.232 control connection finished
1)对于问题1, 关掉 networkmanager 即可。
sudo systemctl NetworkManager stop
2)对于问题2,是GRE协议无法穿透的原因.防火墙,路由器端口映射增加GRE协议
或
--------------------------------------------------------------------------------------------------------
优化pptd速度