|
From: Dominko V. <dom...@ya...> - 2007-02-15 11:57:19
|
Hi
I have tested ADSL with pppoe and found problem to connect. Flowing changes should be made in scripts pppoe-status and pppoe-start:
pbx sbin # cat pppoe-status
#!/bin/sh
#***********************************************************************
#
# pppoe-status
#
# Shell script to report on status of PPPoE connection
#
# Copyright (C) 2000-2001 Roaring Penguin Software Inc.
#
# $Id: pppoe-status,v 1.1 2005/08/09 02:49:18 dfs Exp $
#
# This file may be distributed under the terms of the GNU General
# Public License.
#
# LIC: GPL
#
# Usage: pppoe-status [config_file]
# If config_file is omitted, defaults to /etc/ppp/pppoe.conf
#
#***********************************************************************
# Defaults
CONFIG=/etc/ppp/pppoe.conf
case "$#" in
1)
CONFIG="$1"
;;
esac
if [ ! -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"
if [ "$DEMAND" != "no" ] ; then
echo "Note: You have enabled demand-connection; pppoe-status may be inaccurate."
fi
# If no PPPOE_PIDFILE, connection is down, unless we're using the Linux plugin
if [ "$LINUX_PLUGIN" = "" ] ; then
if [ ! -r "$PPPOE_PIDFILE" ] ; then
echo "pppoe-status: Link is down (can't read pppoe PID file $PPPOE_PIDFILE)"
exit 1
fi
fi
# If no PPPD_PIDFILE, something fishy!
if [ ! -r "$PPPD_PIDFILE" ] ; then
echo "pppoe-status: Link is down (can't read pppd PID file $PPPD_PIDFILE)"
exit 1
fi
PPPD_PID=`cat "$PPPD_PIDFILE"`
# Sigh. Some versions of pppd put PID files in /var/run; others put them
# in /etc/ppp. Since it's too messy to figure out what pppd does, we
# try both locations.
for i in `ls /var/run/ppp*.pid` ; do
if [ -r $i ] ; then
PID=`cat $i`
if [ "$PID" = "$PPPD_PID" ] ; then
IF=`basename $i .pid`
#netstat -rn | grep " ${IF}\$" > /dev/null
/sbin/ifconfig $IF | grep "UP.*POINTOPOINT" > /dev/null
if [ "$?" != "0" ] ; then
echo "pppoe-status: Link is attached to $IF, but $IF is down"
exit 1
fi
echo "pppoe-status: Link is up and running on interface $IF"
/sbin/ifconfig $IF
exit 0
fi
fi
done
echo "pppoe-status: Link is down -- could not find interface corresponding to"
echo "pppd pid $PPPD_PID"
exit 1
pbx sbin # cat pppoe-start
#!/bin/sh
# ../scripts/pppoe-start. Generated from pppoe-start.in by configure.
#***********************************************************************
#
# pppoe-start
#
# Shell script to bring up a PPPoE connection
#
# Copyright (C) 2000 Roaring Penguin Software Inc.
#
# $Id: pppoe-start.in,v 1.2 2005/08/10 00:25:19 dfs Exp $
#
# This file may be distributed under the terms of the GNU General
# Public License.
#
# LIC: GPL
#
# Usage: pppoe-start [config_file]
# pppoe-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=/usr
# Paths to programs
CONNECT=/usr/sbin/pppoe-connect
ECHO=/bin/echo
IFCONFIG=/sbin/ifconfig
# Set to "C" locale so we can parse messages from commands
LANG=C
export LANG
# 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
$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 ifconfig -a" >> $DEBUG
$IFCONFIG -a >> $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
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
CONFIG1=$CONFIG
export CONFIG
. $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 a PPPoE connection up (PID $PID)" >& 2
exit 1
fi
# Delete bogus PIDFILE
rm -f "$PIDFILE" "$PIDFILE.pppd" "$PIDFILE.pppoe" "$PIDFILE.start"
fi
echo $$ > $PIDFILE.start
# 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
/usr/sbin/pppoe-status $CONFIG1 > /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
if test -n "$FORCEPING" ; then
printf "%s" "$FORCEPING"
else
tty -s && printf "%s" "$PING"
fi
sleep $CONNECT_POLL
TIME=`expr $TIME + $CONNECT_POLL`
if [ $TIME -gt $CONNECT_TIMEOUT ] ; then
break
fi
done
$ECHO "TIMED OUT" >& 2
# Timed out! Kill the pppoe-connect process and quit
kill $CONNECT_PID > /dev/null 2>&1
# Clean up PIDFILE(s)
rm -f "$PIDFILE" "$PIDFILE.pppd" "$PIDFILE.pppoe" "$PIDFILE.start"
exit 1
---------------------------------
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos. |
|
From: Kristian K. <kri...@gm...> - 2007-02-15 19:20:27
|
On 2/15/07, Dominko Vrljic <dom...@ya...> wrote: > Hi > I have tested ADSL with pppoe and found problem to connect. Flowing changes > should be made in scripts pppoe-status and pppoe-start: > Dominiko, Great work. Is there any chance that you can send me these files as an attachment (or maybe a patch)? Thanks! -- Kristian Kielhofner |