linux下pppoe脚本分析!
来源:互联网 发布:第三方网络平台 编辑:程序博客网 时间:2024/06/10 09:26
pppoe服务相关的命令包括:
- adsl-start。该脚本主要功能是pppoe服务启动脚本。
- adsl-stop。该脚本主要功能是pppoe服务停止脚本,并恢复默认路由。
- adsl-connect。该脚本主要功能是和pppoe协议执行脚本。
- adsl-status。该脚本主要功能是查看pppoe状态。
pppoe服务相关的文件包括:
- chap-secrets。chap认证的用户名和密码。
- pap-secrets。pap认证的用户名和密码。
- pppoe.conf。端口配置信息。
另外,pppoe不会自动配置默认路由,所以需要修改脚本。
最简单的修改方法就是pppoe启动前,先保存原来的默认路由,pppoe停止后,回复原来的默认路由。
或者,pppoe启动时,根据端口名称来配置默认路由,pppoe停止后,再取消启动时配置的默认路由。
默认情况下,使用/etc/ppp/pppoe.conf配置文件:
开启pppoe服务的命令:adsl-start 。
关闭pppoe服务的命令:adsl-stop。
若使用其他配置文件,例如/etc/ppp/pppoe-eth0.conf ,则
adsl-start /etc/ppp/pppoe-eth0.conf
adsl-stop /etc/ppp/pppoe-eth0.conf
下面分析用到的脚本。
adsl-start脚本:
#! /bin/bash# 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.7 2001/06/25 15:00:47 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 AUTOCONFprefix=/usrexec_prefix=/usr# Paths to programsCONNECT=/usr/sbin/adsl-connectECHO=/bin/echoIP=/sbin/ipLS=/bin/lsNETWORKDIR=/etc/sysconfig/network-scriptsget_device() { if [ ! -d $NETWORKDIR ] ; then $ECHO "** $NETWORKDIR not found" $ECHO "** Quitting" exit 1 fi cd $NETWORKDIR interfaces=$($LS ifcfg-ppp* 2>/dev/null | egrep -v '(~|\.bak)$' | \ egrep -v '(rpmsave|rpmorig|rpmnew)' | sed 's/^ifcfg-//g') for i in $interfaces ; do test -f ifcfg-$i && . ifcfg-$i 2>/dev/null if [ "$TYPE" = "xDSL" ] ; then CONFIG=$NETWORKDIR/ifcfg-$i break fi done}# Set to "C" locale so we can parse messages from commandsLANG=Cexport LANG# DefaultsUSER=""ETH=""ME=`basename $0`# Must be rootif [ "`/usr/bin/id -u`" != 0 ] ; then [ "$DEBUG" = "1" ] && $ECHO "$ME: You must be root to run this script" >& 2 exit 1fi# Debuggingif [ "$DEBUG" = "1" ] ; then $ECHO "*** Running in debug mode... please be patient..." DEBUG=`mktemp -d /tmp/pppoe-debug-XXXXXXXX` if [ $? -ne 0 ] ; then $ECHO "Could not create directory $DEBUG... exiting" exit 1 fi export DEBUG DEBUG=$DEBUG/pppoe-debug.txt # Initial debug output $ECHO "---------------------------------------------" > $DEBUG $ECHO "* The following section contains information about your system" >> $DEBUG date >> $DEBUG $ECHO "Output of uname -a" >> $DEBUG uname -a >> $DEBUG $ECHO "---------------------------------------------" >> $DEBUG $ECHO "* The following section contains information about your network" >> $DEBUG $ECHO "* interfaces. The one you chose for PPPoE should contain the words:" >> $DEBUG $ECHO "* 'UP' and 'RUNNING'. If it does not, you probably have an Ethernet" >> $DEBUG $ECHO "* driver problem." >> $DEBUG $ECHO "Output of ip addr show" >> $DEBUG $IP addr show >> $DEBUG $ECHO "---------------------------------------------" >> $DEBUG if [ "`uname -s`" = "Linux" ] ; then $ECHO "* The following section contains information about kernel modules" >> $DEBUG $ECHO "* If the module for your Ethernet card is 'tulip', you might" >> $DEBUG $ECHO "* want to look for an updated version at http://www.scyld.com" >> $DEBUG $ECHO "Output of lsmod" >> $DEBUG lsmod >> $DEBUG $ECHO "---------------------------------------------" >> $DEBUG fi $ECHO "* The following section lists your routing table." >> $DEBUG $ECHO "* If you have an entry which starts with '0.0.0.0', you probably" >> $DEBUG $ECHO "* have defined a default route and gateway, and pppd will" >> $DEBUG $ECHO "* not create a default route using your ISP. Try getting" >> $DEBUG $ECHO "* rid of this route." >> $DEBUG $ECHO "Output of netstat -n -r" >> $DEBUG netstat -n -r >> $DEBUG $ECHO "---------------------------------------------" >> $DEBUG $ECHO "Contents of /etc/resolv.conf" >> $DEBUG $ECHO "* The following section lists DNS setup." >> $DEBUG $ECHO "* If you can browse by IP address, but not name, suspect" >> $DEBUG $ECHO "* a DNS problem." >> $DEBUG cat /etc/resolv.conf >> $DEBUG $ECHO "---------------------------------------------" >> $DEBUG $ECHO "* The following section lists /etc/ppp/options." >> $DEBUG $ECHO "* You should have NOTHING in that file." >> $DEBUG $ECHO "Contents of /etc/ppp/options" >> $DEBUG cat /etc/ppp/options >> $DEBUG 2>/dev/null $ECHO "---------------------------------------------" >> $DEBUG DEBUG="1"fi# Sort out command-line argumentscase "$#" in 1) CONFIG="$1" ;; 3) CONFIG="$3" ;;esacif [ -z "$CONFIG" ] ; then get_device [ -z "$CONFIG" ] && CONFIG=/etc/ppp/pppoe.conffiif [ ! -f "$CONFIG" -o ! -r "$CONFIG" ] ; then [ "$DEBUG" = "1" ] && $ECHO "$ME: Cannot read configuration file '$CONFIG'" >& 2 exit 1fi. $CONFIG# Check for command-line overriding of ETH and USERcase "$#" in 2|3) ETH="$1" USER="$2" ;;esac# Check for pidfileif [ -r "$PIDFILE" ] ; then PID=`cat "$PIDFILE"` # Check if still running kill -0 $PID > /dev/null 2>&1 if [ $? = 0 ] ; then [ "$DEBUG" = "1" ] && $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" "$PIDFILE.start"fiecho $$ > $PIDFILE.start #将adsl-start的进程号保存到$PIDFILE.start文件# Start the connection in the background unless we're debuggingif [ "$DEBUG" = "1" ] ; then $CONNECT "$@" exit 0fi$CONNECT "$@" > /dev/null 2>&1 & #启动adsl-connect程序 CONNECT_PID=$! #保存adsl-connect程序的pidif [ "$CONNECT_TIMEOUT" = "" -o "$CONNECT_TIMEOUT" = 0 ] ; then exit 0fi# Don't monitor connection if dial-on-demandif [ "$DEMAND" != "" -a "$DEMAND" != "no" ] ; then exit 0fi# Monitor connectionTIME=0while [ true ] ; do /usr/sbin/adsl-status $CONFIG > /dev/null 2>&1 #监控时,通过adsl-status来检测 # Looks like the interface came up if [ $? = 0 ] ; then # Print newline if standard input is a TTY [ "$DEBUG" = "1" ] && tty -s && $ECHO " Connected!" cp -f /etc/ppp/resolv.conf /etc/ exit 0 #连接成功后,退出监控 fi if test -n "$FORCEPING" ; then [ "$DEBUG" = "1" ] && $ECHO -n "$FORCEPING" else [ "$DEBUG" = "1" ] && tty -s && $ECHO -n "$PING" fi sleep $CONNECT_POLL TIME=`expr $TIME + $CONNECT_POLL` if [ $TIME -gt $CONNECT_TIMEOUT ] ; then break #60s超时后退出监控。 fidone[ "$DEBUG" = "1" ] && $ECHO "TIMED OUT" >& 2# Timed out! Kill the adsl-connect process and quitkill $CONNECT_PID > /dev/null 2>&1 #连接超时则将adsl-connect杀死# Clean up PIDFILE(s)rm -f "$PIDFILE" "$PIDFILE.pppd" "$PIDFILE.pppoe" "$PIDFILE.start" #连接超时则删除所有pidfile文件# add old default gw back #添加默认路由if [ -s /etc/default-route ] ; then route add default gw `cat /etc/default-route` rm -f /etc/default-routefiexit 1
adsl-connect脚本:
#! /bin/bash# 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.17 2001/09/14 19:07:42 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 AUTOCONFprefix=/usrexec_prefix=/usrlocalstatedir=/var# Paths to programsIP=/sbin/ipPPPD=/usr/sbin/pppdSETSID=/usr/bin/setsidPPPOE=/usr/sbin/pppoeBR2684CTL=/usr/sbin/br2684ctlLOGGER="/usr/bin/logger -t `basename $0`"NETWORKDIR=/etc/sysconfig/network-scriptsLS=/bin/lsDEBUG=/var/log/pppoe.logget_device() { if [ ! -d $NETWORKDIR ] ; then $ECHO "** $NETWORKDIR not found" $ECHO "** Quitting" exit 1 fi cd $NETWORKDIR interfaces=$($LS ifcfg-ppp* 2>/dev/null | egrep -v '(~|\.bak)$' | \ egrep -v '(rpmsave|rpmorig|rpmnew)' | sed 's/^ifcfg-//g') for i in $interfaces ; do test -f ifcfg-$i && . ifcfg-$i 2>/dev/null if [ "$TYPE" = "xDSL" ] ; then CONFIG=$NETWORKDIR/ifcfg-$i break fi done}# Set to "C" locale so we can parse messages from commandsLANG=Cexport LANG# Must be rootif test "`/usr/bin/id -u`" != 0 ; then echo "$0: You must be root to run this script" >& 2 exit 1fiif test "$SETSID" != "" -a ! -x "$SETSID"; then SETSID=""fiUSER=""ETH=""# Sort out command-line argumentscase "$#" in 1) CONFIG="$1" ;; 3) CONFIG="$3" ;;esacif [ -z "$CONFIG" ] ; then get_device [ -z "$CONFIG" ] && CONFIG=/etc/ppp/pppoe.conffiif test ! -f "$CONFIG" -o ! -r "$CONFIG" ; then echo "$0: Cannot read configuration file '$CONFIG'" >& 2 exit 1fi. $CONFIGDEVNAME="$DEVICE"PPPOE_PIDFILE="$PIDFILE.pppoe"PPPD_PIDFILE="$PIDFILE"if [ "$CONFIG" != "/etc/ppp/pppoe.conf" ] ; then DEVNAME=`basename $CONFIG | sed 's/^ifcfg-//g'` #获取device名称,样式为:pppoe-port001.conffiif [ -n "$BR2684DEV" ]; then [ -z "$ETH" ] && ETH="nas$BR2684DEV" modprobe br2684 > /dev/null 2>&1fi# Check for command-line overriding of ETH and USERcase "$#" in 2|3) ETH="$1" USER="$2" ;;esac# Check that config file is saneif test "$USER" = "" ; then echo "$0: Check '$CONFIG' -- no setting for USER" >& 2 exit 1fiif test "`basename \"$LINUX_PLUGIN\"`" = "pppoatm.so" ; then if test "$VCI" = "" ; then echo "$0: Check '$CONFIG' -- no setting for VCI" >& 2 exit 1 fi if test "$VPI" = "" ; then echo "$0: Check '$CONFIG' -- no setting for VPI" >& 2 exit 1 fielse if test "$ETH" = "" ; then echo "$0: Check '$CONFIG' -- no setting for ETH" >& 2 exit 1 fifiPPPD_PID=0# Catch common error #若DEBUG=1,则不能使用adsl-connect,而是得用adsl-startif test "$DEBUG" = "1" ; then echo "*** If you want to use DEBUG, invoke adsl-start, not adsl-connect." exit 1fiif test "$DEBUG" != "" ; then #DEBUG不等于1,也不等于空时,进入debug模式 if test "$LINUX_PLUGIN" != "" ; then echo "Cannot use DEBUG mode and LINUX_PLUGIN at the same time." echo "Kernel-mode PPPoE is experimental and unsupported." #若为LINUX_PLUGIN,退出 exit 1 fi echo "* The following section identifies your Ethernet interface" >> $DEBUG echo "* and user name. Some ISP's need 'username'; others" >> $DEBUG echo "* need 'username@isp.com'. Try both" >> $DEBUG echo "ETH=$ETH; USER=$USER" >> $DEBUG echo "---------------------------------------------" >> $DEBUGfi# MTU of Ethernet card attached to modem MUST be 1500. This apparently# fails on some *BSD's, so we'll only do it under Linuxif test `uname -s` = Linux ; then #仅支持linux系统 $IP link set $ETH up mtu 1500 # For 2.4 kernels. Will fail on 2.2.x, but who cares? modprobe ppp_generic > /dev/null 2>&1 modprobe ppp_async > /dev/null 2>&1 modprobe ppp_synctty > /dev/null 2>&1 if test -n "$LINUX_PLUGIN" ; then modprobe pppox > /dev/null 2>&1 modprobe pppoe > /dev/null 2>&1 fifiif test "$SYNCHRONOUS" = "yes" ; then #是否同步,默认脚本是no 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 fielse PPPOE_SYNC="" PPPD_SYNC=""fiif test -n "$ACNAME" ; then #默认脚本中不存在该字段 ACNAME="-C $ACNAME"fiif test -n "$SERVICENAME" ; then #默认脚本中不存在该字段 SERVICENAME="-S $SERVICENAME"fiif test "$CLAMPMSS" = "no" ; then CLAMPMSS=""else CLAMPMSS="-m $CLAMPMSS"fi# If DNSTYPE is SERVER, we must use "usepeerdns" option to pppd.if test "$DNSTYPE" = "SERVER" ; then PEERDNS=yesfiif test "$PEERDNS" = "yes" ; then #默认为yes PEERDNS="usepeerdns"else PEERDNS=""fiif [ -z "$DEVICE" ] ; then IPPARAM="" LINKNAME=""else IPPARAM="ipparam ${DEVNAME}" #ipparam pppoe-port002.conf。DEVICE值为ppp_port002 LINKNAME="linkname ${DEVICE}" #linkname ppp_port002 。DEVICE值为fi[ -z "$MTU" ] && MTU="1492"[ -z "$MRU" ] && MRU="1492"# Backward config file compatibilityif test "$DEMAND" = "" ; then DEMAND=nofiif test "$DEMAND" = "no" ; then #DEMAND默认为no DEMAND=""else [ -z "$IPADDR" ] && IPADDR=10.112.112.112 [ -z "$REMIP" ] && REMIP=10.112.112.113 DEMAND="demand persist idle $CONNECT_TIMEOUT $IPADDR:$REMIP ipcp-accept-remote ipcp-accept-local noipdefault ktune" # The plugin doesn't need (and may not _accept_) the 'connect' option if [ -z "$LINUX_PLUGIN" ]; then DEMAND="$DEMAND connect true" fificase "$FIREWALL" in STANDALONE) . /etc/ppp/firewall-standalone ;; MASQUERADE) . /etc/ppp/firewall-masq ;;esac# If we're using kernel-mode PPPoE on Linux...if test "`basename \"$LINUX_PLUGIN\"`" = "rp-pppoe.so" ; then PLUGIN_OPTS="plugin $LINUX_PLUGIN $ETH" modprobe pppoe > /dev/null 2>&1fi# If we're using kernel-mode PPPoATM on Linux...if test "`basename \"$LINUX_PLUGIN\"`" = "pppoatm.so" ; then PLUGIN_OPTS="plugin $LINUX_PLUGIN" # Interface name MUST BE LAST!! PLUGIN_OPTS="$PLUGIN_OPTS $VPI.$VCI" modprobe pppoatm > /dev/null 2>&1fiif test "$DEFROUTE" != "no" ; then DEFAULTROUTE="defaultroute" # pppd will no longer delete an existing default route # so we have to help it out a little here. DEFRT=`ip route list | awk '/^default / { print $3 }'` #获取并保存default路由 [ -n "${DEFRT}" ] && echo $DEFRT > /etc/default-route route del default >/dev/null 2>&1 #删除default路由else DEFAULTROUTE=""fi# Standard PPP options we always usePPP_STD_OPTIONS="$IPPARAM $LINKNAME $PLUGIN_OPTS noipdefault noauth default-asyncmap $DEFAULTROUTE hide-password nodetach $PEERDNS mtu $MTU mru $MRU noaccomp noccp nobsdcomp nodeflate nopcomp novj novjccomp user $USER lcp-echo-interval $LCP_INTERVAL lcp-echo-failure $LCP_FAILURE $PPPD_EXTRA" #pppd命令显示信息# PPPoE invocation # pppoe执行命令PPPOE_CMD="$PPPOE -p $PPPOE_PIDFILE -I $ETH -T $PPPOE_TIMEOUT -U $PPPOE_SYNC $CLAMPMSS $ACNAME $SERVICENAME $PPPOE_EXTRA" #pppoe命令显示信息if test "$DEBUG" != "" ; then if test "$DEMAND" != "" ; then echo "(Turning off DEMAND for debugging purposes)" DEMAND="" fi echo "* The following section shows the pppd command we will invoke" >> $DEBUG 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 "* The following section is an extract from your log." >> $DEBUG echo "* Look for error messages from pppd, such as" >> $DEBUG echo "* a lack of kernel support for PPP, authentication failure" >> $DEBUG echo "* etc." >> $DEBUG if test -f "/var/log/messages" ; then echo "Extract from /var/log/messages" >> $DEBUG grep 'ppp' /var/log/messages | tail -150 >> $DEBUG elif test -f "/var/adm/messages"; then echo "Extract from /var/adm/messages" >> $DEBUG grep 'ppp' /var/adm/messages | tail -150 >> $DEBUG else echo "Can't find messages file (looked for /var/{log,adm}/messages" >> $DEBUG fi date >> $DEBUG echo "---------------------------------------------" >> $DEBUG echo "* The following section is a dump of the packets" >> $DEBUG echo "* sent and received by rp-pppoe. If you don't see" >> $DEBUG echo "* any output, it's an Ethernet driver problem. If you only" >> $DEBUG echo "* see three PADI packets and nothing else, check your cables" >> $DEBUG echo "* and modem. Make sure the modem lights flash when you try" >> $DEBUG echo "* to connect. Check that your Ethernet card is in" >> $DEBUG echo "* half-duplex, 10Mb/s mode. If all else fails," >> $DEBUG echo "* try using pppoe-sniff." >> $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 try to" echo "*** figure out what is going on." echo "***" echo "*** Unfortunately, we can NO LONGER accept debugging" echo "*** output for analysis. Please do not send this to" echo "*** Roaring Penguin; it is too time-consuming for" echo "*** us to deal with all the analyses we have been sent." exit 0fiecho $$ > $PIDFILE #将当前脚本的adsl-connect进程号写入pidfile文件中while [ true ] ; do if [ "${DEFROUTE}" != "no" ] ; then DEFRT=`ip route list | awk '/^default / { print $3 }'` [ -n "${DEFRT}" ] && echo $DEFRT > /etc/default-route route del default >/dev/null 2>&1 fi if test "$BR2684DEV" != ""; then $BR2684CTL -b -c $BR2684DEV -a $VPI.$VCI /sbin/ip link set $ETH up fi if test "$LINUX_PLUGIN" != "" ; then $SETSID $PPPD $PPP_STD_OPTIONS $DEMAND & echo "$!" > $PPPD_PIDFILE else $SETSID $PPPD pty "$PPPOE_CMD" \ $PPP_STD_OPTIONS \ $DEMAND \ $PPPD_SYNC & echo "$!" > $PPPD_PIDFILE #记录pppd的pid进程号,此时会覆盖336行写入的adsl-connect的pid,但也不会导致 fi wait if test "$BR2684DEV" != ""; then kill `cat /var/run/nas$BR2684DEV.pid` rm /var/run/nas$BR2684DEV.pid fi # Run /etc/ppp/adsl-lost if it exists test -x /etc/ppp/adsl-lost && /etc/ppp/adsl-lost # Re-establish the connection $LOGGER -p daemon.notice "ADSL connection lost; attempting re-connection." # Wait a bit in case a problem causes tons of log messages :-) sleep 5done
adsl-stop脚本:
#! /bin/bash# Generated automatically from adsl-stop.in by configure.#***********************************************************************## adsl-stop## Shell script to bring down an ADSL connection## Copyright (C) 2000 Roaring Penguin Software Inc.## $Id: adsl-stop.in,v 1.4 2001/04/02 13:59:14 dfs Exp $## This file may be distributed under the terms of the GNU General# Public License.## Usage: adsl-stop [config_file]# If config_file is omitted, defaults to /etc/ppp/pppoe.conf##***********************************************************************export PATH=/sbin:/bin:/usr/sbin:/usr/binLS=/bin/lsNETWORKDIR=/etc/sysconfig/network-scripts# Set to "C" locale so we can parse messages from commandsLANG=Cexport LANGget_device() { if [ ! -d $NETWORKDIR ] ; then $ECHO "** $NETWORKDIR not found" $ECHO "** Quitting" exit 1 fi cd $NETWORKDIR interfaces=$($LS ifcfg-ppp* 2>/dev/null | egrep -v '(~|\.bak)$' | \ egrep -v '(rpmsave|rpmorig|rpmnew)' | sed 's/^ifcfg-//g') for i in $interfaces ; do test -f ifcfg-$i && . ifcfg-$i 2>/dev/null if [ "$TYPE" = "xDSL" ] ; then CONFIG=$NETWORKDIR/ifcfg-$i break fi done}ME="`basename $0`"LOGGER="/usr/bin/logger -t $ME"CONFIG="$1"if [ -z "$CONFIG" ] ; then get_device [ -z "$CONFIG" ] && CONFIG=/etc/ppp/pppoe.conffiif [ ! -f "$CONFIG" -o ! -r "$CONFIG" ] ; then [ "$DEBUG" = "1" ] && echo "$ME: Cannot read configuration file '$CONFIG'" >& 2 exit 1ofi. $CONFIGPPPOE_PIDFILE="$PIDFILE.pppoe"PPPD_PIDFILE="$PIDFILE"STARTPID="$PIDFILE.start"# Backward config file compatibilityif test "$DEMAND" = "" ; then DEMAND=nofi# Ignore SIGTERMtrap "" 15# Check for pidfileif [ -r "$PIDFILE" ] ; then PID=`cat $PIDFILE` # Check if still running kill -0 $PID > /dev/null 2>&1 if [ $? != 0 ] ; then [ "$DEBUG" = "1" ] && echo "$ME: The adsl-connect script (PID $PID) appears to have died" >& 2 fi # Kill pppd, which should in turn kill pppoe if [ -r "$PPPD_PIDFILE" ] ; then PPPD_PID=`cat "$PPPD_PIDFILE"` $LOGGER -p daemon.notice "Killing pppd" [ "$DEBUG" = "1" ] && echo "Killing pppd ($PPPD_PID)" kill $PPPD_PID > /dev/null 2>&1 fi # Kill adsl-start PIDS=`cat $STARTPID` kill -0 $PIDS > /dev/null 2>&1 if [ $? = 0 ] ; then $LOGGER -p daemon.notice "Killing adsl-start" kill $PIDS > /dev/null 2>&1 fi # Kill adsl-connect $LOGGER -p daemon.notice "Killing adsl-connect" [ "$DEBUG" = "1" ] && echo "Killing adsl-connect ($PID)" kill $PID > /dev/null 2>&1 # Kill br2684ctl if necessary if [ -n "$BR2684DEV" -a -r /var/run/nas$BR2684DEV.pid ]; then PIDS=`cat /var/run/nas$BR2684DEV.pid` kill -0 $PIDS > /dev/null 2>&1 if [ $? = 0 ]; then $LOGGER -p daemon.notice "Killing br2684ctl for nas$BR2684DEV" kill $PIDS > /dev/null 2>&1 fi rm -f /var/run/nas$BR2684DEV.pid fi rm -f "$PIDFILE" "$PPPD_PIDFILE" "$PPPOE_PIDFILE" "$STARTPID"else [ "$DEBUG" = "1" ] && echo "$ME: No ADSL connection appears to be running" >&2 exit 1fi# add old default gw backif [ -s /etc/default-route ] ; then route add default gw `cat /etc/default-route` rm -f /etc/default-routefiexit 0
pppoe.conf文件:
USERCTL=yesBOOTPROTO=dialupNAME=DSLppp_0DEVICE=ppp_0TYPE=xDSLONBOOT=noPIDFILE=/var/run/pppoe-adsl.pidFIREWALL=MASQUERADEPING=.PPPOE_TIMEOUT=80LCP_FAILURE=3LCP_INTERVAL=20CLAMPMSS=1412CONNECT_POLL=6CONNECT_TIMEOUT=60DEFROUTE=yesSYNCHRONOUS=noETH=port002PROVIDER=DSLppp_0USER=testPEERDNS=yesDEMAND=no
若是指定接口eth0启动pppoe时,需要修改pppoe.conf文件为:
USERCTL=yesBOOTPROTO=dialupNAME=DSLppp_eth0DEVICE=ppp_eth0TYPE=xDSLONBOOT=noPIDFILE=/var/run/pppoe-adsl.pidFIREWALL=MASQUERADEPING=.PPPOE_TIMEOUT=80LCP_FAILURE=3LCP_INTERVAL=20CLAMPMSS=1412CONNECT_POLL=6CONNECT_TIMEOUT=60DEFROUTE=yesSYNCHRONOUS=noETH=eth0PROVIDER=DSLppp_eth0USER=testPEERDNS=yesDEMAND=no
chap-secrets文件:
# Secrets for authentication using CHAP# client server secret IP addresses####### redhat-config-network will overwrite this part!!! (begin) ################# redhat-config-network will overwrite this part!!! (end) ############test * test *
pap-secrets文件:
# Secrets for authentication using PAP# client server secret IP addresses####### redhat-config-network will overwrite this part!!! (begin) ################# redhat-config-network will overwrite this part!!! (end) ############test * test *
- linux下pppoe脚本分析!
- [PPPOE]RP-PPPOE脚本分析
- Linux下pppoe设置
- Linux下移植PPPOE
- Linux下pppoe设置
- linux 下pppoe配置
- Linux下pppoe设置
- 对linux下pppoe server插件编写的分析(1)
- Linux中PPPOE技术分析
- LINUX下配PPPOE服务器
- linux下pppoe服务器搭建
- LINUX下的PPPOE拨号
- linux 下 PPPOE服务器搭建
- linux下PPPOE拨号共享上网
- linux下PPPOE拨号共享上网
- LINUX下PPPOE服务器限制流量
- Linux/Ubuntu下的PPPoE拨号上网方法
- Linux下的 PPPoE (整理,总结)
- android spinner handleDataChanged的问题
- Android防止按钮连续点击
- 用Fragment构建一个动态UI
- jquery插件pagepiling手机全屏滚动网站
- Android屏幕适配全攻略(最权威的官方适配指导)
- linux下pppoe脚本分析!
- 创建一个Fragment
- js代码程序优化
- git忽略
- hive启动报错:hive1.1.1和0.13的jline的差别
- 构建一个灵活的用户界面
- Kotlin学习之基本数据类型的学习
- c# 扩展方法 奇思妙想 推荐酷。
- 服务器端学习(一) 如何把自己的电脑作为网站服务器