热门关键字:  ubuntu  分区  函数  Fedora  linux系统进程

linux下pptp服务器配置

来源: 作者: 时间:2007-03-29 Tag: 点击:

7.         /etc/ppp/ip-up内容如下:


#!/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


8.         /etc/ppp/chat-secrets内容如下:

# Secrets for authentication using CHAP

# client        server  secret                  IP addresses

“test”  pptpserver       “dfd&890”  192.168.x.x
9.         略

二、      pptp服务器管理
1.         新建用户

Vi /etc/ppp/chat-secrets增加一条即可,并指定IP
2.         查看登录日志

tail –n100 /etc/ppp/userlog


最新评论共有 4 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册