分类: 网络与安全
2006-04-25 16:13:26
pptp服务器配置与管理
(下载地址:)
dkms-
kernel_ppp_mppe-
kernelmod-
ppp-
pptpd-
首先查看是否已经支持mppe功能:modprobe ppp-compress-18 && echo ok
如果显示ok,那么内核已经具备了mppe支持。如果不支持,需安装:
dkms-
kernel_ppp_mppe-
对于低版本的内核是必须安装kernelmod-
在上面的网址下载最新的ppp软件包,源包用最常规的方法,configure,make,make install。注意:新版的没有复制范例配置文件,需要用 make install-etcppp 来安装范例配置文件。一般可用rpm软件包:
rpm –ivh ppp-
在上面的网址下载最新的pptp软件包,源包用最常规的方法,configure,make,make install。一般采用pptp软件包:pptpd-
ppp /usr/local/sbin/pppd
option /etc/ppp/options.pptpd
bcrelay eth0
#listen
localip 192.168.x.x
remoteip 192.168.x.1-254
netmast 255.255.255.0
lock
dump
logfd 2
logfile /var/log/pptpd.log
name pptpserver
proxyarp
auth
mtu 1450
nobsdcomp
require-mschap-v2
#require-mppe-128
require-mppe
ipparam options.pptpd
ms-dns 192.168.x.x
ms-dns 202.86.252.254
#!/bin/bash
# This file should not be modified -- make local changes to
# /etc/ppp/ip-up.local instead
PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH
LOGDEVICE=$6
REALDEVICE=$1
[ -f /etc/sysconfig/network-scripts/ifcfg-${LOGDEVICE} ] && /etc/sysconfig/network-scripts/ifup-post ifcfg-${LOGDEVICE}
/etc/ppp/ip-up.ipv6to4 ${LOGDEVICE}
#################### Log ########################
pptplogdirectory="/etc/ppp"
dialinfo=`/sbin/ifconfig $1`
dialtime=`/bin/date`
userip=`ifconfig $1|grep inet|awk '{print $3}'|awk -F: '{print $2}'`
localinfo=`/bin/cat /etc/ppp/chap-secrets|grep $userip|awk '{print "username:"$1"\t","localIP:" $4,"logon Successfull"}'`
#username=`/bin/cat /etc/ppp/chap-secrets|grep $userip|awk '{print $1}'`
#remoteinfo=`/usr/bin/tail /var/log/daemon -n100|grep "CTRL: Client"|grep "control connection started"|tail -n1|awk -F"Client" '{print $2}'|awk '{print "remoteIP:",$1}'`
if [ -e $pptplogdirectory/userlog ];then
/bin/cat /etc/ppp/chap-secrets|grep $userip|awk '{print logontime"\t","username:"$1"\t","IP:"$4,"logon Successfull""\t","remoteIP:"'$6'}' logontime="`/bin/date`" >>$pptplogdirectory/userlog
#/bin/cat /etc/ppp/chap-secrets|grep $userip|awk '{print logontime"\t","username:"$1"\t","IP:"$4,"logon Successfull""\t","remoteIP:"'$6'}' logontime="`/bin/date`" >>$pptplogdirectory/userlog
#/bin/echo $0 $1 $2 $3 $4 $5 $6 $7 >>$pptplogdirectory/userlog
#/bin/echo $dialtime $localinfo $remoteinfo >>$pptplogdirectory/userlog
#/bin/cat /etc/ppp/chap-secrets|grep $userip|awk '{print logontime"\t","username:"$1"\t","IP:"$4,"logon Successfull"}' logontime="`/bin/date`" >>$pptplogdirectory/userlog
#/bin/cat /etc/ppp/chap-secrets|grep $userip|awk '{print logontime"\t","username:"$1"\t","IP:"$4,"logon Successfull""\t",remoteinfo}' logontime="`/bin/date`" remoteinfo="`/usr/bin/tail /var/log/daemon -n100|grep "CTRL: Client"|grep "control connection started"|tail -n1|awk -F"Client" '{print $2}'|awk '{print "remoteIP:",$1}'`" >>$pptplogdirectory/userlog
#echo "456"|awk '{print a$0b}' a="$a" b="$b"
else
/bin/touch $pptplogdirectory/userlog
fi
####################################################
/sbin/ifconfig $1 mtu 1446
#[ -x /etc/ppp/login.sh ] && /etc/ppp/login.sh "$@"
[ -x /etc/ppp/ip-up.local ] && /etc/ppp/ip-up.local "$@"
exit 0
# Secrets for authentication using CHAP
# client server secret IP addresses
“test” pptpserver “dfd&890” 192.168.x.x
Vi /etc/ppp/chat-secrets增加一条即可,并指定IP
tail –n100 /etc/ppp/userlog