在centos 6 和 ubuntu 16.04下搭建ubuntu遇到了一些坑。
基本的安装方法,网上有很多教程
centos 6安装方法:http://www.dabu.info/centos6-4-structures-pptp-vpn.html
ubuntu 16.04安装方案:https://my.oschina.net/zzir/blog/746457
遇到的坑:
1、编辑/etc/ppp/chap-secrets时,用户名和密码没有加引号,导致VPN一直连接不上。
网上的教程基本都是这样写的:
#帐号 服务器 密码 IP地址
user1 pptpd 123456 *
用tail -f /var/log/messages查看连接日志,发现报错
Jul 4 21:29:40 localhost pptpd[14325]: CTRL: Starting call (launching pppd, opening GRE)
Jul 4 21:29:40 localhost pppd[14326]: Plugin /usr/lib64/pptpd/pptpd-logwtmp.so loaded.
Jul 4 21:29:40 localhost pppd[14326]: The remote system is required to authenticate itself
Jul 4 21:29:40 localhost pppd[14326]: but I couldn't find any suitable secret (password) for it to use to do so.
Jul 4 21:29:40 localhost pppd[14326]: (None of the available passwords would let it use an IP address.)
Jul 4 21:29:40 localhost pptpd[14325]: GRE: read(fd=6,buffer=611860,len=8196) from PTY failed: status = -1 error = Input/output error, usually caused by unexpected termination of pppd, check option syntax and pppd logs
实际上要在账号和密码加引号,才能连接成功,
#帐号 服务器 密码 IP地址
"user1" pptpd "123456" *
2、因ip问题导致连接不上VPN,用tail -f /var/log/messages命令查看日志,发现报错
Jul 4 21:32:48 localhost pppd[14467]: MPPE 128-bit stateless compression enabled
Jul 4 21:32:50 localhost pppd[14467]: Could not determine local IP address
Jul 4 21:32:50 localhost pppd[14467]: Connect time 0.1 minutes.
Jul 4 21:32:50 localhost pppd[14467]: Sent 112 bytes, received 174 bytes.
Jul 4 21:32:50 localhost pppd[14467]: Modem hangup
Jul 4 21:32:50 localhost pppd[14467]: MPPE disabled
Jul 4 21:32:50 localhost pppd[14467]: Connection terminated.
Jul 4 21:32:50 localhost pppd[14467]: Connect time 0.1 minutes.
Jul 4 21:32:50 localhost pppd[14467]: Sent 152 bytes, received 600 bytes.
Jul 4 21:32:50 localhost pppd[14467]: Exit.
注意Could not determine local IP address这句话,意思是不能确定本地ip,修改/etc/pptpd.conf文件时,
#centos 6: localip要写成具体的外网ip
#ubuntu 16:localip可以写成0.0.0.0
localip 192.168.0.1
remoteip 192.168.0.100-200,192.168.0.245