*BSD News Article 30342


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!yeshua.marcam.com!MathWorks.Com!panix!not-for-mail
From: wpaul@panix.com (Bill "This is a close-up?!" Paul)
Newsgroups: comp.os.386bsd.questions
Subject: Re: SLIP Autodialer for FreeBSD
Date: 14 May 1994 16:57:11 -0400
Organization: The M00se Illuminati (bl00p!)
Lines: 101
Message-ID: <2r3dv7$qg3@panix2.panix.com>
References: <Cpq61q.GB7@crash.cts.com> <Cpsy12.Mz1@mv.mv.com>
NNTP-Posting-Host: panix2.panix.com
X-Newsreader: TIN [version 1.2 PL2]

Daring to challenge the will of the almighty Leviam00se, Coranth Gryphon
(shaman@mv.mv.com) had the courage to say:
: On a related topic, does anyone out there have a program
: which will do the dialing and login-script negotiation for
: a slip line. What I want to do is put it in a cron job
: that will check for the active line (using ping) then
: if it is down, run the above dialin, then do the rest 
: of the slip setup (which I already have in a script).

: Binary for FreeBsd (1.0.2 soon to be 1.1) would be OK,
: or source (with what needs to be set to compile under FreeBSD).

: Thanx in advance.

: -coranth


: VoiceMail/Pager: (603) 599-0357	  Phone: (603) 424-1333

Well, the slattach program as it is in FreeBSD 1.1 (and 1.1-BETA and GAMMA)
allows you to specify a script to be run whenever the carrier detect line
changes state (indicating that the modem has hung up and it needs to redial).

This means that slattach has the capability of redialing for you: you don't
need to set up a seperate cron job to keep the connection alive.

The only think you need to decide on is what program you want to use to
reestablish the connection. I find that C-Kermit handles the job pretty
well. (IMHO, no UNIX system is complete until it has C-Kermit installed. :)
Here's a script that I use to connect my system to an Annex SLIP/PPP
server (please strip the comments when creating your own script):

 
SET LINE /dev/cua00       < Set serial device to use
SET SPEED 38400           < Set DTE speed
OUTPUT AT&D0\13           < This is a hack which I'll explain below
INPUT 5 OK                < Check for "OK" response from modem
OUTPUT ATDT 5551234\13    < Place the phone number of your slip server here
INPUT 20 now              < The Annex server says: "Type SLIP or PPP now."
OUTPUT SLIP\13            < The script replies with "SLIP"
INPUT 10 Username:        < Check for "Username:" prompt
OUTPUT USERNAME\13        < Replace USERNAME with your remote username
INPUT 10 Password:        < Check for "Password:" prompt
OUTPUT PASSWORD\13        < Replace PASSWORD with your remote passworsd
INPUT 10 Annex            < Check for startup message from server
EXIT                          (contains the word 'Annex' so I search for that)

The AT&D0 is an ugly kludge: it tells the modem to ignore DTR. I needed this
because Kermit seems to toggle DTR when it exits. This makes the modem
hang up and causes slattach to get stuck in an infinite look of dialup
retries. You might want to change the line that waits for 'now' to
actually wait for the 'CONNECT' message from your modem instead. This
all depends on how your SLIP server works. Same for the last line that
waits for the word 'Annex'. Your machine might respond with some other
message to indicate that it has switched to SLIP mode, so there's a very
good chance you'll have to change this too.

Once you've got the script tailored for your setup, save it to a file;
I used /root/slipdial for mine. Don't forget to set the permissions so
that only root can read the file, otherwise other users will be able to
see your slip server login info. I then invoke slattach like this:

slattach -a -h -r "kermit -y /root/slipdial > /dev/null" -z -s38400 /dev/cua00

The -a autoenables VJ header compression, which I need since my server
uses compression.

The -h enables hardware (cts/rts) flow control. You might not need this,
but I have my modem configured to use it so I do.

The -r "kermit -y /root/slipdial > /dev/null" is the redial command I
want slattach to use. It invokes C-Kermit with /root/slipdial as its
script file and sends the output to the bit bucket 'cause I don't like
looking at it.

The -z tells slattach that I want the redial command executed on startup.
Therefore, I always use slattach to initiate my slip connection for me
rather than dialing into my slip server with some other program first and
invoking slattach once the connection is established (which is what I used
to do).

My modem's DTE speed is locked at 38400 so I use -s38400 to inform
slattach of this and I use /dev/cua00 as my SLIP device.

This setup will cause slattach to automatically try to redial my slip
server whenever the connection goes down. It will also keep trying if
it encounters a busy signal, which I occaisionally do.

Note that I believe pppd has a similar feature built into it. Check the
man pages on slattach and pppd for more information.

Hope this helps.

-Bill
--
 _      /\      _            Join the
/ \_/\_/  \_/\_/ \  .----.   M00se Illuminati   Bill Paul 
\_____/ () \_____/ (bl00p!)  Face it: wouldn't  <Big City M00se>
     /      \       `----'   you feel much      wpaul@panix.com   -or-
    /  \__/  \    --'        safer?             ghod@drycas.club.cc.cmu.edu
   /__________\