Return to BSD News archive
Xref: sserve comp.os.386bsd.questions:12323 comp.os.386bsd.misc:3185
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msuinfo!agate!howland.reston.ans.net!math.ohio-state.edu!jussieu.fr!univ-lyon1.fr!frmug.fr.net!renux.frmug.fr.net!keltia.frmug.fr.net!not-for-mail
From: roberto@keltia.frmug.fr.net (Ollivier Robert)
Newsgroups: comp.os.386bsd.questions,comp.os.386bsd.misc
Subject: Re: FreeBSD 1.1.5.1: Serial port problems [LONG]
Date: 12 Aug 1994 21:31:21 +0200
Organization: A Happy FreeBSD 1.1.5 Usenet Site
Lines: 300
Message-ID: <32gimn$1r7@keltia.frmug.fr.net>
References: <32c0kr$94d@Mercury.mcs.com> <ASAMI.94Aug10210427@forgery.cs.berkeley.edu>
Reply-To: roberto@hsc.fr.net (Ollivier Robert)
NNTP-Posting-Host: keltia.frmug.fr.net
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Summary: PPP & SLIP setup [LONG]
In article <ASAMI.94Aug10210427@forgery.cs.berkeley.edu>,
Satoshi ASAMI <asami@cs.berkeley.edu> wrote:
> * PS> Anyone know of a document that describes, step by step, how to get
> * PPP running under FreeBSD 1.1.5.1? Sorry if this is a FAQ...
>
> I hope someone writes it....
Here is what I did for my system to get PPP and SLIP working. A bit long
but I hope useful. I've sent it to a few people but never here.
Beware that all device names are for 1.1.5.1 and the new convention
(initial and locked devices).
------------------------------------------------------------
For all the IP address used here, I replaced the real one by the officially
never-routed ones (RFC 1597) because my official C-class network is not
connected and not announced. So replace the addresses below by the one you
have.
=============================== PPP ==================================
OK, here is my current setup for both dialin and dialout PPP.
dialout
=======
The device is a SupraFAXModem V.32bis on COM1.
/sys/i386/conf/kernel_definition_file
------------------------------------------------------------
#For high speed serial lines.
device sio0 at isa? port "IO_COM1" tty irq 4 vector siointr
------------------------------------------------------------
/etc/rc.local (haven't converted to rc.serial yet)
------------------------------------------------------------
echo -n 'Local comm ports setup: '
if [ -x /bin/stty ]; then
/bin/stty -f /dev/ttyi00 38400 crtscts hupcl
/bin/stty -f /dev/ttyl00 38400 crtscts hupcl
echo 'tty00: RTS/CTS enabled'
fi
------------------------------------------------------------
/etc/ttys
------------------------------------------------------------
tty00 "/usr/libexec/getty supra.38400" vt100 on
------------------------------------------------------------
/etc/gettytab relevant entries
------------------------------------------------------------
S|supra.38400|supra-38400:\
:sp#38400:ap:cs#8:xa:np:hw:\
:if=/etc/issue.modem:\
:im=\r\n\r\n*** Welcome to Keltia ***\
\r\nFreeBSD unix, dialup access\r\n:lm=\r\n%h login\72 :
------------------------------------------------------------
ps ax | grep getty
------------------------------------------------------------
PID TT STAT TIME COMMAND
4485 ?? I 0:00.06 /usr/libexec/getty supra.38400 tty00
------------------------------------------------------------
/dev entries:
------------------------------------------------------------
crw-rw---- 1 uucp dialer 28, 128 Jun 9 00:36 /dev/cua00
crw------- 1 root wheel 28, 0 Jun 8 22:28 /dev/tty00
------------------------------------------------------------
Here is the following script I call to initiate the PPP connection. It uses
an Annex terminal server without authentification. Modify the chat script
to suit your site's configuration.
/usr/local/sbin/pppup
------------------------------------------------------------
#!/bin/sh
LOCKDIR=/var/spool/lock
DEVICE=cua00
if [ -f $LOCKDIR/LCK..$DEVICE ]
then
echo "PPP device is locked"
exit 1
fi
/usr/libexec/pppd -vj defaultroute crtscts -d connect 'chat -v -l LCK..cua00 ABORT "NO CARRIER" ABORT BUSY "" ATZ1 OK ATDTnnnnnnnn CONNECT "" annex: ppp' netmask 255.255.255.0 /dev/$DEVICE 38400
------------------------------------------------------------
after that I do POP (in), SMTP (out), and so on. To close cleanly the
connection, I call the following script :
------------------------------------------------------------
kill -1 `cat /var/run/ppp0.pid`
------------------------------------------------------------
if you have both address known and fixed (between you and a friend for
example) you can add both addresses at the end of the pppd command line as
below:
/usr/local/sbin/pppup.known
------------------------------------------------------------
#!/bin/sh
LOCKDIR=/var/spool/lock
DEVICE=cua00
if [ -f $LOCKDIR/LCK..$DEVICE ]
then
echo "PPP device is locked"
exit 1
fi
/usr/libexec/pppd -vj defaultroute crtscts -d connect 'chat -v -l LCK..cua00 ABORT "NO CARRIER" ABORT BUSY "" ATZ1 OK ATDTnnnnnnnn CONNECT "" annex: ppp' netmask 255.255.255.0 /dev/$DEVICE 38400 keltia-ppp.frmug.fr.net:renux-ppp.frmug.fr.net
------------------------------------------------------------
(renux is a Linux site of a friend of mine, I get a lot of News and E-mail
from him).
Or you may also omit one of the end addresses if you want ot pick the
other's default.
dialin
======
The getty process sleeps as chown before. I have a special without
password Ptest PPP account :
/etc/master.passwd
------------------------------------------------------------
Ptest:*:700:14:Test PPP:/:/etc/ppp/ppp-login-test
------------------------------------------------------------
In /etc/ppp I have several shell scripts named ppp-login-<site> and the test
one is :
/etc/ppp/ppp-login-test
------------------------------------------------------------
#!/bin/sh
trap 1 2 3
echo "connexion PPP, salut testeur."
exec /usr/libexec/pppd -d crtscts -detach modem netmask 255.255.255.0 keltia-ppp:keltia-guest
------------------------------------------------------------
I have the following DNS entries for keltia-ppp and keltia-guest :
Name: keltia-ppp.frmug.fr.net
Address: 192.168.0.1
Name: keltia-guest.frmug.fr.net
Address: 192.168.0.254
With that, I have no problem using Mosaic, NFS, POP and all other TCP/IP
services. And UUCP of course, which give me all the News I want.
If anyone has questions, just ask.
==================================== SLIP ============================
For SLIP:
========
The kernel definition file, the /etc/rc.local, /etc/gettytab, /etc/ttys and
/dev entries are as above of course.
Dialout
=======
SLIP dialout is less easier and I have not yet found a way to automate it
entirely (I got Linux's dip and should probably look into expect) as I got
my PPP setup running faster :-)
Two cases:
1. the adresses are fixed, easy setup. The chat script connects you and
after that, you launch slattach and establishe the route properly (your
mileage and setup may vary of course).
------------------------------------------------------------
#!/bin/sh
#
LOCKDIR=/var/spool/lock
DEVICE=cua00
PHONE=nnnnnnnn
USER=Skeltia
PASSWORD=something_secret
OUR_IP_ADDR=192.168.0.1
OTHER_IP_ADDR=192.168.0.2
if [ -f $LOCKDIR/LCK..$DEVICE ]
then
echo "PPP device is locked"
exit 1
fi
(
if chat -v -l LCK..$DEVICE ABORT "NO CARRIER" ABORT BUSY "" ATZ1 OK ATDT$PHONE CONNECT "" ogin: $USER ssword: \\q$PASSWORD
then
/sbin/slattach -a -h -s 38400 /dev/$DEVICE
/sbin/ifconfig sl0 inet $OUR_IP_ADDR $OTHER_IP_ADDR netmask 255.255.255.0 -trailers
/sbin/route add default $OUR_IP_ADDR
exit 0
fi
) < /dev/$DEVICE > /dev/$DEVICE
------------------------------------------------------------
2. your address is not fixed (remember the terminal server Annex I told you
before ?). You have to have a way to dial and ask (generally by issuing a
special command like "slip" to enable SL/IP on the router.
When you have the last digit of your assigned address e.g. 22, you run the
following script with 22 as argument:
# connect-slip 22
connect-slip
------------------------------------------------------------
#!/bin/sh
DEVICE=cua00
# fake class-B address just for show
PHONE=nnnnnnnn
OUR_IP_ADDR=172.16.0.$1
ANNEX=172.16.0.130
OTHER_NET=172.17
ANNEX_NET=172.16
/sbin/slattach -a -h -s 38400 /dev/$DEVICE
/sbin/ifconfig sl0 inet $OUR_IP_ADDR $ANNEX netmask 255.255.255.128 -trailers
/sbin/route add default $OUR_IP_ADDR
#/sbin/route add -net $OTHER_NET $OUR_IP_ADDR
#/sbin/route add -net $ANNEX_NET $OUR_IP_ADDR
------------------------------------------------------------
I generally used cu to connect on the other end (it was when PPP was not
available due to changes in sio long ago) and I don't have ready-to-use
scripts for that. Jordan, you have some scripts if I remember well ?
Dialin:
=======
Dialin is easier than dialout.
I have an entry in my password file for each of the site.
------------------------------------------------------------
Srenux:*:82:12:renux SLIP:/:/usr/sbin/sliplogin
Sgwynedd:*:83:12:gwynedd SLIP:/:/usr/sbin/sliplogin
------------------------------------------------------------
I have in /etc three files (described in the manual of slattach):
/etc/slip.hosts which describe each hosts with the netmask, both address
and the options (compress, no compress and auto-recognition of compression)
------------------------------------------------------------
Sgwynedd keltia-slip gwynedd-slip 0xffffff00 compress
Srenux keltia-slip renux-slip 0xffffff00 autocomp
------------------------------------------------------------
/etc/slip.login which is the script run by sliplogin at log-in
------------------------------------------------------------
#!/bin/sh -
#
# @(#)slip.login 5.1 (Berkeley) 7/1/90
#
# generic login file for a slip line. sliplogin invokes this with
# the parameters:
# 1 2 3 4 5 6 7-n
# slipunit ttyspeed loginname local-addr remote-addr mask opt-args
#
/sbin/ifconfig sl$1 inet $4 $5 netmask $6 -trailers
/sbin/route add $5 $4
exit
------------------------------------------------------------
and of course /etc/slip.logout
------------------------------------------------------------
#
# @(#)slip.login 5.1 (Berkeley) 7/1/90
#
# generic login file for a slip line. sliplogin invokes this with
# the parameters:
# 1 2 3 4 5 6 7-n
# slipunit ttyspeed loginname local-addr remote-addr mask opt-args
#
# slattach /dev/tty02 $2
/sbin/ifconfig sl$1 down
/sbin/route delete $5 $4
exit
------------------------------------------------------------
I know my PPP entry is more complete that the SLIP one but I hope it will
help people to get their setup running.
------------------------------------------------------------
--
Ollivier ROBERT roberto@hsc.fr.net
Hervé Schauer Consultants Ollivier.Robert@keltia.frmug.fr.net
PERL / MIME / PGP / 4.4BSD FreeBSD keltia 1.1.5(RELEASE) RELEASE#0 i386