Subject: Re: slip or ppp setup
To: Bill Studenmund <wrstuden@loki.stanford.edu>
From: Ken Nakata <kenn@remus.rutgers.edu>
List: macbsd-general
Date: 07/08/1995 00:05:40
> Does anyone have instructions, or know where good ones are, telling how
> to set up either slip or ppp?
> 
> I've found the SLIP-how-to on the ftp site at cray-ymp, but it goes
> from the point of being able to have cu talk to the modem. I always
> get a write error, then cu exits. :-(

If you can use PPP instead of SLIP, it's much easier to configure.
The followings are my scripts for PPP that I used to use until
recently (I moved and cancelled my PPP service from a local ISP):

*** File: /usr/local/sbin/ppp-up
*** shell script to bring up PPP
*** Usage: ppp-up

#!/bin/sh
# ppp-up - start pppd and enable resolver
#
PPPDIR=/usr/local/etc/ppp
NUMBERLIST=$PPPDIR/numberlist
LOGIN=$PPPDIR/login
CHATSCRIPT=$PPPDIR/chat-script
#
if [ -f /etc/resolv.conf ]; then
  mv /etc/resolv.conf /etc/_resolv.conf
fi
#
echo connecting...
pppd /dev/tty00 38400 passive crtscts modem defaultroute lock lcp-echo-interval 30 lcp-echo-failure 10 netmask 255.255.255.0 domain my.domain mtu 1500 name myname connect "ppp-connect $NUMBERLIST $LOGIN $CHATSCRIPT"
#
if [ -f /etc/_resolv.conf ]; then
  echo -n enabling resolver...
  mv /etc/_resolv.conf /etc/resolv.conf
  echo done
fi

*** File: /usr/local/sbin/ppp-down
*** shell script to bring down PPP
*** Usage: ppp-down

#!/bin/sh
p=`cd /proc; grep -l '^pppd' */status | sed 's,^\([0-9]*\)/.*$,\1,'`
#
if [ -n "$p" ]; then
  echo -n killing pppd...
  kill $p
  echo done
else
  echo ppp already is down 1>&2
fi
#
if [ -f /etc/resolv.conf ]; then
  echo -n disabling resolver...
  mv /etc/resolv.conf /etc/_resolv.conf
  echo done
fi

*** File: /usr/local/libexec/ppp-connect
*** shell script called by pppd to connect
*** Usage: ppp-connect numberlist-file login-file chat-script-template-file

#!/bin/sh
#
# usage: ppp-connect <number-list> <login> <template chat script>
if [ $# -ne 3 ]
then
  echo 'usage: ppp-connect <number-list> <login> <template chat script>' 1>&2
  exit 1
fi
#
stty -clocal
umask 077
#
NUMBERLIST=`cat $1`
#
NUMBER=${NUMBERLIST%%:*}
NUMBERLIST=${NUMBERLIST#*:}:$NUMBER
#
until (sed -e "s/\$NUMBER/$NUMBER/g" -f $2 $3 >/tmp/chat-script; chat -f /tmp/chat-script)
do
  NUMBER=${NUMBERLIST%%:*}
  NUMBERLIST=${NUMBERLIST#*:}:$NUMBER
done
rm -f /tmp/chat-script

*** File:/usr/local/etc/ppp/numberlist
*** colon-delimited list of phone numbers of dial-in

aaaxxxx:bbbyyyy:ccczzzz:dddwwww

*** File:/usr/local/etc/ppp/login
*** file that contains login name and password, in sed command format
*** You substitute "Suser" for your user name for PPP login
*** "password" for your password

s/\$LOGIN/Suser/g
s/\$PASSWD/password/g

*** File:/usr/local/etc/ppp/chat-script
*** "chat" script file template
*** this is used after $NUMBER, $LOGIN and $PASSWD are substituted for
*** their real values

ABORT BUSY ABORT "NO CARRIER" "" "AT&F1" OK "ATDT$NUMBER" CONNECT "" ogin:--ogin: $LOGIN ssword: $PASSWD

*** End of included files ***

Notes:

The tedious ppp options could be put into /etc/ppp/options file.  I
just didn't.

/tmp/chat-script is created before executed, in order to
prevent other users from seeing login and passwd passed as command
arguments (they could be seen by other users using ps if they were
passed as command arguments).

Ppp-up and -down mv resolv.conf around to prevent programs from trying
to resolve when PPP isn't up.  It would be unnecessary if NetBSD
supported FreeBSD-style /etc/host.conf mechanism.

You will most likely need to tailor the files a little bit.
In my case, I can log in to my ISP with login "Sxxxx" where xxxx is my
normal login, and my normal password, and PPP is up.  It may be
different in your case.  For example, at my school, I have to use
login command on terminal server first, then use slip command next.
Your system may use something similar, or maybe very different
method.

Oh, these scripts are hereby placed under public domain.  Feel free to
use, modify, or distribute.

Hope this helps a bit,

kenn