Subject: Re: pppd/chat and tty00
To: Darren Steven <D.Steven@its.amc.edu.au>
From: Henric Jungheim <henric@zoom.com>
List: amiga
Date: 01/04/1996 23:31:21
I've set up my computer so that it connects (and stays connected) whever 
I'm running NetBSD and the modem is on (so, I go on- and off- line by 
turning the modem on and off).  This is fine if one has both a flat-fee 
phone line and a flat-fee ISP. :)

Basically, I have 'init' run a script on the line that I want to run the 
modem on... so my /etc/ttys file begins like this:
-----------------
#
# name  getty                           type    status          comments
#
# If the console is marked insecure, single-user requires
# the root password.
console "/usr/libexec/getty Pc"         vt200   off secure
ttye0   "/usr/libexec/getty Pc"         vt200   on secure       # custom 
chips
ttye1   "/usr/libexec/getty Pc"         vt200   off secure      # retina
ttym0   "/etc/zoom/zoom.tty"            dialup  on rtscts
...etc...

-----------------

Then /etc/zoom/zoom.tty looks like this:
-----------------
#!/bin/sh
stty -f /dev/ttym0 hupcl
sleep 2
/usr/sbin/pppd ttym0 38400 -detach debug defaultroute netmask 
255.255.255.0 connect /etc/zoom/zoom.connect
-----------------

I don't think either the stty or the sleep are needed.  (Also, the last 
two lines are supposed to be on one line).  Anyway, then zoom.connect 
looks like:
-----------------
#!/bin/sh
until /usr/sbin/chat -r /tmp/zoom.out -f /etc/zoom/zoom.chat
        do
done
-----------------

And zoom.chat (minus my password):
-----------------
TIMEOUT 15
REPORT BUSY
REPORT VOICE
REPORT RING
REPORT FAX
REPORT 'NO CARRIER'
REPORT CARRIER
REPORT CONNECT
REPORT COMPRESSION
REPORT PROTOCOL
ABORT 'NO CARRIER'
ABORT 'Login incorrect'
ABORT BUSY
ABORT VOICE
ABORT RING
ABORT FAX
""
ATZ
OK
ATS7=255
OK
atdt<insert phone number here>
TIMEOUT 30
ogin:
<insert user name here>
assword:
<insert password here>
"PPP session from " 
-------------

All the script files should be chmod'ed to 'x'.  And files should probably
not be readable by anybody but root. 

Also, my /etc/ppp/options file:
-------------
modem
crtscts
lock
asyncmap 0
mru 1000
-------------
I can't say that I can remember why I set mru to 1000... hmmm.

One more thing... I like to use named, but it is annoying when PPP is not 
up, so I reconfigure my /etc/resolv.conf file in my /etc/ppp/ip-up and 
/etc/ppp/ip-down scripts.  I think there must be a better way to do this 
(the file is only relevant when a program starts)...

Anyway, ip-up fixes my resolv.conf file and loads the time from a ntp server:
--------------
#!/bin/sh
cp /etc/resolv.conf.ns /etc/resolv.conf
/usr/local/bin/ntpdate >>/tmp/ntpdate.log <insert some time servers here>
-------------
ip-down is quite similar.  I'll leave that as an exercise for the reader.

I'm using the global ip-up/down scripts to do this; it would be better to 
specify different scripts when invoking pppd (but I'm the only person 
using this machine).

One *very* last thing:  mail gets out quicker if one sets a "smarter 
host" in /etc/sendmail.cf.  All outgoing mail will then be sent through 
this machine. I use:
-------------
# "Smart" relay host (may be null)
DSmail-relay.zoom.com
------------

Good luck...  constructive criticism welcome (of course).

-------- Henric Jungheim  -------------------  henric@zoom.com --------