先安装了RHEL5,然后到http://www.xelerance.com/software/xl2tpd/上下载了xl2tpd-1.1.11.tar.gz,解压后,进入该解压目录,然后编译、安装:
#make
#make install
安装完毕后,修改相关的配置文件:
1、修改/etc/xl2tpd/xl2tpd.conf,内容如下:
[lns default]
ip range = 192.168.191.2-192.168.191.254
local ip = 192.168.191.1
require chap = yes
refuse pap = yes
require authentication = yes
name = l2tpvpnserver
ppp debug = yes
pppoptfile = /etc/ppp/options.xl2tpd
length bit = yes
2、修改/etc/ppp/options.xl2tpd,内容如下:
ipcp-accept-local
ipcp-accept-remote
noccp
auth
crtscts
idle 1800
mtu 1410
mru 1410
nodefaultroute
debug
lock
proxyarp
connect-delay 5000
3、修改/etc/ppp/chap-secrets,内容如下
myvpntest * myvpntest *
4、编辑/etc/init.d/xl2tpd文件,内容如下:
#!/bin/sh
#
# xl2tpd This shell script takes care of starting and stopping l2tpd.
#
# chkconfig: - 80 30
# description: Layer 2 Tunnelling Protocol Daemon (RFC 2661)
#
# processname: xl2tpd
# config: /etc/xl2tpd/xl2tpd.conf
# pidfile: /var/run/xl2tpd.pid
#Servicename
SERVICE=xl2tpd
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
if [ ${NETWORKING} = "no" ]
then
exit 0
fi
[ -x /usr/sbin/$SERVICE ] || exit 0
RETVAL=0
start() {
echo -n "Starting $SERVICE: "
if [ ! -d /var/run/xl2tpd ]
then
mkdir /var/run/xl2tpd
fi
daemon $SERVICE
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$SERVICE
echo ""
return $RETVAL
}
stop() {
echo -n "Stopping $SERVICE: "
killproc $SERVICE
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$SERVICE
return $RETVAL
}
restart() {
stop
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $SERVICE
RETVAL=$?
;;
restart|reload)
restart
;;
condrestart)
[ -f /var/lock/subsys/$SERVICE ] && restart || :
;;
*)
echo "Usage: $SERVICE {start|stop|status|restart|reload|condrestart}"
exit 1
esac |
用chmod命令给xl2tpd文件赋予可执行权限:
#chmod +x xl2tpd
将xl2tpd加入到系统服务中去:
#chkconfig --add xl2tpd
用setup命令设置xl2tpd服务为开机自动启动。
至此,L2TP的VPN服务器配置完成。在Windows XP中建立一个VPN连接,IP输入这个服务器的IP地址,
用户名myvpntest,密码myvpntest,连接,哈,上去了。