Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.mel.connect.com.au!munnari.OZ.AU!news.Hawaii.Edu!news.uoregon.edu!spring.edu.tw!serv.hinet.net!netnews.hinet.net!news From: vcba79@ms1.hinet.net (Vincent Chen) Newsgroups: comp.unix.bsd.freebsd.misc Subject: dialup access troubles? Date: Thu, 07 Nov 1996 20:55:39 GMT Organization: Vincent Research Lines: 229 Message-ID: <328247da.1389618@netnews.hinet.net> NNTP-Posting-Host: 168.95.103.186 X-Newsreader: Forte Free Agent 1.1/32.230 Hello, I got dialup internet access troubles here, both slip & ppp. :-( Here is the problems: 1. bsd dip 1.02 package can let me connect to internet. But it only clean default route when use 'dip -k' command to hangup. Is it normal to delete the other peertopeer route entry manually everytime? 2. I am trying to use kernel process ppp to access internet. dialup and chat is ok. But ppp daemon always give me 'lcp config request time out'. The dial up script are ported from my linux box and worked fine on that machine. Here is the related files: --- chat script --- ABORT BUSY ABORT "NO CARRIER" "" ATZ OK ATS7=45 OK ATDTxxx-xxxx CONNECT "" username: (username) password: (password) --- option file --- -pap modem crtscts asyncmap 0 passive noipdefault defaultroute --- shell script --- #!/bin/sh # # Create by: Vincent Chen # Version: 1.0 # Date: Nov 8,1996 # Platform: FreeBSD 2.1.5 Release # DEVICE=cuaa1 LOCKDIR=/var/spool/lock PIDFILE=/var/run/ppp0.pid SCRIPTDIR=/usr/local/lib/dialup STOPWATCH=/usr/local/bin/stopwatch LOGFILE="$HOME/Dialup" CMD=`expr //$0 : '.*/\(.*\)'` MAX=10 UPTIME=10 BAUD=57600 # # Remove lock file of serial device # # Function: unlock <serial device> # # Return value: 0 - Successful # 1 - Can't remove lockfile # 2 - Device not locked # unlock() { if [ -f $LOCKDIR/LCK..$1 ] then if rm -f $LOCKDIR/LCK..$1 then return 0 else return 1 fi else return 2 fi } # # Function: CheckDevice # # Return value: 0 - PPP is up # 1 - PPP is not up after specified interval # CheckDevice() { TIME=1 while [ $TIME -le $UPTIME ]; do sleep 1 if ifconfig ppp0 | grep -qw RUNNING then return 0 else TIME=`expr $TIME + 1` fi done return 1 } # # Function: Disconnect # # Return value: 0 - terminated successfully # 1 - ppp daemon not running # 2 - failed to unlock serial device # Disconnect() { STATUS=0 if [ -f $PIDFILE ] then kill -INT `cat $PIDFILE` else STATUS=1 fi if [ -f $LOCKDIR/LCK..$DEVICE ] then if [ ! unlock $DEVICE ] then STATUS=2 fi fi return $STATUS } # # Function: Connect # # Return value: 0 - connect to ppp server successfully # 1 - ppp device not created # 2 - chat failed to make connection # 3 - failed to change ownership of serial device # Connect() { if [ -f $LOCKDIR/LCK..$DEVICE ] then unlock $DEVICE fi stty -f /dev/$DEVICE $BAUD crtscts -tostop -parity -cstopb ( if chat -f $SCRIPTDIR/chat.$1 then pppd /dev/$DEVICE $BAUD file $SCRIPTDIR/options.$1 & if CheckDevice then return 0 else return 1 fi else return 2 fi ) < /dev/$DEVICE > /dev/$DEVICE } PPP-OFF() { Disconnect LAST=$? case $LAST in 0) echo -e "PPP link terminated.\n" ;; 1) echo -e "PPP daemon not running.\n" ;; 2) echo -e "Failed to unlock serial device.\n" ;; esac } echo echo "PPP client script version 1.0 by Vincent Chen" echo COUNT=1 if [ "$CMD" = "pppstop" ] then PPP-OFF echo "ppp `${STOPWATCH} off`" >> $LOGFILE echo -e "This call: `tail -n 1 $LOGFILE | cut -f 9 -d " "`\n" exit 0 fi if [ -z $1 ] then echo -e "Usage: startppp host\n" exit 0 fi if [ ! -f $SCRIPTDIR/chat.$1 ] then echo -e "Sorry, I don't know how to deal with host '$1'\n" exit 1 fi while [ $COUNT -le $MAX ]; do sleep 3 echo -n " Server: $1, Attempts: $COUNT, Status: " Connect $1 case $? in 0) echo -e "Successful.\n" ; ${STOPWATCH} on ; exit 0 ;; 1) echo -e "PPP device not connected.\n" ; PPP-OFF ; exit 1 ;; 2) echo "Not connected." ;; esac COUNT=`expr $COUNT +1` done echo --- end of shell script -- Any help would be appreciated. ----- Vincent Chen E-mail address: vcba79@ms1.hinet.net Taipei,Taiwan R.O.C.