分类: LINUX
2016-11-04 17:31:54
先查看mppe模块是否加载:lsmod| grep -i ppp
如果有
ppp_mppe 39881 2
ppp_generic 62561 8 ppp_synctty,ppp_async,ppp_deflate,ppp_mppe
说明模块加载成功
然后安装pptp,编译./configure –prefix=/usr/local/pptpd;make;make install
先在/usr/local/pptp目录建etc目录 之后从pptpd源码sample/*配置文件复制到/usr/local/pptp/etc里面,
之后可以在参考网上的pptpd配置。
注意,如果链接出现,以下错误:
GRE: read(fd=6,buffer=8058ba0,len=8196) from PTY failed: status = -1 error = Input/output error, usually caused by unexpected termination of pppd, check option syntax and pppd logs
可以先检查客户端的mppe128有没有勾上,还有就是检查pptp服务器是否有打开mppe128加密,这个一般是验证错误。
服务器端没启动128位加密,在log的显示是:
Deflate (15) compression enabled
服务器端启动128位加密,在log的显示是:
MPPE 128-bit stateless compression enabled
启动pptp服务器,如果在log看到以下信息:
Dec 14 07:19:27 localhost pppd[20519]: /usr/lib/pptpd/pptpd-logwtmp.so: cannot open shared object file: No such file or directory
Dec 14 07:19:27 localhost pppd[20519]: Couldn’t load plugin /usr/lib/pptpd/pptpd-logwtmp.so
Dec 14 07:19:27 localhost pptpd[20518]: GRE: read(fd=6,buffer=8058f40,len=8196) from PTY failed: status = -1 error = Input/output error, usually caused by u
nexpected termination of pppd, check option syntax and pppd logs
日志文件显示找不到一个库文件/usr/lib/pptpd/pptpd-logwtmp.so
编译时应该已经生成了这个文件,在/usr/local/pptpd/lib/下面,做个软链接到/usr/lib/pptpd/pptpd-logwtmp.so
ln -s /usr/local/pptpd/lib/pptpd-logwtmp.so /usr/lib/pptpd/pptpd-logwtmp.so
再运行,如果还是不行,日志显示版本不对
Dec 14 07:21:17 localhost pppd[20537]: Plugin /usr/lib/pptpd/pptpd-logwtmp.so is for pppd version 2.4.3, this is 2.4.4
Dec 14 07:21:17 localhost pptpd[20536]: GRE: read(fd=6,buffer=8058f40,len=8196) from PTY failed: status = -1 error = Input/output error, usually caused by unexpected termination of pppd, check option syntax and pppd logs Dec 14 07:21:17 localhost pptpd[20536]: CTRL: PTY read or GRE write failed (pty,gre)=(6,7)
修改下源文件版本信息,重新编译生成pptpd-logwtmp.so并替换现有的,切换到源码包目录,pptpd-logwtmp.so源文件在源码包的plugins目录下,将patchlevel.h中的#define VERSION “2.4.3″ 改成 #define VERSION “2.4.4″
# cd plugins
# sed -e ’s/2\.4\.3/2\.4\.4/’ patchlevel.h
# make
make后,目录下会生成pptpd-logwtmp.so,用这个文件替换/usr/local/pptpd/lib/pptpd-logwtmp.so
再运行/usr/local/pptpd/sbin/pptpd,成功
开启内核包转发功能及配置iptables,以支持vpn客户端通过服务器上网、访问服务器内网等
echo 1 > /proc/sys/net/ipv4/ip_forward
基本上就是这样了