用Linux系统自身做一个L2TP的VPN服务器

来源:赛迪网 作者:sixth
  

用Linux自身做一个L2TP的VPN服务器。

 

先安装了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文件赋予可执行权限。

 

将xl2tpd加入到系统服务中去:

 

chkconfig --add xl2tpd

 

用setup命令设置xl2tpd服务为开机自动启动。

 

至此,L2TP的VPN服务器配置完成。在Windows XP中建立一个VPN连接,IP输入这个服务器的IP地址,用户名myvpntest,密码myvpntest,连接,哈,上去了。

 

厂商来人了,技术人员连上小盒子捣鼓了一阵,然后说设备没有问题,但看到带宽已被占用完了,建议还是跟ISP联系。于是马上联系ISP,要求临时增加带宽,还好,ISP答应比较爽快。带宽增加后,靠,居然故障排除了,看来今天白忙了,刚装好的服务器只好搁置到一边了,等下次有机会,再试一下。

 

(责任编辑:A6)


时间:2007-10-22 10:14 来源:赛迪网 作者:sixth 原文链接

好文,顶一下
(0)
0%
文章真差,踩一下
(0)
0%
------分隔线----------------------------


把开源带在你的身边-精美linux小纪念品
无觅相关文章插件,快速提升流量