SETTING UP LINUX PPP
This document explains how to set up Linux PPP (specifically, Red Hat
5.2) for use with your World account. pppd (PPP daemon) is PPP
software that comes with most Linux distributions. It allows Internet
programs such as Netscape, telnet, FTP, etc. to operate via your modem.
These instructions assume some familiarity with basic UNIX commands
and file permissions.
This document is divided into the following sections:
I - Verifying that you have the Correct Software
II - Setting Up DNS
III - Setting Up pppd Configuration Files
IV - Making a PPP Connection
Appendix - Connection Scripts
Part I - Verifying that you have the Correct Software
To make sure that you have the PPP daemon, login as root and type
# rpm -qa | grep ppp
(where "#" is the Unix prompt for user "root"). You should get a
response which looks like this:
ppp-2.1.2...
ppp-2.2...
If you don't have pppd, you can get it from
ftp://sunsite.unc.edu/pub/linux/system/network/serial/ppp/ppp-2.3.4.tar.gz
The PPP daemon is installed such that it requires root access to
start up a PPP link.
Part II - Setting Up DNS
There are two configuration files which must be set up so that your
computer can resolve names such as www.slashdot.org to the
corresponding IP address (206.170.14.75). These files are
/etc/resolv.conf and /etc/host.conf.
The file /etc/resolv.conf should have the following contents:
domain std.com
nameserver 192.74.137.112
nameserver 192.74.137.5
and have the following permissions (check using "# ls -l"):
-rw-r--r-- 1 root root .
The file /etc/host.conf should have the following contents:
order hosts,bind
multi on
and have the same permissions as /etc/resolv.conf.
Part III - Setting Up pppd Configuration Files
There are several configuration files which can be used to control the
behavior of pppd. There are two in particular which we are interested
in, /etc/ppp/options and /etc/ppp/pap-secrets.
The file /etc/ppp/options should have the following contents:
lock
user your_username@theworld.com
("theworld.com" must in lowercase)
and the following permissions:
-rw-r--r-- 1 root root 17 Jun 8 20:49 options
/etc/ppp/pap-secrets must contain the username and password of your
World account.
# Secrets for authentication using PAP
# client server secret IP addresses
your_username@theworld.com * your_password
Since pap-secrets contains your password, it is important that the
files are not readable by anyone other than the root user:
-rw------- 1 root root 113 Jun 8 20:42 pap-secrets
Of course, replace "your_username" and "your_password" with your World
username and password.
Part IV - Making a PPP Connection
In the appendix are three Bourne shell scripts (ppp-on, ppp-dialer and
ppp-off) which you can use to establish or terminate a PPP connection
to the World. Copy these scripts to wherever you keep executable
files on your computer (such as /usr/local/bin) and make them
readable, writable and executable by the root user.
# chmod u+rwx
Log in as root and run ppp-on to connect to the World. Your modem
will dial and if all goes well, pppd will automatically establish a
PPP session.
Once connected you can use the command "ifconfig" to look at the PPP
interface. You should see something like this:
ppp0 Link encap:Point-point protocol
inet addr: 208.192.102.29 P-t-P:192.74.137.220
UP POINTTOPOINT RUNNING ....
You can also use the command "route" to examine the IP routing table.
There should be two entries for "ppp0" in this table, as show below:
# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
world.std.com * 255.255.255.255 UH 0 0 1 ppp0
127.0.0.0 * 255.0.0.0 U 0 0 10 lo
default gw.theworld.com 0.0.0.0 UG 0 0 0 ppp0
To disconnect, run ppp-off. You don't have to directly run
ppp-on-dialer.
If you have difficulties or are interested in PPP issues not covered
in this document, you may wish to view the following web sites, which
contain detailed information on Linux PPP.
http://www.interweft.com.au/other/ppp-faq/PPP-FAQ.html
http://metalab.unc.edu/LDP/HOWTO/PPP-HOWTO.html
Appendix - Connection Scripts
We provide three scripts for use with pppd: ppp-dialer, which dials
the World; ppp-on, which calls ppp-dialer and which starts the PPP
daemon on your computer; and ppp-off, which hangs up your modem and
kills the PPP daemon.
To connect to the World, type:
# ppp-on
To disconnect, type:
# ppp-off
The connection scripts are listed below. You may find versions of
these scripts already on your computer in the directory /etc/ppp. You
should make sure that the file permissions on the scripts allow them
to be executed.
Here is the ppp-on script:
---------------cut here--------------------
#!/bin/sh
# This is a simple script to initiate a PPP connection on the World.
# Change the values of $TELEPHONE, $DEVICE, $SPEED and $DIALER_SCRIPT as
# needed. Comment out the line in which $TELEPHONE is set to be prompted
# for a phone number.
TELEPHONE=6175601100 # The telephone number for the connection.
DEVICE=/dev/ttyS2 # The device of the modem.
SPEED=112500 # The speed of your modem port (38400, 57600,
# 112500, etc).
# DOS's COM1 = /dev/ttyS0 or /dev/cua0
# COM2 = /dev/ttyS1 or /dev/cua1, etc.
# 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 on the connect option. (To do so on a 'root' account would be
# a security hole so don't ask.)
DIALER_SCRIPT=/usr/local/bin/ppp-on-dialer
# You should not change the following values (LOCAL_IP, REMOTE_IP and
# NETMASK) if you're not sure what they mean.
LOCAL_IP=0.0.0.0 # Dynamic IP Address = 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
# Prompt for the phone number if necessary.
if [ "$TELEPHONE" = "" ] ; then
/bin/echo -n 'phone number: '
read TELEPHONE
fi
# Export the phone number so that it will be available to the dialer script.
export TELEPHONE
# Initiate the connection
exec /usr/sbin/pppd $DEVICE $SPEED crtscts modem defaultroute debug connect $DIALER_SCRIPT
--------------------end cut----------------
Use the following script for ppp-on-dialer:
----------------cut here---------------------
#!/bin/sh
#
# This is part 2 of the ppp-on script. It will perform the connection
# protocol for the desired connection.
#
exec /usr/sbin/chat -v \
TIMEOUT 3 \
ABORT '\nBUSY\r' \
ABORT '\nNO ANSWER\r' \
ABORT '\nRINGING\r\n\r\nRINGING\r' \
'' \rAT \
'OK-+++\c-OK' ATH0 \
TIMEOUT 30 \
OK ATDT$TELEPHONE \
CONNECT ''
-----------end cut-------------
Finally, the following script, ppp-off will assist you in terminating
your PPP session:
---------cut here--------------------------
#!/bin/sh
# Determine the device to be terminated.
if [ "$1" = "" ]; then
DEVICE=ppp0
else
DEVICE=$1
fi
# If the ppp0 pid file is present then the program is running. Stop it.
if [ -r /var/run/$DEVICE.pid ]; then
kill -INT `cat /var/run/$DEVICE.pid`
# If the kill did not work then there is no process running for this
# pid. It may also mean that the lock file will be left. You may wish
# to delete the lock file at the same time.
if [ ! "$?" = "0" ]; then
rm -f /var/run/$DEVICE.pid
echo "ERROR: Removed stale pid file"
exit 1
fi
# Success. Let pppd clean up its own junk.
echo "PPP link to $DEVICE terminated."
exit 0
fi
# The ppp process is not running for ppp0
echo "ERROR: PPP link is not active on $DEVICE"
exit 1
---------------end cut-------------------------