Ken's Quick Connect Checklist for Linux
This is my attempt to address the major points of getting that ultimate
PPP link to your ISP. I assume you've read the salient points of the documentation
for your hardware and your Linux distribution. I will give examples for
Slackware, but you should be able to adapt them to your system. I have
left this page as plain text (mostly) so that you can save it to disk or
print it more easily.
Introduction
You should be familiar with the following HOWTO documents.
Also, you should already have your system configured to support networking
before going any further.
The Network
Administrator's Guide
Linux NET-HOWTO
Linux
Serial HOWTO
Linux
PPP HOWTO
Linux
ISP Hookup HOWTO
I know this is some heavy reading for beginners. You don't
have to memorize it. Just be familiar with it so you know where to go when
something doesn't work like it should.
The Modem
Let's start with the hardware. You want a good quality modem that supports
V.42, V.42bis, and V.90 protocols on board (ROM). Check the box and docs
carefully. Avoid anything that refers to "RPI" drivers and software. These
modems require software drivers to support the V.42 protocols. The V.90
protocol is the current standard for analog modem to modem communication.
If there is only one analog to digital conversion, you may achieve data
rates up to 53Kbps. If there is more than one digital to analog conversion
in the path, then the modem should automatically negotiate V.34 protocol.
At power-on the modem loads a configuration from NVRAM. Check your manual
for the default settings and chances are that's what you've got. The problem
is that those defaults are rarely what you want for a serial link that
will support PPP. Search for the commands that will enable hardware flow
control, error correction, data compression, speed negotiation, etc. Set
these to their "enabled" condition.
For instance, the command: 'AT&C1&D2&K3&Q5' is required
to enable hardware flow control and error correction on a PPI PM288HC modem.
However, 'AT&F1&B1' or just 'ATZ' may be all that is required for
a USR Courier.
Your manual will give you the commands to check the current settings, allow
you to change settings, and allow you to _save_ the changes to NVRAM. Remember,
we don't want to have to do this every time. You can access your modem
by a terminal window in "minicom" or "Seyon". Both programs are included
in Slackware distributions.
For more information on analog modems check: Navas
Modem FAQ
Serial Port
Hopefully, you read the docs on serial ports. If not, check the man page
for "setserial". You want the fastest possible link between your computer
and your modem. So, you need to decide which device file maps to your modem,
first. If your modem is set to COM1 in DOS terminology, that means /dev/cua0
in Linux terminology. If it's COM2, then /dev/cua1, etc. On newer
distributions, the cua? devices are deprecated. You would use /dev/ttyS0
or /dev/ttyS1 instead.
If you have BSD style initialization scripts like Slackware, the script
/etc/rc.d/rc.serial is called by /etc/rc.d/rc.M during initialization to
set the devices appropriately. If your distribution uses SYSV style
initialization, look around in /etc/rc.d/init.d.
If you are using auto configuration, the line in question would look like
this:
${SETSERIAL} /dev/cua0 ${AUTO_IRQ} skiptest autoconfig
If you are using manual configuration, then the line in question is:
${SETSERIAL} /dev/cua0 uart 16550 port 0x3F8 irq 4
Determine which line is in use by the absence of the sharp (#) sign. Now,
if you have an internal modem or a 16550 UART on the port your external
modem uses, you need to add 'spd_vhi' to the end of the active line (after
a space, of course). The result looks like:
${SETSERIAL} /dev/cua0 ${AUTO_IRQ} skiptest autoconfig spd_vhi
If you are using the manual line, then add 'spd_vhi' to that line instead.
This little trick sets your serial port to 115200bps instead of the default
38400bps whenever an application (like pppd) requests 38400bps. Cool, huh?
Don't forget to run the script in order for the change to take effect.
You can use 'minicom' or 'Seyon' to verify this. The application tells
you it is running at 38400, but if you enter 'ATI4' (USR Courier), you
see "DATA=115200".
If you are not sure about the 16550 UART you can use 'setserial' to test
it -- the man page tells you how. If you discover that you can't use 'spd_vhi',
then use 'spd_hi' instead. This will set the serial port to 57600bps.
Keep in mind that we are talking about the link between your computer and
the modem. This speed is usually different and (hopefully) faster than
the link from your modem to the ISP. When a modem reports a CONNECT speed,
it usually means this link. If you want to know the CARRIER data rate between
modems, check your modem manual for the correct command.
The PPP Options
The daemon, pppd, uses /etc/ppp/options to set its _global_ options --
those options that are true for every PPP session. If you only have one
ISP link, then _all_ your options can go in here. Here's a sample file
for a system that receives its IP dynamically:
crtscts
modem
mtu 576
mru 576
noipdefault
defaultroute
/dev/modem
Note the device is /dev/modem -- not /dev/cua0 or whatever. This is a common
symlink in Slackware distributions. You may use either if you have this
symlink set to the appropriate cua? device. Now, if you are using "Seyon"
or "minicom" to dial your ISP, then once you establish a connection, login,
and start PPP on the remote machine; you can start PPP on yours by going
to a different window or VT and entering: pppd 38400. The two daemons will
negotiate everything else. This assumes that you have everything else configured
correctly.
Of course, this is only a few of the common options. Many more are available
to tailor your connection to your ISP. Check the 'man' page and documentation
for the rest.
The Script(s)
Well, it works, but it isn't cool. Real Linux power users don't use comm
programs to establish their links -- they hack scripts. There are plenty
of examples with the Slackware distribution and on SunSITE. But, not all
are created equal and none work for everybody on every system. So, here's
one set that works for me. You will have to modify them for your setup
and your mileage may vary. The 'ppp-on' script kicks it off:
#!/bin/sh
# # Script to initiate a ppp connection. This is the first part of the
# # pair of scripts.
# # These are the parameters. Change as needed. Add the code to
# # disable "call waiting" at the beginning of the phone number if needed.
TELEPHONE=555-1212 # The telephone number for the connection
LOCAL_IP=0.0.0.0 # Local IP address if known. Dynamic = 0.0.0.0
REMOTE_IP=0.0.0.0 # Remote IP address if desired. Normally 0.0.0.0
NETMASK=255.255.255.0 # The proper netmask, if needed
# # Export them so that they will be available to 'ppp-on-dialer' .
export TELEPHONE LOCAL_IP REMOTE_IP NETMASK
# # This is the location of the script which dials the phone and logs
# # in. Please use the absolute file name as the $PATH variable is not
# # used .
DIALER_SCRIPT=/etc/ppp/ppp-on-dialer
# # Initiate the connection .
# # I put my ISP specific options on this command line. Please, don't
# # forget the 'lock' option or some programs, such as mgetty, will not
# # work. The 'asyncmap' will permit the PPP link to work with
# # a telnet connection. You are welcome to make any changes
# # as desired. Check the man page for other options.
exec /usr/sbin/pppd /dev/modem 38400 lock \
asyncmap 200A0000 kdebug 0 \
+ua /etc/ppp/ppp-nova connect $DIALER_SCRIPT
OK, notice the last three lines are actually one long line that has been
escaped with the backslash. This file should be executable and setuid 'root'
(chmod 4755) or whatever makes you comfortable. Note: Recent kernels will
not honor the SUID bit for scripts -- so, you'll have to actually be 'root'
to make it work properly. Also, I included /dev/modem even though I set
that option in the global options file -- call me paranoid.
The 'kdebug' is a good option to set on a case-by-case basis. If all is
well, use zero (0). For more info logging, use a higher number. Also, use
'debug' for negotiation information. Both are described in the 'man' page
and the docs.
The '+ua /etc/ppp/ppp-nova' means to perform user authentication with the
userid and password stored in that file. Make sure only 'root' can read
that file (chown root, chgrp root, & chmod 600) and put YOUR ISP userid
and password in that order on one line each.
However, the use of the '+ua' switch has been deprecated in favor of a
more standard method to invoke PAP (Password Authentication Protocol).
So, the preferred method to perform authentication requires you to add
'user <your-ISP-userid>' in /etc/ppp/options and use /etc/ppp/pap-secrets
for storing the rest of the information. The file /etc/ppp/pap-secrets
looks like:
# PAP-Secrets for your ISP
# client
server
secret
acceptable IP addresses
<userid>
*
<password>
Obviously, you need to put YOUR real userid and password (without angles)
in the file. The asterisk means that this entry can be used with
any ISP; so, if you have more than one, you will need to specify
'this.isp.com' on this line and then create another line for the other
ISP. The last field really doesn't do much when you are the client
-- read the docs if you are interested. The file permissions
should be set as described above to protect your password. Finally,
take the '+ua /etc/ppp/ppp-nova' argument out of your script. The
daemons will know how to authenticate you.
Now, let's look at the dialer script:
#!/bin/sh
# # This is part 2 of the ppp-on script. It will dial the modem .
exec chat \
TIMEOUT 5\
ABORT '\nBUSY\r' \
ABORT '\nNO ANSWER\r' \
ABORT '\nRING\r\n\r\nRING\r' \
'' ATZ0 \
'OK-+++\c-OK' ATH0 \
TIMEOUT 30 \
OK ATDT$TELEPHONE \
CONNECT ''
OK, that's all it really takes. Note the backslashes -- everything is technically
on one line. The 'ATZ0' ensures the modem is initialized to the settings
I stored in Step 1 -- The Modem. The 'ATH0' forces the modem to hang up
if it happens to be doing something else. If you want 'chat' to log responses,
put ' -v' after the command 'chat' and before the first backslash. Everything
will go in /var/log/messages unless you've played with '/etc/syslog.conf'.
Note that there is no automatic re-dial of a busy line. It will simply
fail and you will end up back at the shell prompt with no connection. It
will also fail if someone is dialing IN on your line. Notice that I didn't
use all the stuff I 'exported' from the first script. I didn't need it,
but it's there if I want to experiment with different ISPs. You could also
add lines to do "manual" login and password if your ISP requires it.
The Beginning
If you read your docs and followed these steps, you should be up and running.
Yes, it will take some "fiddling" to tweak your setup, but that's the price
of running a REAL operating system.
Enjoy.
:wq