>> Delete No. 31537 article
No. rp-pppoe script

등록 2001-05-28 03:27:00 By localhost     조회 2
이름 김선희    

		rp-pppoe 를 사용해서 인터넷 접속합니다..
 접속이 끊기면 자동으로 다시 접속이 되던데..
 재접속이 될때마다 일정한 스크립트를 자동으로..
 실행하게 하고싶은데..
 /usr/sbin/adsl-start
 /usr/sbin/adsl-connect
 이 두파일중에 어느파일 어느부분!!에 실행할
 스크립트를 넣어야 할까요??
 adsl 사용하시는분.. 좀 알려주세요!!
 아래는 adsl 접속 스크립트입니다..
    /etc/ppp/pppoe.conf
 ---------------------------------------------------------------------
#***********************************************************************
#
# pppoe.conf
#
# Configuration file for rp-pppoe.  Edit as appropriate and install in
# /etc/ppp/pppoe.conf
#
# NOTE: This file is used by the adsl-start, adsl-stop, adsl-connect and
#       adsl-status shell scripts.  It is *not* used in any way by the
#       "pppoe" executable.
#
# Copyright (C) 2000 Roaring Penguin Software Inc.
#
# This file may be distributed under the terms of the GNU General
# Public License.
#
# $Id: pppoe.conf,v 1.10 2000/09/16 19:56:12 dfs Exp $
#***********************************************************************
 # When you configure a variable, DO NOT leave spaces around the "=" sign.
 # Ethernet card connected to ADSL modem
ETH='eth0'
 # ADSL user name.  You may have to supply "@provider.com"  Sympatico
# users in Canada do need to include "@sympatico.ca"
# Sympatico uses PAP authentication.  Make sure /etc/ppp/pap-secrets
# contains the right username/password combination.
# For Magma, use xxyyzz at magma.ca USER='userid'
 # Bring link up on demand?  Default is to leave link up all the time.
# If you want the link to come up on demand, set DEMAND to a number indicating
# the idle time after which the link is brought down.
DEMAND=no
#DEMAND=300
 # Obtain DNS server addresses from the peer (recent versions of pppd only)
USEPEERDNS=no
 ### ONLY TOUCH THE FOLLOWING SETTINGS IF YOU'RE AN EXPERT
 # How long adsl-start waits for a new PPP interface to appear before
# concluding something went wrong.  If you use 0, then adsl-start
# exits immediately with a successful status and does not wait for the
# link to come up.  Time is in seconds.
#
# WARNING WARNING WARNING:
#
# If you are using rp-pppoe on a physically-inaccessible host, set
# CONNECT_TIMEOUT to 0.  This makes SURE that the machine keeps trying
# to connect forever after adsl-start is called.  Otherwise, it will
# give out after CONNECT_TIMEOUT seconds and will not attempt to
# connect again, making it impossible to reach.
CONNECT_TIMEOUT=20
 # How often in seconds adsl-start polls to check if link is up
CONNECT_POLL=6
 # Character to echo at each poll.  Use PING="" if you don't want
# anything echoed
PING="."
 # File where the adsl-connect script writes its process-ID.
# Three files are actually used:
#   $PIDFILE       contains PID of adsl-connect script
#   $PIDFILE.pppoe contains PID of pppoe process
#   $PIDFILE.pppd  contains PID of pppd process
PIDFILE=/var/run/adsl.pid
 # Do you want to use synchronous PPP?  "yes" or "no".  "yes" is much
# easier on CPU usage, but may not work for you.  It is safer to use
# "no", but you may want to experiment with "yes".  "yes" is generally
# safe on Linux machines with the n_hdlc line discipline; unsafe on others.
SYNCHRONOUS=no
 # Do you want to clamp the MSS?  Here's how to decide:
# - If you have only a SINGLE computer connected to the ADSL modem, choose
#   "no".
# - If you have a computer acting as a gateway for a LAN, choose "1412".
#   The setting of 1412 is safe for either setup, but uses slightly more
#   CPU power.
CLAMPMSS=1452
#CLAMPMSS=no
 # LCP echo interval and failure count.
LCP_INTERVAL=20
LCP_FAILURE=3
 # PPPOE_TIMEOUT should be about 4*LCP_INTERVAL
PPPOE_TIMEOUT=80
 # Firewalling: One of NONE, STANDALONE or MASQUERADE
FIREWALL=NONE
 # Any extra arguments to pass to pppoe.  Normally, use a blank string
# like this:
PPPOE_EXTRA="-S pppoe"
 # Rumour has it that "Citizen's Communications" with a 3Com
# HomeConnect ADSL Modem DualLink requires these extra options:
# PPPOE_EXTRA="-f 3c12:3c13 -S ISP"
 --------------------------------------------------------------------
 /usr/sbin/adsl-start
 --------------------------------------------------------------------
 #!/bin/sh
# Generated automatically from adsl-start.in by configure.
#***********************************************************************
#
# adsl-start
#
# Shell script to bring up an ADSL connection
#
# Copyright (C) 2000 Roaring Penguin Software Inc.
#
# $Id: adsl-start.in,v 1.25 2000/12/04 16:57:39 dfs Exp $
#
# This file may be distributed under the terms of the GNU General
# Public License.
#
# Usage: adsl-start [config_file]
#        adsl-start interface user [config_file]
# Second form overrides USER and ETH from config file.
# If config_file is omitted, defaults to /etc/ppp/pppoe.conf
#
#***********************************************************************
 # From AUTOCONF
prefix=/usr
exec_prefix=${prefix}
 # Paths to programs
CONNECT=${exec_prefix}/sbin/adsl-connect
IFCONFIG=/sbin/ifconfig
 # Defaults
CONFIG=/etc/ppp/pppoe.conf
USER=""
ETH=""
ME=`basename $0`
# Must be root
if [ "`/usr/bin/id -u`" != 0 ] ; then
    echo "$ME: You must be root to run this script" >& 2
    exit 1
fi
 # Debugging
if [ "$DEBUG" = "1" ] ; then
    echo "*** Running in debug mode... please be patient..."
    DEBUG=/tmp/pppoe-debug-$$
    export DEBUG
    mkdir $DEBUG
    if [ "$?" != 0 ] ; then
	echo "Could not create directory $DEBUG... exiting"
	exit 1
    fi
    DEBUG=$DEBUG/pppoe-debug.txt
     # Initial debug output
    echo "---------------------------------------------" > $DEBUG
    date >> $DEBUG
    echo "Output of uname -a" >> $DEBUG
    uname -a >> $DEBUG
    echo "---------------------------------------------" >> $DEBUG
    echo "Output of ifconfig -a" >> $DEBUG
    $IFCONFIG -a >> $DEBUG
    echo "---------------------------------------------" >> $DEBUG
    if [ "`uname -s`" = "Linux" ] ; then
	echo "Output of lsmod" >> $DEBUG
	lsmod >> $DEBUG
	echo "---------------------------------------------" >> $DEBUG
    fi
    echo "Output of netstat -n -r" >> $DEBUG
    netstat -n -r >> $DEBUG
    echo "---------------------------------------------" >> $DEBUG
    echo "Contents of /etc/resolv.conf" >> $DEBUG
    cat /etc/resolv.conf >> $DEBUG
    echo "---------------------------------------------" >> $DEBUG
    echo "Contents of /etc/ppp/options" >> $DEBUG
    cat /etc/ppp/options >> $DEBUG 2>/dev/null
    echo "---------------------------------------------" >> $DEBUG
else
    DEBUG=""
fi
 # Sort out command-line arguments
case "$#" in
    1)
	CONFIG="$1"
	;;
    3)
	CONFIG="$3"
	;;
esac
 if [ ! -f "$CONFIG" -o ! -r "$CONFIG" ] ; then
    echo "$ME: Cannot read configuration file '$CONFIG'" >& 2
    exit 1
fi
 . $CONFIG
 # Check for command-line overriding of ETH and USER
case "$#" in
    2|3)
	ETH="$1"
	USER="$2"
	;;
esac
 # Check for pidfile
if [ -r "$PIDFILE" ] ; then
    PID=`cat "$PIDFILE"`
    # Check if still running
    kill -0 $PID > /dev/null 2>&1
    if [ $? = 0 ] ; then
	echo "$ME: There already seems to be an ADSL connection up (PID $PID)" >& 2
	exit 1
    fi
    # Delete bogus PIDFILE
    rm -f "$PIDFILE" "$PIDFILE.pppd" "$PIDFILE.pppoe"
fi
 # Start the connection in the background unless we're debugging
if [ "$DEBUG" != "" ] ; then
    $CONNECT "$@"
    exit 0
fi
 $CONNECT "$@" > /dev/null 2>&1 &
CONNECT_PID=$!
 if [ "$CONNECT_TIMEOUT" = "" -o "$CONNECT_TIMEOUT" = 0 ] ; then
    exit 0
fi
 # Don't monitor connection if dial-on-demand
if [ "$DEMAND" != "" -a "$DEMAND" != "no" ] ; then
    exit 0
fi
 # Monitor connection
TIME=0
while [ true ] ; do
    ${exec_prefix}/sbin/adsl-status $CONFIG > /dev/null 2>&1
     # Looks like the interface came up
    if [ $? = 0 ] ; then
	# Print newline if standard input is a TTY
	tty -s && echo " Connected!"
	exit 0
    fi
     tty -s && echo -n "$PING"
    sleep $CONNECT_POLL
    TIME=`expr $TIME + $CONNECT_POLL`
    if [ $TIME -gt $CONNECT_TIMEOUT ] ; then
	break
    fi
done
 echo "TIMED OUT"
# Timed out!  Kill the adsl-connect process and quit
kill $CONNECT_PID > /dev/null 2>&1
exit 1
 -------------------------------------------------------------------
 /usr/sbin/adsl-connect
 -------------------------------------------------------------------
 #!/bin/sh
# Generated automatically from adsl-connect.in by configure.
#***********************************************************************
#
# adsl-connect
#
# Shell script to connect to an ADSL provider using PPPoE
#
# Copyright (C) 2000 Roaring Penguin Software Inc.
#
# $Id: adsl-connect.in,v 1.31 2000/12/04 16:57:39 dfs Exp $
#
# This file may be distributed under the terms of the GNU General
# Public License.
#
# Usage: adsl-connect [config_file]
#        adsl-connect interface user [config_file]
# Second form overrides USER and ETH from config file.
# If config_file is omitted, defaults to /etc//ppp/pppoe.conf
#
#***********************************************************************
 # From AUTOCONF
prefix=/usr
exec_prefix=${prefix}
localstatedir=/var
 # Paths to programs
IFCONFIG=/sbin/ifconfig
PPPD=/usr/sbin/pppd
SETSID=/usr/bin/setsid
PPPOE=${exec_prefix}/sbin/pppoe
LOGGER="/usr/bin/logger -t `basename $0`"
 # Must be root
if test "`/usr/bin/id -u`" != 0 ; then
    echo "$0: You must be root to run this script" >& 2
    exit 1
fi
 if test "$SETSID" != "" -a ! -x "$SETSID"; then
    SETSID=""
fi
 CONFIG=/etc//ppp/pppoe.conf
USER=""
ETH=""
 # Sort out command-line arguments
case "$#" in
    1)
	CONFIG="$1"
	;;
    3)
	CONFIG="$3"
	;;
esac
 if test ! -f "$CONFIG" -o ! -r "$CONFIG" ; then
    echo "$0: Cannot read configuration file '$CONFIG'" >& 2
    exit 1
fi
 . $CONFIG
 PPPOE_PIDFILE="$PIDFILE.pppoe"
PPPD_PIDFILE="$PIDFILE.pppd"
 # Check for command-line overriding of ETH and USER
case "$#" in
    2|3)
	ETH="$1"
	USER="$2"
	;;
esac
 # Check that config file is sane
if test "$USER" = "" ; then
    echo "$0: Check '$CONFIG' -- no setting for USER" >& 2
    exit 1
fi
if test "$ETH" = "" ; then
    echo "$0: Check '$CONFIG' -- no setting for ETH" >& 2
    exit 1
fi
 PPPD_PID=0
 # Catch common error
if test "$DEBUG" = "1" ; then
    echo "*** If you want to use DEBUG, invoke adsl-start, not adsl-connect."
    exit 1
fi
 if test "$DEBUG" != "" ; then
    echo "ETH=$ETH; USER=$USER" >> $DEBUG
    echo "---------------------------------------------" >> $DEBUG
fi
 # MTU of Ethernet card attached to modem MUST be 1500.  This apparently
# fails on some *BSD's, so we'll only do it under Linux
 if test `uname -s` = Linux ; then
    $IFCONFIG $ETH up mtu 1500
fi
 if test "$SYNCHRONOUS" = "yes" ; then
	PPPOE_SYNC=-s
	PPPD_SYNC=sync
	# Increase the chances of it working on Linux...
	if test `uname -s` = Linux ; then
	    modprobe n_hdlc > /dev/null 2>&1
	fi
else
	PPPOE_SYNC=""
	PPPD_SYNC=""
fi
 if test "$CLAMPMSS" = "no" ; then
	CLAMPMSS=""
else
	CLAMPMSS="-m $CLAMPMSS"
fi
 if test "$USEPEERDNS" = "yes" ; then
	USEPEERDNS="usepeerdns"
else
	USEPEERDNS=""
fi
 # Backward config file compatibility
if test "$DEMAND" = "" ; then
	DEMAND=no
fi
 if test "$DEMAND" = "no" ; then
	DEMAND=""
else
	DEMAND="demand persist idle $DEMAND 10.112.112.112:10.112.112.113 ipcp-accept-remote ipcp-accept-local connect true noi
pdefault ktune" fi
 case "$FIREWALL" in
    STANDALONE)
	. /etc/ppp/firewall-standalone
	;;
    MASQUERADE)
	. /etc/ppp/firewall-masq
	;;
esac
 # Standard PPP options we always use
PPP_STD_OPTIONS="noipdefault noauth defaultroute hide-password nodetach $USEPEERDNS local mtu 1492 mru 1492 noaccomp noc
cp nobsdcomp nodeflate nopcomp novj novjccomp user $USER lcp-echo-interval $LCP_INTERVAL lcp-echo-failure $LCP_FAILURE" 
 # PPPoE invocation PPPOE_CMD="$PPPOE -p $PPPOE_PIDFILE -I $ETH -T $PPPOE_TIMEOUT $PPPOE_SYNC $CLAMPMSS $PPPOE_EXTRA"
if test "$DEBUG" != "" ; then
    if test "$DEMAND" != "" ; then
	echo "(Turning off DEMAND for debugging purposes)"
	DEMAND=""
    fi
    echo "pppd invocation" >> $DEBUG
    echo "$SETSID $PPPD pty '$PPPOE_CMD' $PPP_STD_OPTIONS $PPPD_SYNC debug" >> $DEBUG
    echo "---------------------------------------------" >> $DEBUG
    $SETSID $PPPD pty "$PPPOE_CMD -D $DEBUG-0"
	$PPP_STD_OPTIONS
	$PPPD_SYNC
	debug >> $DEBUG 2>&1
    echo "---------------------------------------------" >> $DEBUG
     echo "Extract from /var/log/messages" >> $DEBUG
    grep 'ppp' /var/log/messages | tail -150 >> $DEBUG
    date >> $DEBUG
    echo "---------------------------------------------" >> $DEBUG
    echo "rp-pppoe debugging dump" >> $DEBUG
    cat $DEBUG-0 >> $DEBUG
    rm -f $DEBUG-0
    for i in 1 2 3 4 5 6 7 8 9 10 ; do
    echo ""
    echo ""
    echo ""
    done
    echo "*** Finished debugging run.  Please review the file"
    echo "*** '$DEBUG' and make sure it does not contain"
    echo "*** any sensitive information.  Once you are satisfied with it,"
    echo "*** e-mail it to 'pppoe at roaringpenguin.com' for diagnosis."
    echo ""
    echo "*** BUT BEFORE YOU DO THIS, make sure you have read the HOW-TO-CONNECT"
    echo "*** file which came with the rp-pppoe package."
    exit 0
fi
 echo $$ > $PIDFILE
 while [ true ] ; do
    $SETSID $PPPD pty "$PPPOE_CMD"
	$PPP_STD_OPTIONS
	$DEMAND
	$PPPD_SYNC &
    echo "$!" > $PPPD_PIDFILE
    wait
     # Otherwise, re-establish the connection
    $LOGGER -p daemon.notice
        "ADSL connection lost; attempting re-connection."
done
 ---------------------------------------------------------------------
 /etc/rc.d/init.d/adsl
 ---------------------------------------------------------------------
 #!/bin/sh
#
# adsl                     This script starts or stops an ADSL connection
#
# chkconfig: 2345 99 01
# description: Connects to ADSL provider
#
# Copyright (C) 2000 Roaring Penguin Software Inc.  This software may
# be distributed under the terms of the GNU General Public License, version
# 2 or any later version.
 # Source function library if it exists
test -r /etc/rc.d/init.d/functions && . /etc/rc.d/init.d/functions
 # From AUTOCONF
prefix=/usr
exec_prefix=${prefix}
 # Paths to programs
START=${exec_prefix}/sbin/adsl-start
STOP=${exec_prefix}/sbin/adsl-stop
STATUS=${exec_prefix}/sbin/adsl-status
case "$1" in
    start)
        echo -n "Bringing up ADSL link"
 	$START
	if [ $? = 0 ] ; then
	        echo_success
	else
		echo_failure
	fi
        echo ""
        ;;
     stop)
        echo -n "Shutting down ADSL link"
 	$STOP > /dev/null 2>&1
	if [ $? = 0 ] ; then
	        echo_success
	else
		echo_failure
	fi
        echo ""
        ;;
     restart)
	$0 stop
	$0 start
	;;
     status)
	$STATUS
	;;
     *)
        echo "Usage: adsl {start|stop|restart|status}"
        exit 1
esac
 exit 0
 ---------------------------------------------------------------------
--
자상한남자가져아~
[관리자] 패스워드를 입력 하십시오. 답장이 존재하면 함께 삭제됩니다.[ 목록 | 이전 ]
패스워드:    

Copyleft 1999-2026 by JSBoard Open Project
Theme Designed by IDOO All right reserved