在debian版linux下用pptp 实现VPN
2004-07-09    刘世伟   
打印自: 安恒公司
地址: HTTP://bmp21.anheng.com.cn/news/article.php?articleid=413
用pptp 实现VPN

本文要求读者能够熟练的编译内核
使用的发行版是Debian,内核2.6.8,pppd 2.4.2 pptp 1.5.0

服务器端设置:
先要给vpn服务器的内核添加mppe补丁,
从debian获取补丁:
apt-get install kernel-patch-mppe
然后在当前内核对应的源代码目录,执行修补程序,
#cd /usr/src/kernel-source-2.6.8
#/usr/src/kernel-patches/all/apply/mppe

在内核的ppp下,会多一个mppe功能,把它编译成模块的形式,并安装,模块形式可以直接挂载,不用启动机器,修改/etc/modules,添加一行
ppp_mppe
安装:pptp服务程序,和设置程序:
apt-get install pptpd webmin-pptp-server
下面就可以直接进webmin对pptpd进行设置了。一切按默认设置,要把
[Enable MPPE encryption?] 选项设置为[Must be used]
这样,就不用修改win客户端的安全默认设置了。
再进行分配ip池,
然后建立账号,根据需要给账号绑定ip
webmin的设置并不能正常工作,最后要在设置文件\etc\pptp.conf中手动添加几个设置,见后页所示


win客户端设置:
在[网络和拨号连接]进行[新建连接]选[vpn],按默认设置下去就行了。

linux客户端设置:
先安装客户端软件
apt-get install pptp-linux
安装webmin管理
apt-get install webmin-pptp-client
然后用webmin设置就行了。
客户端自动拨号:
将下面一句放在适当的位置
pptp vpn.anheng.com.cn call anheng &
将vpn的接入机器跟局域网的机器在同一网段:
在/etc/pptp.conf中,把localip去掉,remoteip分配一段本网ip,然后/etc/pptp-options里面打开arproxy,把arp传到局域网,就可以了
参考的设置文件见下一页

服务器端相关配置文件

#debian_3.1 kernel_2.6.8 pptpd_1.2.1 pppd_2.4.2 pptp_linux_1.5.0
#=================================================
#files:/etc/pptpd.conf
speed   1000000
option  /etc/ppp/pptpd-options
localip 10.0.0.254
remoteip        10.0.0.2-238
#end

#==================================================
#files:/etc/ppp/pptpd-options
logfile /var/log/pptpd.log
name pptpd
refuse-eap
proxyarp
nodefaultroute
lock
nobsdcomp
auth
require-mppe
require-mschap
#end

#=================================================
#file:/etc/ppp/chap-secrets
test  pptpd  test  10.0.0.2
#end

#=================================================
#file:/etc/modules
...
...
...
ppp_mppe
#end

#=================================================
#file://etc/modules.conf
...
...
...
...
#end

linux客户端相应配置文件

#file:/etc/ppp/peers/anheng
name USERID
file /etc/ppp/options.pptp
remotename pptpd
require-mppe
require-mppe-40
require-mppe-128

QA

问:用webmin-pptp-client拨号时失败提示如下:
/usr/sbin/pppd: The remote system (pptpd) is required to authenticate itself
/usr/sbin/pppd: but I couldn't find any suitable secret (password) for it to use to do so.
答:
修改/etc/ppp/peers/linkname 添加一行
noauth
试服务器端的身份不需要认证。

责任编辑: admin