Ian's PPP Primer for Linux 2.0
This is a completely revised version of my original PPP Primer, designed to work for Linux kernels in the 2.0.x series (including the newest releases of Slackware and Redhat). It should contain everything you need to get PPP working on your system.
Disclaimer: This document is intended only as a guide, and it falls firmly in the class of "It works for me; your mileage may vary." Nevertheless, comments, bug reports, and suggestions are welcome; my address is listed below.
What you will need
In order to use this primer, you will need:
- Root access to a Linux machine. The kernel on this machine should be at least as new as 2.0.0. Also, the kernel must either have PPP support compiled into it, or else you must have the PPP module loaded.
- A basic knowledge of Unix tools, like chown, chmod, etc.
- A properly configured modem. You should be able to use your modem to dial out to non-PPP connections, for example. The device used by your modem should be /dev/modem.
- The pppd-2.2.0 package. This includes the programs /usr/sbin/pppd and /usr/sbin/chat. This package is on the 'N' disk series of Slackware, and I'm sure it's on the Redhat CD, too.
- A PPP account somewhere. At Berkeley, this is called a "Home-IP" account. You can get one by telnetting to home-ip.berkeley.edu and logging in as home-ip. You will need to know the phone number you use to dial in, your PPP account name, and your PPP account password. You should also find out things like your IP address, and the IP address(es) of one or more DNS nameservers.
Setting up your configuration files
You will need to edit certain files in your /etc directory (as root, obviously) to reflect your PPP connection. Each file you will need to change will be listed, along with the ownership and permissions it should have (the output of ls -l).
-rw-r--r-- 1 root root 22 Jul 29 12:57 /etc/HOSTNAME
This file should contain a single line consisting of the hostname for your machine. At Berkeley, this is your PPP account name, followed by .hip.berkeley.edu. For example, my /etc/HOSTNAME file contains the line cypherpunk.hip.berkeley.edu.
-rw-r--r-- 1 root root 144 Jun 20 21:49 /etc/hosts
This file associates host names to IP addresses. Any hosts you list in this file can be looked up more quickly than ones you don't, because you won't have to send a message over your modem. Here is a sample /etc/hosts file. Make sure to change the second line to match your IP address and hostname.
127.0.0.1 localhost YOUR.IP.ADD.RESS YOURNAME.hip.berkeley.edu YOURNAME 220.127.116.11 ns1.berkeley.edu 18.104.22.168 ns2.berkeley.edu 22.214.171.124 kerberos1.cs.berkeley.edu 126.96.36.199 kerberos2.eecs.berkeley.edu
-rw-rw-r-- 1 root root 124 Jun 20 13:35 /etc/resolv.conf
This file lists the computers to use as nameservers, and how to look up computers, given the first part of their names. You should have been given one or two IP address of machines to use as nameserver when you got your PPP account. Use them in the nameserver lines, below. Here is a sample /etc/resolv.conf file, suitable for EECS and CS students at Berkeley:
domain hip.berkeley.edu search cs.berkeley.edu eecs.berkeley.edu berkeley.edu nameserver 188.8.131.52 nameserver 184.108.40.206The first line of this file lists your computer's domain; usually, this is anything after the first dot in the /etc/HOSTNAME file. The second line lists domains to search when looking up partial hostnames. For example, if you had the the file above, and you tried to telnet to quux, your computer would try to connect to quux.cs.berkeley.edu, quux.eecs.berkeley.edu, and quux.berkeley.edu, in that order. The remaining lines list nameservers to use. Fill in the ones you were given, as described above.
drwxrwxr-x 2 root root 1024 Jun 20 13:02 /etc/ppp -rw-rw-r-- 1 root root 0 Feb 25 1996 /etc/ppp/options
Make sure you have a directory called /etc/ppp and in it, an empty file called options. We will be putting other files in this directory later.
Now you must set up the programs that will allow you to dial the modem, log in, and start a PPP connection. You may already have programs with the following names. If so, back them up and replace them with these. Clicking on their names will download them.
-rwxr-xr-x 1 root root 641 Feb 25 1996 /usr/sbin/ppp-on -rwxr-xr-x 1 root root 981 Feb 25 1996 /usr/sbin/ppp-off -rwxr-xr-x 1 root root 142 Sep 24 19:57 /etc/ppp/ip-up -rwxr-xr-x 1 root root 222 Sep 24 19:52 /etc/ppp/ppp-on-chat
Finally, you have to set up one or more chatscripts. These are files that tell the computer how to log in to your PPP account. You need at least one of these called /etc/ppp/chatscript:
-rw------- 1 root root 192 Sep 8 19:49 /etc/ppp/chatscript
You will need to substitute your own values for some of the entries in the file above:
- Change this to the phone number you use to dial in. Leave no space between it and the atdt before it.
- Change this to the username you use to log in to your PPP account. At Berkeley, this is your Home-IP account name.
- Change this to your PPP account password. Leave no space between it and the \q before it. If your password contains any characters that are not letters or numbers, you may have to put ticks (') around the password.
You can have more than one chatscript if, for example, there is more than one phone number you can use. Just copy the above chatscript and make the appropriate changes to the new copy. Call your new copy /etc/ppp/chatscript-word, where word is any sequence of letters or numbers. For example, you might have the file /etc/ppp/chatscript-15min that contains the phone number to dial up the 15 minute service.
How to use it
Once you have done everything described above, you can try it out. As root, do:
If all goes well, your modem should dial, and you should get a PPP connection. Check your /var/log/messages file if it doesn't work. If you want to use one of your other chatscripts, give the suffix for the chatscript as an argument. For example,
# ppp-on 15min
would access the chatscript /etc/ppp/chatscript-15min instead of the default one.
As you would expect, to turn off PPP, do
You can use the kerneld feature of the 2.0 kernels to eliminate the need to run ppp-on al all! If set up properly, your computer can just dial your modem automatically, whenever it needs to send something over the net. To get this to work, you need to have kernerld support compiled into your kernel, and you need to have the line
in your /etc/rc.d/rc.S file (for Slackware; for Redhat, this may be different). Now you just need to add one more program:
-rwxr-xr-x 1 root bin 357 Sep 24 19:53 /sbin/request-route
If you just installed all of this now, reboot. Now try running netscape, or telnetting to or pinging some machine. If all went well, your modem should automatically dial, your computer should automatically start PPP, and the connection will work.
You will still need to shut down PPP manually with ppp-off, or you can just rely on the fact the the line will drop after 30 minutes of not being used (at Berkeley, anyway).
If you want request-route to use a different chatscript, simply edit the appropriate line in the program. If you want it to try different ones, you're on your own (unless someone writes such a thing and sends it to me!).
Please direct any questions, comments, or radical doubts to me at the
address below, or post to
Ian Goldberg <firstname.lastname@example.org>