|
Linux Configuration

support@telerama.com)
1) Overview: What is PPP?
PPP stands for the "Point to Point Protocol". Almost every computer
that connects to the internet over a phone line uses PPP. PPP allows
data from the internet to be sent directly to your computer.
2) What do I need to get started?
This guide covers setting up a PPP dialup connection for a Linux
system. It is assumed that the kernel (the core of the Linux
operating system) is already configured for PPP. If this is not the
case you need to create a new kernel with PPP support, this is not
covered here. See the end of this guide for pointers to more
information. Newer "standard" linux distributions (like RedHat or
Slackware) will be set up for PPP by default.
If you have PPP support in your kernel you will see a message like the
following at boot time:
PPP Dynamic channel allocation code copyright 1995 Caldera, Inc.
PPP line discipline registered.
It is also assumed that you have the PPP software itself installed on
your computer. You can check this by typing the following:
ls -l /usr/sbin/pppd
You should see something like the following:
-rwxr-xr-x 1 root root 69084 Mar 25 1997 /usr/sbin/pppd
If you get an error ("no such file or directory") you must first
install the PPP software. This is not covered here, see the end of
this guide for some pointers to more information.
You must have a working modem. Modem configuration will be covered
briefly, but you will need to know where your modem is connected
(usually the first or second serial port). More information about
setting up modems and serial ports can be found in the reference
section at the end of this guide.
This guide assumes you have a standalone machine that does not have
any other network connections (for example, an ethernet card attached
to a LAN). Using your Linux box to give a LAN access to the internet
is a good idea, but is not covered here.
Lastly, you need to have access to the 'root' account on the machine.
The PPP software must be run as root, and almost all of the
configuration requires root access as well.
3) What do I need to do to connect my Linux machine to the internet?
First, you need to get some information from your ISP (or whoever is
providing you with dialup PPP service). You should get at least the
following information:
- Your user name and password
- The phone number you need to call
- The IP address of one or more name (DNS) servers
- What kind of authentication you can use: unix-style login or PAP
- The domain name of your ISP (optional)
You need to enter the IP addresses of the name servers into the file
/etc/resolv.conf. You can edit this file with any text editor (like vi).
If your ISP's domain name is "isp.com" and a name server address is
10.0.0.1 your resolv.conf file should look like this:
domain isp.com
nameserver 10.0.0.1
You don't have to have the "domain" line (but it's a good idea). You
can put in as many "nameserver" lines as you want (it's best to have
at least two in case one of the name servers goes down).
Edit the file /etc/ppp/options. You should have at least the
following two lines:
lock
defaultroute
"lock" will prevent other programs from trying to use the modem when
PPP is active. "defaultroute" tells Linux to use the PPP connection
for all internet traffic. If there are already other configuration
options in this file you should leave them there.
If your ISP tells you that you must use PAP authentication, you will
need to do two more things. At the end of the /etc/ppp/options file,
add the line
name yourusername
where "yourusername" is the user name given to you by your ISP. Then
edit the file /etc/ppp/pap-secrets and add the line
yourusername * yourpassword
where "yourusername" and "yourpassword" are the user name and password
given to you by your ISP. Note that you do not have to do either of
these two steps if your ISP supports regular text-style logins (often
called "unix" or "terminal" logins).
Now you are ready to try a manual test connection. You will need a
terminal program ('minicom' comes with many Linux distributions).
Start your terminal program and set the correct serial port and
speed. For example, if you have an external 28.8K modem on the second
serial port (COM2 on Windows systems) you would use "/dev/cua1" for
the serial port and "57600" for the modem speed. Note that Linux
numbers serial ports starting at zero while COM ports are numbered
starting at one.
Type:
ATZ
The modem should reply with:
OK
If this doesn't work then there is a problem with your modem or your
configuration. Modem configuration can get quite complex and is not
covered here, see the end of this guide for more information.
Dial your ISP. If your ISP's data phone number is 555-1212 type:
ATDT 5551212
If your modem's speaker is enabled you should hear it dialing and then
connecting. Once the connection is established you should get a
"connect" message from the modem:
CONNECT 28800 (V.34/ARQ/LAPM)
The connection message will vary depending on what kind of connection
you get, and some modems may not return any message by default.
If your ISP supports text logins (instead of just PAP) you should now
see a "login:" prompt of some sort. You may also get a banner
message, this varies for each provider. Enter your username. You
should now be prompted for a password, enter this as well.
You should now see a PPP startup message like the following:
PPP session from (204.171.44.105) to 205.201.37.27
beginning....~#!}!}!} }4}"}&} } } } }%}
Quit the terminal program without hanging up the et! To check, type the
following:
/usr/sbin/ifconfig ppp0
You should see something like:
ppp0 Link encap:Point-Point Protocol
inet addr:199.245.105.46 P-t-P:199.245.105.1 Mask:255.255.255.0
UP POINTOPOINT RUNNING MTU:1500 Metric:1
RX packets:6777 errors:0 dropped:0 overruns:0
TX packets:5713 errors:0 dropped:0 overruns:0
This particular example is a machine connected to a PPP server of IP
address 199.245.105.1. The "ping" utility checks connectivity to
another machine. Ping the PPP server you've dialed into:
ping 199.245.105.1
You should get replies back, about one every second:
PING 199.245.105.1 (199.245.105.1): 56 data bytes
64 bytes from 199.245.105.1: icmp_seq=0 ttl=45 time=333.032 ms
64 bytes from 199.245.105.1: icmp_seq=1 ttl=45 time=335.835 ms
64 bytes from 199.245.105.1: icmp_seq=2 ttl=45 time=351.152 ms
64 bytes from 199.245.105.1: icmp_seq=3 ttl=45 time=295.796 ms
Use "control-c" to stop pinging. If you can ping the PPP server, try
pinging another machine on the internet by name:
ping www.callme.net
If everything is working correct, you will get replies from the
mar in /usr/sbin or in /etc/ppp/scripts. This is a sample "ppp-on" script:
#!/bin/sh
#
# Script to initiate a PPP connection. This is the first part of the
# pair of scripts. This is not a secure pair of scripts as the codes
# are visible with the 'ps' command. However, it is simple.
#
# These are the parameters. Change as needed.
TELEPHONE=555-1212 # The telephone number for the connection
ACCOUNT=george # The account name for logon (as in 'George Burns')
PASSWORD=gracie # The password for this account (and 'Gracie Allen')
#
# Export them so that they will be available to 'ppp-on-dialer'
expoTELEPHONE ACCOUNT PASSWORD
#
# 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_SCRIT=/etc/ppp/ppp-on-dialer
#
# Initiate the connection
#
#
exec /usr/sbin/pppd debug /dev/cua1 57600 \
connect $DIALER_SCRIPT
Enter the appropriate telephone, account, and password information
into this script. The "ppp-on" script actually calls a second script
"ppp-on-dialer". Make sure this script exists in the correct location
(/etc/ppp in the eple "ppp-on" script above). Here is the
"ppp-on-dialer" script:
#!/bin/sh
#
# This is part 2 of the ppp-on script. It will perform the co \
ABORT '\nRINGING\r\n\r\nRINGING\r' \
'' \rAT \
'OK-+++\c-OK' ATH0 \
TIMEOUT 30 \
OK ATDT$TELEPHONE \
CONNECT '' \
ogin:--ogin: $ACCOUNT \
ssword: $PASSWORD
This script is a simple sequence of expected text followed by
replies. If your ISP uses "username:" instead of "login:", for
example, you should change the "ogin:--ogin:" to something like
"sername:--sername:".
The above script is a terminal style connection. If you are using
PAP you don't need to send your name or password, and can use a
"ppp-on-dialer" script like this:
#!/bin/sh
#
# This is part 2 of the ppp-on script. It will perform the connection
# protocol for the desired connection.
#
elete 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 o$DEVICE"
exit 1
4) Further reference
The best source of information for Linux aronfigure and
install the PPP software on a Linux machine which is not already set
up for PPP.
If you cannot access the web, you can also try the manual page for the
PPP software. Type:
man pppd
to get the manual page for pppd (the "Point-to-Point protocol
daemon"). The manual pages give detailed information about the
programs, but aren't as good as he HOWTOs in explaining how to setup
and troubleshoot PPP step by step.
|