怎么样在Linux下配置PPTP+MPPC+MPPC服务?
Author : Kendiv
Date : 2006.12.16***********************************
所使用的软件 *********************************** 1. linux-2.6.12.6.tar.bz2 2. linux-2.6.12-mppe-mppc-1.3.patch.gz 3. ppp-2.4.3.tar.gz 4. ppp-2.4.3-mppe-mppc-1.1.patch.gz 5. pptpd-1.3.3.tar.gz***********************************
一、下载最新的Kernel源代码 *********************************** 下载地址:http://www.kernel.org/pub/linux/kernel/http://pptpclient.sourceforge.net/
News: MPPE in Linux 2.6.15 Linux kernel 2.6.15 has been released and includes the PPP MPPE encryption module, which implements the Microsoft Point-to-Point Encryption method as a PPP compressor/decompressor. This is necessary for Linux clients and servers to interoperate with Microsoft Point-to-Point Tunneling Protocol (PPTP) servers (either Microsoft PPTP servers or the poptop project) which use MPPE to encrypt data when creating a VPN.Now that Linux includes the module, the PPTP projects recommend upgrading to 2.6.15.
-- James Cameron
看来如果使用 Linux 2.6.15的话,就不需要打MPPC/MPPE补丁
/* PPTPD */ http://sourceforge.net/project/showfiles.php?group_id=44827&release_id=138437
/* MPPC/MPPE */
http://mppe-mppc.alphacron.de/***********************************
二、打MPPC/MPPE补丁 *********************************** #cp linux-2.6.12.6.tar.bz2 /usr/src/kernels #cd /usr/src/kernels #tar xvjf linux-2.6.12.6.tar.bz2 #Patch Kernel files #cd /usr/src/kernels #ln -s /usr/src/kernels/linux-2.6.12.6/ linux-2.6.12 #patch -p0 -i linux-2.6.12-mppe-mppc-1.3.patch.gz/**********************************************************/
patching file linux-2.6.12/drivers/net/Makefile patching file linux-2.6.12/drivers/net/ppp_generic.c create the file linux-2.6.12/drivers/net/ppp_mppe_mppc.c patching file linux-2.6.12/include/linux/ppp-comp.h /**********************************************************/***********************************
三、定制内核 *********************************** #cd /usr/src/kernels/linux-2.6.12/ #make clean #make menuconfig +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= ext2和ext3文件系统配置为: (全部选择) File systems ---> <*>Second extended fs support Ext2 extended attributes Ext2 POSIX Access Control Lists Ext2 Security Labels <*>Ext3 journalling file system support Ext3 extended attributes Ext3 POSIX Access Control Lists Ext3 Security Labels JBB (ext3) debugging support +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= 选择进入Device Drivers ->; Networking support ->; <>; PPP BSD-Compress compression <>; Microsoft PPP compression/encryption (MPPC/MPPE) 找到上面两项,分别按下空格键,最前面的<>;就会变成<M>;,如下 <M>; PPP BSD-Compress compression <M>; Microsoft PPP compression/encryption (MPPC/MPPE) +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= 在 Cryptographic options 内把SHA1 、ARC4等以模块的方式加载。 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=***********************************
四、编译内核及模块 *********************************** #make -jn (n代表同时编译的进程,可以加快编译速度,n由你的配置决定,我的配置用15-25)注意: 此命令已完成make bzImage及make modules的工作, 生成的bzImage内核文件在arch/i386/boot目录中,你的CPU不同内核文件存放位置也不同
注: 这一步比较耗时,根据机器配置,可能会消耗30分钟或更长时间。
***********************************
五、编译可加载模块和安装新内核 *********************************** 如果用户在配置内核时设置了可加载模块,则需要对这些模块进行编译,以便将来使用insmod命令进行加载。 # make modules_install (安装内核模块到/lib/modules/2.x.x下) # make install (完成mkinitrd命令及内核(bzImage)和System.map的拷贝)完成后,请查看/boot目录,文件名是有区别的,如是GRUB引导,make install命令已帮你自动修改了引导选项,对于LILO则要手工修改,重写引导记录。
***********************************
检验内核和PPP是否支持MPPE/MPPE *********************************** #strings 'which pppd' | grep -i mppe | wc --lines 如果以上命令输出为“0”则表示不支持;输出为"30"或更大的数字就表示支持。#strings 'which pppd' | grep -i mppc | wc --lines
如果以上命令输出为“0”则表示不支持;输出为"7"或更大的数字就表示支持。#dmesg | grep MPPE
MPPE/MPPC encryption/compression module registeredIf you have compiled MPPE/MPPC as module, add to your /etc/modules.conf following line:
alias ppp-compress-18 ppp_mppe_mppc
编辑/etc/modules.conf配置文件,加入如下内容:
alias char-major-108 ppp_generic alias tty-ldisc-3 ppp_async alias tty-ldisc-14 ppp_synctty alias ppp-compress-18 ppp_mppe_mppc # 我只增加了这一行 alias ppp-compress-21 bsd_comp #alias ppp-compress-24 ppp_deflate #alias ppp-compress-26 ppp_deflate alias net-pf-47 ip_gre每次系统启动时都需要加载模块才行,因此我们要在/etc/rc.d/rc.local里面写入一行:
/sbin/modprobe ppp_mppe_mppc*********************************** 安装PPP *********************************** #rpm -e --nodeps ppp #卸载默认的ppp-2.4.2 #tar zxvf ppp-2.4.3.tar.gz #patch –p0 –i ppp-2.4.3-mppe-mppc-1.1.patch.gz #cd ppp-2.4.3 #./configure #make #make install
默认会将pppd安装到 /usr/local/lib/pppd 和 /usr/local/sbin/pppd
系统中原有的pppd安装在 /usr/lib/pppd目录下,如果前面已经 rpm -e --nodeps ppp.
就不用删除/usr/lib/pppd目录了。
***********************************
安装PPTP *********************************** #tar zxvf pptpd-1.3.3.tar.gz #cd pptpd-1.3.3 #./configure #make #make install***********************************
修改配置文件 *********************************** /etc/pptpd.conf # Poptop配置文件 /etc/ppp/options.pptpd # Poptop选项文件(正确的options.pptpd是非常必要) /etc/ppp/chap-secrets # 账号、密码存放文件****************
/* pptpd.conf */ **************** #/etc/pptpd.conf ppp /usr/local/sbin/pppd # Specifiy your pppd option /etc/ppp/options.pptpd debug Logwtmp localip 192.168.1.100 # VPN Server IP remoteip 192.168.1.5,192.168.1.6 # Clients Ip Pool******************* /* options.pptpd */ ******************* #/etc/ppp/options.pptpd name Mimi.VPN # VPN Server Name lock mtu 1450 mru 1450 proxyarp auth ipcp-accept-local ipcp-accept-remote lcp-echo-failure 3 lcp-echo-interval 5 deflate 0
# Handshake Auth Method
+chap +mschap-v2 # mppe require client use mschap-v2# Data Encryption Methods
mppe requiredlogfile /var/log/pptpd.log # path of logfiles
ms-wins 192.168.1.2 # wins ip
ms-dns 192.168.1.2 # dns ip*******************
/* chap-secrets */ ******************* #/etc/ppp/chap-secrets# client server secret IP addresses
"Kendiv" Mimi.VPN "12345" *上面第二行代码的四项内容分别对应第一行中的四项。"abc1"是Client端的VPN用户名;
"server"对应的是VPN服务器的名字,该名字必须和/etc/ppp/options.pptpd文件中指明的一样, 或者设置成"*"号来表示自动识别服务器;"secret"对应的是登录密码; "IP addresses"对应的是可以拨入的客户端IP地址,如果不需要做特别限制,可以将其设置为"*"号。***********************************
设置IP伪装转发 *********************************** 只有设置了IP伪装转发,通过VPN连接上来的远程计算机才能互相ping通,实现像局域网那样的共享。用下面的命令进行设置: #echo 1 > /proc/sys/net/ipv4/ip_forward 可以将这条命令放到文件/etc/rc.d/rc.local里面,以实现每次开机时自动运行该命令。*********************************** 启动pptpd *********************************** # /usr/local/sbin/pptpd
***********************************
查看加载的Modules *********************************** # depmod -a # updatedb # locate ppp|grep bi我安装完成后,发现/var/log/messages里有如下内容:
Dec 16 14:53:26 MiMi kernel: PPP generic driver version 2.4.2 #不用管,只要制定真正的pppd所在路径即可.
Dec 16 14:53:26 MiMi kernel: MPPE/MPPC encryption/compression module registered # 表示MPPE/MPPC已经成功加载到Kernel成功与VPN Server建立连接后,/var/log/messages里会有如下内容:
Dec 16 15:57:56 MiMi pptpd[5225]: CTRL: Starting call (launching pppd, opening GRE)
Dec 16 15:57:56 MiMi pppd[5226]: pppd 2.4.3 started by root, uid 0 Dec 16 15:57:56 MiMi pppd[5226]: Using interface ppp0 Dec 16 15:57:56 MiMi pppd[5226]: Connect: ppp0 <--> /dev/pts/1 Dec 16 15:57:59 MiMi pptpd[5225]: CTRL: Ignored a SET LINK INFO packet with real ACCMs! Dec 16 15:57:59 MiMi pppd[5226]: Warning - secret file /etc/ppp/chap-secrets has world and/or group access Dec 16 15:57:59 MiMi pppd[5226]: MPPC/MPPE 128-bit stateful compression enabled Dec 16 15:58:00 MiMi pppd[5226]: found interface eth0 for proxy arp Dec 16 15:58:00 MiMi pppd[5226]: local IP address 192.168.1.100 Dec 16 15:58:00 MiMi pppd[5226]: remote IP address 192.168.1.5 Dec 16 16:01:01 MiMi crond(pam_unix)[5244]: session opened for user root by (uid=0)