*BSD News Article 33978


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!news.Hawaii.Edu!ames!decwrl!hookup!usc!sdd.hp.com!nigel.msen.com!cybernet.com!root
From: root@cybernet.com (Operator (aka Mark Taylor))
Newsgroups: comp.os.386bsd.misc
Subject: Re: Auto-dialing, Auto-redialing under SLIP [FreeBSD 1.1]
Date: 1 Aug 1994 18:59:24 GMT
Organization: Cybernet Systems, Inc.
Lines: 108
Distribution: world
Message-ID: <31jgmd$a6c@nigel.msen.com>
References: <RICK.94Jul29131023@vox.trystero.com> <31bfmm$1gi@panix2.panix.com>
NNTP-Posting-Host: 192.245.33.55

In article <31bfmm$1gi@panix2.panix.com>, you write:
|> Richard E. Nickle (rick@vox.trystero.com) wrote:
|> 
|> : Hi,
|> 
|> : I had no trouble getting SLIP to run.  I am having some trouble trying to
|> : decide which avenue to take to get SLIP to auto-dial on system boot, and
|> : redial any time I drop carrier.
|> 
|> : Kermit looks like it could do the job, and looking at the script in the
|> : FreeBSD slip FAQ, I see everything there except how to exit from Kermit
|> : gracefully after establishing carrier.  Same with cu.  How do I get a
|> : dialer to exit gracefully without dropping carrier?  The only thing I've
|> 
|> try sending the modem at&q0, which shouldinitialize the modem in a way 
|> that kermit will not drop carrie on exit.


I use the command "AT&C1&D0" in my Kermit-based SL/IP setup script.
The &C1 tells the modem's carrier detect wire to follow the state of the
carrier signal.  The &D0 tells the modem to ignore DTR.  This is for
when Kermit is done and closes the connection (dropping DTR in the
process), the modem will ignore it and continue.

Here is my Kermit SL/IP login script file:

#!/usr/local/bin/kermit
!ps -ax | grep sla | grep -v grep | awk '/slattach/{print $1}' | xargs kill
IF SUCCESS ECHO killed the slattach deamon
ELSE ECHO no slattach deamon found
SET LINE /dev/cua00
IF FAILURE EXIT
SET FLOW KEEP
SET INPUT ECHO ON
SET TRANSMIT ECHO ON
SET MODEM-DIALER HAYES
SET SPEED 57600
SET DUPLEX FULL
SET PARITY NONE
SET INPUT TIMEOUT-ACTION PROCEED
SET TERMINAL BYTESIZE 8
echo \10Setting up modem...
OUTPUT +++
PAUSE 1
OUTPUT AT&C1&D0\13\10
INPUT 5 OK
#if we fail in diailing the remote, then we MUST redial, because we've killed
# the slattach that spawned us...
:DIALAGAIN
#force the modem on hook
OUTPUT +++
PAUSE 1
OUTPUT ATH0\13\10
INPUT 5 OK
#if we fail in diailing the remote, then we MUST redial, because we've killed
# the slattach that spawned us...
:DIALAGAIN
#force the modem on hook
OUTPUT +++
PAUSE 1
OUTPUT ATH0\13\10
INPUT 5 OK
echo \10Dialing modem...
DIAL 5555555
IF FAILURE GOTO DIALAGAIN
echo \10Logging on remote...
INPUT 40 host:
IF FAILURE GOTO DIALAGAIN
OUTPUT slip\13
INPUT 10 login:
IF FAILURE GOTO DIALAGAIN
OUTPUT XXXXXX\13
INPUT 10 ssword:
IF FAILURE GOTO DIALAGAIN
OUTPUT YYYYYYY\13
INPUT 10 beginning...
IF FAILURE GOTO DIALAGAIN
!/sbin/slattach -a -s 57600 -r '/usr/local/bin/slip-up > /dev/console 2>& 1' /dev/cua00
!/sbin/ifconfig sl0 inet my-hostname slip-servername netmask 0xffffff00 metric 1
!/sbin/route add default slip-servername
echo \10The SL/IP connection is UP!
echo (\10\10It may take up to 60 seconds for the new route to become active.)
EXIT


I call the script file "/usr/local/bin/slip-up".

A brief description of how it works:

First it kills ANY slattach process currently running.  This will kill its parent
(read on).  Then it sets up the modem's paramters, followed by the AT commands to
set the modem to the correct DTR and CD-following status.  If at any time things
go bad, it will timeout and keep trying forever to connect.  If it succeeds in dialing,
then it will wait for the "host:" prompt, and finish logging in.  After logging in,
it starts up a slattach process which uses the "-r" parameter ("use this command to
redial").  That is why the slattach process has to be killed in the second line of
the script file (we don't want lots of slattach processes running around).  Then the
script adds the routes and configures the SL/IP interface.

This script seems to work fine for automatic redial upon carrier loss, but sometimes
fails on startup from /etc/rc.local (so I'm told).  I'll figure that one out later.


Any questions, please feel free to e-mail or post more news.


-Mark Taylor
mtaylor@cybernet.com