pkg://Linux-HOWTOs.tar.gz:1682658/PPP-HOWTO
downloads
Linux PPP HOWTO
Robert Hart, hartr@interweft.com.au
v3.0, 31 March 1997
This document shows how to connect your Linux PC to a PPP server, how
to use PPP to link two LANs together and provides one method of set
ting up your Linux computer as a PPP server.The document also provides
help in debugging non-functional PPP connections.
Copyright
This document is distributed under the terms of the GPL (GNU Public
License).
Distribution
This document will be posted to comp.os.linux.answers as new versions
of the document are produced. It is also available in HTML format at:-
· Linux Howto Index <http://sunsite.unc.edu/mdw/linux.html#howto>
· PPP-HOWTO <http://www.interweft.com.au/other/ppp-howto/ppp-
howto.html>
Other formats (SGML, ASCII, postscript, DVI) are available from Howtos
- other formats <ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/other-
formats>.
As sunsite.unc.edu carries a very heavy load, please use an
appropriate mirror site close to you.
Acknowledgements
A growing number of people have provided me with assistance in
preparing this document. Special thanks go to Al Longyear for the
guidance on PPP itself (if there are mistakes here, they are mine not
his), Greg Hankins (maintainer of the Linux Howto system)and Debi
Tackett (of MaximumAccess.com) for many helpful suggestions on style,
content order, logic and clarity of explanations.
Finally, to the many people who have contacted me by email offering
comments - my thanks. As with all HOWTO authors, the satisfaction of
helping is all the payment we receive and it is enough. By writing
this HOWTO I am repaying in a small way the debt I - and all other
Linux users - owe to the people who write and maintain our OS of
choice.
1. Introduction
PPP (the Point to Point Protocol) is a mechanism for creating and
running IP (the Internet Protocol) and other network protocols over a
serial link - be that a direct serial connection (using a null-modem
cable), over a telnet established link or a link made using modems and
telephone lines (and of course using digital lines such as ISDN).
Using PPP, you can connect your Linux PC to a PPP server and access
the resources of the network to which the server is connected (almost)
as if you were directly connected to that network.
You can also set up your Linux PC as a PPP server, so that other
computers can dial into your computer and access the resources on your
local PC and/or network.
As PPP is a peer-to-peer system, you can also use PPP on two Linux PCs
to link together two networks (or a local network to the Internet),
creating a Wide Area Network (WAN).
One major difference between PPP and an Ethernet connection is of
course speed - a standard Ethernet connection operates at 10 Mbs (Mega
- million bits per second) maximum theoretical throughput, whereas an
analogue modem operates at speeds up to 56 kbps (kilo - thousand bits
per second).
Also, depending on the type of PPP connection, there may be some
limitations in usage of some applications and services.
1.1. Clients and Servers
PPP is strictly a peer to peer protocol; there is (technically) no
difference between the machine that dials in and the machine that is
dialed into. However, for clarity's sake, it is useful to think in
terms of servers and clients.
When you dial into a site to establish a PPP connection, you are a
client. The machine to which you connect is the server.
When you are setting up a Linux box to receive and handle dial in PPP
connections, you are setting up a PPP server.
Any Linux PC can be both a PPP server and client - even simultaneously
if you have more than one serial port (and modem if necessary). As
stated above, there is no real difference between clients and servers
as far as PPP is concerned, once the connection is made.
This document refers to the machine that initiates the call (that
dials in) as the CLIENT, whilst the machine that answers the
telephone, checks the authentication of the dial in request (using
user names, passwords and possibly other mechanisms) is referred to as
the SERVER.
The use of PPP as a client to link one or more machines at a location
into the Internet is, probably, the one in which most people are
interested - that is using their Linux PC as a client.
The procedure described in this document will allow you to establish
and automate your Internet connection.
This document will also give you guidance in setting up your Linux PC
as a PPP server and in linking two LANs together (with full routing)
using PPP (this is frequently characterised as establishing a WAN -
wide area network - link).
1.2. Differences between Linux distributions
There are many different Linux distributions and they all have their
own idiosyncrasies and ways of doing things.
In particular, there are two different ways a Linux (and Unix)
computer actually starts up, configures its interfaces and so forth.
These are BSD system initialisation and System V system
initialisation. If you dip into some of the Unix news groups, you will
find occasional religious wars between proponents of these two
systems. If that sort of thing amuses you, have fun burning bandwidth
and join in!
Possibly the most widely used distributions are
· Slackware
which uses BSD style system initialisation
· Red Hat (and its former associate Caldera)
which use SysV system initialisation (although in a slightly
modified form)
· Debian
which uses SysV system initialisation
BSD style initialisation typically keeps its initialisation files in
/etc/... and these files are:-
______________________________________________________________________
/etc/rc
/etc/rc.local
/etc/rc.serial
(and possibly other files)
______________________________________________________________________
Of recent times, some BSD system initialisation schemes use a
/etc/rc.d... directory to hold the start up file rather than putting
everything into /etc.
System V initialisation keeps its initialisation files in directories
under /etc/... or /etc/rc.d/... and a number of subdirectories under
there:-
______________________________________________________________________
drwxr-xr-x 2 root root 1024 Jul 6 15:12 init.d
-rwxr-xr-x 1 root root 1776 Feb 9 05:01 rc
-rwxr-xr-x 1 root root 820 Jan 2 1996 rc.local
-rwxr-xr-x 1 root root 2567 Jul 5 20:30 rc.sysinit
drwxr-xr-x 2 root root 1024 Jul 6 15:12 rc0.d
drwxr-xr-x 2 root root 1024 Jul 6 15:12 rc1.d
drwxr-xr-x 2 root root 1024 Jul 6 15:12 rc2.d
drwxr-xr-x 2 root root 1024 Jul 18 18:07 rc3.d
drwxr-xr-x 2 root root 1024 May 27 1995 rc4.d
drwxr-xr-x 2 root root 1024 Jul 6 15:12 rc5.d
drwxr-xr-x 2 root root 1024 Jul 6 15:12 rc6.d
______________________________________________________________________
If you are trying to track down where your Ethernet interface and
associated network routes are actually configured, you will need to
track through these files to actually find where the commands are that
do this.
1.3. Distribution specific PPP configuration tools
On some installations (for example Red Hat and Caldera), there is a X
Windows configured PPP dial up system. This HOWTO does not cover these
distribution specific tools. If you are having problems with them,
contact the distributors directly!
For Red Hat 4.x users, there is now a Red Hat PPP-TIP
<http://www.interweft.com.au> in the Linux resources area and also
from Red Hat Software <http://www.redhat.com> in the support area.
2. IP Numbers
Every device that connects to the Internet must have its own, unique
IP number. These are assigned centrally by a designated authority for
each country.
If you are connecting a local area network (LAN) to the Internet, YOU
MUST use an IP number from your own assigned network range for all the
computers and devices you have on your LAN. You MUST NOT pick IP
numbers out of the air and use these whilst connecting to another LAN
(let alone the Internet). At worst this will simply not work at all
and could cause total havoc as your 'stolen' IP number starts
interfering with the communications of another computer that is
already using the IP number you have picked out of the air.
Please note that the IP numbers used throughout this document (with
some exceptions) are from the 'unconnected network numbers' series
that are reserved for use by networks that are not (ever) connected to
the Internet.
There are IP numbers that are specifically dedicated to LANs that do
not connect to the Internet. The IP number sequences are:-
· One A Class Network Address
10.0.0.0 (netmask 255.0.0.0)
· 16 B Class Network Addresses
172.16.0.0 - 172.31.0.0 (netmask 255.255.0.0)
· 256 C Class Network Addresses
192.168.0.0 - 192.168.255.0 (netmask 255.255.255.0)
If you have a LAN for which you have not been allocated IP numbers by
the responsible authority in your country, you should use one of the
network numbers from the above sequences for your machines.
These numbers should never be used on the Internet.
However, they can be used for the local Ethernet on a machine that is
connecting to the Internet. This is because IP numbers are actually
allocated to a network interface, not to a computer. So whilst your
Ethernet interface may use 10.0.0.1 (for example), when you hook onto
the Internet using PPP, your PPP interface will be given another (and
valid) IP number by the server. Your PC will have Internet
connectivity, but the other computers on your LAN will not.
However, using Linux and the IP Masquerade (also known as NAT -
Network address Translation) capabilities of the Linux and the ipfwadm
software, you can connect your LAN to the Internet (with some
restriction of services), even if you do not have valid IP numbers for
the machines on your Ethernet.
For more information on how to do this see the IP Masquerade mini-
HOWTO at Linux IP Masquerade mini HOWTO
<http://sunsite.unc.edu/mdw/HOWTO/mini/IP-Masquerade>
For most users, who are connecting a single machine to an Internet
service provider via PPP, obtaining an IP number (or more accurately,
a network number) will not be necessary.
If you wish to connect a small LAN to the Internet, many Internet
Service Providers (ISPs) can provide you with a dedicated subnet (a
specific sequence of IP numbers) from their existing IP address space.
Alternatively, use IP Masquerading.
For users, who are connecting a single PC to the Internet via an ISP,
most providers use dynamic IP number assignment. That is, as part of
the connection process, the PPP service you contact will tell your
machine what IP number to use for the PPP interface during the current
session. This number will not be the same every time you connect to
your ISP.
With dynamic IP numbers, you are not given the same IP number each
time you connect. This has implications for server type applications
on your Linux machine such as sendmail, ftpd, httpd and so forth.
These services are based on the premise that the computer offering the
service is accessible at the same IP number all the time (or at least
the same fully qualified domain name - FQDN - and that DNS resolution
of the name to IP address is available).
The limitations of service due to dynamic IP number assignment (and
ways to work around these, where possible) are discussed later in the
document.
3. Aims of this Document
3.1. Setting up a PPP Client
This document provides guidance to people who wish to use Linux and
PPP to dial into a PPP server and set up an IP connection using PPP.
It assumes that PPP has been compiled and installed on your Linux
machine (but does briefly cover reconfiguring/recompiling your kernel
to include PPP support).
Whilst DIP (the standard way of creating a SLIP connection) can be
used to set up a PPP connection, DIP scripts are generally quite
complex. For this reason, this document does NOT cover using DIP to
set up a PPP connection.
Instead, this document describes the standard Linux PPP software
(chat/pppd).
3.2. Linking two LANs or a LAN to the Internet using PPP
This document provides (basic) information on linking two LANs or a
LAN to the Internet using PPP.
3.3. Setting up a PPP server
This document provides guidance on how to configure your Linux PC as a
PPP server (allowing other people to dial into your Linux PC and
establish a PPP connection).
You should note that there are a myriad of ways of setting up Linux as
a PPP server. This document gives one method - that used by the author
to set up several small PPP servers (each of 16 modems).
This method is known to work well. However, it is not necessarily the
best method.
3.4. Using PPP over a direct null modem connection
This document provides a brief overview of using PPP to link two Linux
PCs via a null modem cable. It is possible to link other OS's to Linux
this way as well. To do so, you will need to consult the documentation
for the operating system you are interested in.
3.5. This document at present does NOT cover...
· Compiling the PPP daemon software
See the documentation that comes with the version of pppd you are
using.
· Connecting and configuring a modem to Linux (in detail)
See the Serial-HOWTO and for modem specific initialisation, see
Modem Setup Information <http://www.in.net/info/modems/index.html>
for information that may help you to configure your modem.
· Using DIP to make PPP connections
Use chat instead...
· Using socks or IP Masquerade
There are perfectly good documents already covering these two
packages.
· Using diald to set up an automated connection
See the diald documentation for information on this.
· Using EQL to gang together two modems into a single PPP link.
· Distribution specific PPP connection methods (such as the Red Hat
4.x network configuration tool.
See the distribution for documentation on the methods used.
· The growing number of tools available to automate PPP set up
See the appropriate documentation.
4. Software versions covered
This HOWTO assumes that you are using a Linux 1.2.x kernel with the
PPP 2.1.2 software or Linux 1.3.X/2.0.x and PPP 2.2.
At the time of writing, the latest official version of PPP available
for Linux is ppp-2.2f. The new version (ppp-2.3) is still in beta.
It is possible to use PPP 2.2.0 with kernel 1.2.13. This requires
kernel patches. It is recommended that version 1.2.13 kernel users
move up to ppp-2.2 as it includes several bug fixes and enhancements.
Also, you should particularly note that you cannot use the PPP 2.1.2
software with Linux kernel version 2.0.X.
Please note that this document does NOT cover problems arising from
the use of loadable modules for Linux kernel 2.0.x. Please see the
kerneld mini-HOWTO and the kernel/module 2.0.x documentation (in the
Linux 2.0.x source tree at /usr/src/linux/Documentation/...).
As this document is designed to assist new users, it is highly
recommended that you use a version of the Linux kernel and the
appropriate PPP version that are known to be stable together.
5. Other Useful/Important Documents
Users are advised to read :-
· the documentation that comes with the PPP package;
· the pppd and chat man pages;
(use man chat and man pppd to explore these)
· the Linux Network Administration Guide (NAG);
see The Network Administrators' Guide
<http://sunsite.unc.edu/mdw/LDP-books/nag-1.0/nag.html>
· the Net-2/3 HOWTO;
see Linux NET-2/3-HOWTO
<http://sunsite.unc.edu/mdw/HOWTO/NET-2-HOWTO.html>
· Linux kernel documentation installed in
/usr/src/linux/Documentation when you install the Linux source
code;
· The modem setup information page - see Modem Setup Information
<http://www.in.net/info/modems/index.html>
· The excellent Unix/Linux books published by O'Reilly and
Associates. See (O'Reilly and Associates On-Line Catalogue <
http://www.ora.com/>). If you are new to Unix/Linux, run (don't
walk) to your nearest computer book shop and invest in a number of
these immediately!
· The PPP-FAQ maintained by Al Longyear, available from Linux PPP-FAQ
<ftp://sunsite.unc.edu/pub/Linux/docs/faqs>.
This contains a great deal of useful information in question/answer
format that is very useful when working out why PPP is not working
(properly).
· The growing number of Linux books from various publishing houses
and authors;
You are actively encouraged to check the currency of these books.
Linux development and distributions tend to evolve fairly rapidly,
whilst the revision of books move (generally) much more slowly!
Buying an excellent book (and there are many) that is now out of
date will cause new users considerable confusion and frustration.
The best general starting point for Linux documentation is The Linux
Documentation Project Home Page <http://sunsite.unc.edu/mdw/>. The
HOWTO's tend to be revised reasonably regularly.
Whilst you can use this document to create your PPP link without
reading any of these documents, you will have a far better
understanding of what is going on if you do so! You will also be able
to address problems yourself (or at least ask more intelligent
questions on the comp.os.linux... newsgroups or Linux mailing lists).
These documents (as well as various others, including the relevant
RFCs) provide additional and more detailed explanation than is
possible in this HOWTO.
If you are connecting a LAN to the Internet using PPP, you will need
to know a reasonable amount about TCP/IP networking. In addition to
the documents above, you will find the O'Reilly books "TCP/IP Network
Administration" and "Building Internet Firewalls" of considerable
benefit!
5.1. Useful Linux Mailing Lists
There are many Linux mailing lists that operate as a means of
communication between users of many levels of ability. By all means
subscribe to those that interest you and contribute your expertise and
views.
A word to the wise: some lists are specifically aimed at "high
powered" users and/or specific topics. Whilst no-one will complain if
you 'lurk' (subscribe but don't post messages), you are likely to earn
heated comments (if not outright flames) if you post 'newbie'
questions to inappropriate lists.
This is not because guru level users hate new users, but because these
lists are there to handle the specific issues at particular levels of
difficulty.
By all means join the lists that offer open subscription, but keep
your comments relevant to the subject of the list!
A good starting point for Linux mailing lists is Linux Mailing List
Directory <http://summer.snu.ac.kr/~djshin/linux/mail-
list/index.shtml>
6. Overview of what has to be done to get PPP working as a client
This document contains a great deal of information - and with each
version it grows!
As a consequence, this section aims to provide a concise overview of
the actions you will need to take to get your Linux system connected
as a client to a PPP server.
6.1. Obtaining/Installing the software
If your Linux distribution does not include the PPP software, you will
need to obtain this from the Linux PPP daemon
<ftp://sunsite.unc.edu/pub/Linux/system/Network/serial/ppp/ppp-2.2.0f.tar.gz>.
This is the latest official version at the time of writing. However,
choose the latest version available from this site (ppp-2.3 is in beta
at the time of writing and should be released soon).
The PPP package contains instructions on how to compile and install
the software so this HOWTO does not!
6.2. Compiling PPP support into the kernel
Linux PPP operations come in two parts
· the PPP daemon mentioned above
· kernel support for PPP
Many distributions seem to provide PPP kernel support in their default
installation kernels, but others do not.
If at boot your kernel reports messages like
______________________________________________________________________
PPP Dynamic channel allocation code copyright 1995 Caldera, Inc.
PPP line discipline registered.
______________________________________________________________________
your kernel does have PPP support compiled in.
That said, you will probably want to compile your own kernel whatever
your distribution to provide the most efficient use of system
resources given your particular hardware configuration. It is worth
remembering that the kernel cannot be swapped out of memory and so
keeping the kernel as small as possible has advantages on a memory
limited machine.
This document provides minimal kernel re-compilation instructions at
section ``Configuring your Linux Kernel''.
For greater detail, see the Kernel-HOWTO at The Linux Kernel HOWTO
<http://sunsite.unc.edu/mdw/HOWTO/Kernel-HOWTO.html>
6.3. Obtaining information from your ISP
There are an almost infinite number of ways in which a PPP server can
be set up. In order to connect to your ISP (or corporate PPP server to
access your intranet), you will need to obtain information on how the
PPP server operates.
Because you are using Linux, you may have some difficulty with some
ISP help desks (and work site based PPP intranet servers) which know
only about MS Windows clients.
However, a rapidly growing number of ISPs use Linux to provide their
service - and Linux is also penetrating the corporate environment as
well, so you may be lucky if you do strike problems.
Section ``Getting the Information you need about the PPP server''
tells you what you need to know about the PPP server to which you are
going to connect - and how to find out the information you need to
know.
6.4. Configuring your modem and serial port
In order to connect to a PPP server and to obtain the best possible
data transfer rate, your modem needs to be configured correctly.
Similarly, the serial ports on your modem and computer need to be set
up correctly.
Section ``Configuring your modem and serial port'' provides
information on this.
6.5. Setting up Name to Address Resolution (DNS)
In addition to the files that run PPP and perform the automated log in
to the PPP server, there are a number of text configuration files that
have to be set up for your computer to be able to resolve names like
www.interweft.com.au to the IP address that is actually used to
contact that computer. These are:-
· /etc/resolv.conf
· /etc/host.conf
Section ``Setting up Name to Address Resolution'' for details on
setting this up.
In particular, you do NOT need to run a name server on your Linux PC
in order to connect to the Internet (although you may wish to). All
you need is to know the IP number of at least one name server that you
can use (preferably one at your ISPs site).
6.6. PPP and root Privileges
As establishing a PPP link between you Linux computer and another PPP
server requires manipulation of network devices (the PPP interface is
a network interface) and the kernel routing table, pppd requires root
privileges.
For details on this, see section ``Using PPP and root privileges''.
6.7. Checking your distribution PPP Files and setting up the PPP
Options
There are a number of configuration and dialer files that need to be
set up to get PPP operational. There are examples as part of the PPP
distribution and this section shows what files you should have:-
______________________________________________________________________
/etc/ppp/options
/etc/ppp/scripts/ppp-on
/etc/ppp/scripts/ppp-on-dialer
/etc/ppp/options.tpl
______________________________________________________________________
You may need to create some additional files depending on exactly what
you are aiming to achieve with PPP:-
______________________________________________________________________
/etc/ppp/options.ttyXX
/etc/ppp/ip-up
/etc/ppp/pap-secrets
/etc/ppp/chap-secrets
______________________________________________________________________
In addition, the PPP daemon can use a large number of command line
options and it is important to use the right ones; so this section
takes you through the standard PPP options and helps you choose the
options you should use.
For details on this, see ``Setting up the PPP connection files''.
6.8. If your PPP server uses PAP (Password Authentication Protocol)
Many ISPs and corporate PPP servers use PAP. If your server does not
require you to use PAP (if you can log in manually and receive the
standard user name/password text based prompts it does not use PAP),
you can safely ignore this section.
Instead of logging into such a server using a user name and password
when prompted to enter them by the server, a PPP server using PAP does
not require a text based login.
The user authentication information instead is exchanged as part of
the link control protocol (LCP) which is the first part of
establishing a PPP link.
Section ``If your PPP server uses PAP (Password Authentication
Protocol)'' provides information on the files you need to set up to
establish a PPP link using PAP.
6.9. Connecting to the PPP server by hand
Having set up the basic files, it is a good idea to test these by
connecting (using minicom or seyon) and starting pppd on your Linux PC
by hand.
See Section ``Setting up the PPP connection manually'' for full
details of setting this up.
6.10. Automating your PPP Connection
Once you are able to log in by hand, you can now move to setting up a
set of scripts that will automate the establishment of the connection.
Section ``Automating your connections - Creating the connection
scripts'' covers setting up the necessary scripts, with considerable
attention paid to chat and scripting the login process to the PPP
server.
This section discusses scripts for user name/password authentication
as well as scripts for PAP/CHAP authenticating servers.
6.11. Shutting down the link
Once your link is up and working, you need to be able to deactivate
the link.
This is covered in Section ``Shutting down the PPP link''.
6.12. If you have problems
Many people have problems getting PPP to work straight away. The
variation in PPP servers and how they require you to set up the
connection is enormous. Similarly, there are many options to PPP - and
some combinations of these just do not work together, ever.
In addition to the problems of logging in and starting the PPP
service, there are problems with the modems and the actual telephone
lines as well!
Section ``Fixing problems'' provides some basic information about
common errors, how to isolate these and fix them.
This is NOT intended to provide more than just the basics. Al Longyear
maintains the PPP-FAQ which contains much more information on this
topic!
6.13. After the link comes up
Once a PPP link is operational (specifically, once the IP layer is
operational), Linux PPP can automatically run (as the root user), a
script to perform any function you can write a script to accomplish.
Section ``After the link comes up'' provides information on the
/etc/ppp/ip-up script, the parameters it receives from PPP and how to
use it to do things like acquire your email from your ISP account,
send any queued email waiting transmission on your machine and such.
6.14. Problems with standard IP services on a Dynamic IP number PPP
link
As noted in the introduction, dynamic IP numbers affect the ability of
your Linux PC to act as a server on the Internet.
Section ``Problems with standard IP services on a Dynamic IP number
PPP link'' provides information on the (main) services affected and
what you can do (if anything) to overcome this.
7. Configuring your Linux Kernel
In order to use PPP, your Linux kernel must be compiled to include PPP
support. Obtain the Linux source code for your kernel if you do not
already have this - it belongs in /usr/src/linux on Linux's standard
file system.
Check out this directory - many Linux distributions install the source
tree (the files and subdirectories) as part of their installation
process.
At bootup, your Linux kernel prints out a great deal of information.
Amongst this is information about PPP support if the kernel includes
this. To view this information, look at your syslog file or use dmesg
| less to display the information to the screen. If your kernel
includes PPP support, you will see lines like
______________________________________________________________________
PPP Dynamic channel allocation code copyright 1995 Caldera, Inc.
PPP line discipline registered.
______________________________________________________________________
(this is for the Linux 2.0.x kernel series).
Linux kernel sources can be obtained by ftp from sunsite.unc.edu or
its mirror sites.
7.1. Installing the Linux Kernel source
The following are brief instructions for obtaining and installing the
Linux kernel sources. Full information can be obtained from The Linux
Kernel HOWTO <http://sunsite.unc.edu/mdw/HOWTO/Kernel-HOWTO.html>.
In order to install and compile the Linux kernel, you need to be
logged in as root.
1. Change directory to the /usr/src directory
cd /usr/src
2. Check in /usr/src/linux to see if you already have the sources
installed.
3. If you don't have the sources, get them from Linux kernel source
directory <ftp://sunsite.unc.edu/pub/Linux/kernel/v2.0> or your
nearest mirror.
If you are looking for earlier versions of the kernel (such as
1.2.X), these are kept in Old Linux kernel source directory
<ftp://sunsite.unc.edu/pub/Linux/kernel/old>.
4. Choose the appropriate kernel - usually the most recent one
available is what you are looking for. Retrieve this and put the
source tar file in /usr/src.
Note: a 'tar' file is an archive - possibly compressed (as are the
Linux kernel source tar files) containing many files in a number of
directories. It is the Linux equivalent of a DOS multi-directory
zip file.
5. If you already have the Linux sources installed but are upgrading
to a new kernel, you must remove the old sources. Use the command
rm -rf /usr/src/linux
6. Now uncompress and extract the sources using the command
tar xzf linux-2.0.XX.tar.gz
7. Now, cd /usr/src/linux and read the README file. This contains an
excellent explanation of how to go about configuring and compiling
a new kernel. Read this file (it's a good idea to print it out and
have a copy handy whilst you are compiling until you have done this
enough times to know your way around).
7.2. Knowing your hardware
You MUST know what cards/devices you have inside your PC if you are
going to recompile your kernel!!! For some devices (such as sound
cards) you will also need to know various settings (such as IRQ's, I/O
addresses and such).
7.3. Kernel compilation - the Linux 1.2.13 kernel
To start the configuration process, follow the instructions in the
README file to properly install the sources. You start the kernel
configuration process with
make config
In order to use PPP, you must configure the kernel to include PPP
support (PPP requires BOTH pppd AND kernel support for PPP).
______________________________________________________________________
PPP (point-to-point) support (CONFIG_PPP) [n] y
______________________________________________________________________
Answer the other make config questions according to the hardware in
your PC and the features of the Linux operating system you want. Then
continue to follow the README to compile and install your new kernel.
The 1.2.13 kernel creates only 4 PPP devices. For multi- port serial
cards, you will need to edit the kernel PPP sources to obtain more
ports. (See the README.linux file that comes as part of the PPP-2.1.2
distribution for full details of the simple edits you need to make).
Note: the 1.2.13 configuration dialogue does NOT allow you to go
backwards - so if you make a mistake in answering one of the questions
in the make config dialogue, exit by typing CTRL C and start again.
7.4. Kernel compilation - the Linux 1.3.x and 2.0.x kernels
For Linux 1.3.x and 2.0.x, you can use a similar process as for Linux
1.2.13. Again, follow the instructions in the README file to properly
install the sources. You start the kernel configuration process with
make config
However, you also have the choice of
make menuconfig
This provides a menu based configuration system with online help that
allows you to move backwards and forwards in the configuration
process.
There is also a highly recommended X windows based configuration
interface
make xconfig
You can compile PPP support directly into your kernel or as a loadable
module.
If you only use PPP some of the time that your Linux machine is
operating, then compiling PPP support as a loadable module is
recommended. Using 'kerneld', your kernel will automatically load the
module(s) required to provide PPP support when you start your PPP link
process. This saves valuable memory space: no part of the kernel can
be swapped out of memory, but loadable modules are automatically
removed if they are not in use.
To do this, you need to enable loadable module support:-
______________________________________________________________________
Enable loadable module support (CONFIG_MODULES) [Y/n/?] y
______________________________________________________________________
To add PPP kernel support, answer the following question:-
______________________________________________________________________
PPP (point-to-point) support (CONFIG_PPP) [M/n/y/?]
______________________________________________________________________
For a PPP loadable module, answer M, otherwise for PPP compiled in as
part of the kernel, answer Y.
Unlike kernel 1.2.13, kernel 2.0.x creates PPP devices on the fly as
needed and it is not necessary to hack the sources to increase
available PPP device numbers at all.
7.5. Note on PPP-2.2 and /proc/net/dev
If you are using PPP-2.2, you will find that a side effect of the 'on
the fly' creation of the PPP devices is that no devices show up if you
look in the /proc/net file system until a device is created by
starting up pppd:-
______________________________________________________________________
[hartr@archenland hartr]$ cat /proc/net/dev
Inter-| Receive | Transmit
face |packets errs drop fifo frame|packets errs drop fifo colls carrier
lo: 92792 0 0 0 0 92792 0 0 0 0 0
eth0: 621737 13 13 0 23 501621 0 0 0 1309 0
______________________________________________________________________
Once you have one (or more) ppp services started, you will see entries
such as this (from a ppp server):-
______________________________________________________________________
[root@kepler /root]# cat /proc/net/dev
Inter-| Receive | Transmit
face |packets errs drop fifo frame|packets errs drop fifo colls carrier
lo: 428021 0 0 0 0 428021 0 0 0 0 0
eth0:4788257 648 648 319 650 1423836 0 0 0 4623 5
ppp0: 2103 3 3 0 0 2017 0 0 0 0 0
ppp1: 10008 0 0 0 0 8782 0 0 0 0 0
ppp2: 305 0 0 0 0 297 0 0 0 0 0
ppp3: 6720 7 7 0 0 7498 0 0 0 0 0
ppp4: 118231 725 725 0 0 117791 0 0 0 0 0
ppp5: 38915 5 5 0 0 28309 0 0 0 0 0
______________________________________________________________________
7.6. General kernel config considerations for PPP
If you are setting up your Linux PC as a PPP server, you must compile
in IP forwarding support. This is also necessary if you want to use
Linux to link to LANs together or your LAN to the Internet.
If you are linking a LAN to the Internet (or linking together two
LANs), you should be concerned about security. Adding support for IP
fire walls to the kernel is probably a MUST!
You will also need this if you want to use IP masquerade to connect a
LAN that uses any of the above mentioned 'unconnected' IP network
numbers.
To enable IP Masquerade and IP fire walling, you MUST answer yes to
the first question in the make config process:-
______________________________________________________________________
Prompt for development and/or incomplete code/drivers (CONFIG_EXPERIMENTAL)?
______________________________________________________________________
Whilst this may sound a bit off-putting to new users, many users are
actively using the IP Masquerade and IP fire walling features of the
Linux 2.0.XX kernel with no problems.
Once you have installed and rebooted your new kernel, you can start
configuring and testing your PPP link(s).
8. Getting the Information you need about the PPP server
Before you can establish a PPP connection with a server, you need to
obtain the following information (from the sysadmin/user support
people of the PPP server):-
· The telephone number(s) to dial for the service
If you are behind a PABX, you also need the PABX number that gives
you an outside dial tone - this is frequently digit zero (0) or
nine (9).
· Does the server use DYNAMIC or STATIC IP numbers?
If the server uses STATIC IP numbers, then you may need to know
what IP number to use for your end of the PPP connection. If your
ISP is providing you with a subnet of valid IP numbers, you will
need to know the IP numbers you can use and the network mask
(netmask).
Most Internet Service Providers use DYNAMIC IP numbers. As
mentioned above, this has some implications in terms of the
services you can use.
However, even if you are using STATIC IP numbers, most PPP servers
will never (for security reasons) allow the client to specify an IP
number as this is a security risk. You do still need to know this
information!
· What are the IP numbers of the ISPs Domain Name Servers?
There should be at least two although only one is needed.
There could be a problem here. The MS Windows 95 PPP setup allows
the DNS address to be passed to the client as part of its
connection process. So your ISP (or corporate help desk) may well
tell you you don't need the IP address of the DNS server(s).
For Linux, you DO need the address of at least one DNS. The linux
implementation of PPP does not allow the setting of the DNS IP
number dynamically at connection time - and quite possibly will
never do so.
Note: whilst Linux (as a PPP client) cannot accept the DNS address
from a server, it can, when acting as a server, pass this
information to clients using the dns-addr pppd option.
· Does the server require the use of PAP/CHAP?
If this is the case you need to know the "id" and "secret" you are
to use in connecting. (These are probably your user name and
password at your ISP).
· Does the server automatically start PPP or do you need to issue any
commands to start PPP on the server once you are logged in?
If you must issue a command to start PPP, what is it?
· Is the server a Microsoft Windows NT system and, if so, is it using
the MS PAP/CHAP system?
Many corporate LANs seem to use MS Windows NT this way for
increased security.
Carefully note down this information - you are going to use it!
9. Configuring your modem and serial port
You should make sure that your modem is correctly set up and that you
know which serial port it is connected to.
Remember:-
· DOS com1: = Linux /dev/cua0 (and /dev/ttyS0)
· DOS com2: = Linux /dev/cua1 (and /dev/ttyS1)
et cetera
It is also worth remembering that if you have 4 serial ports, the
standard PC set up is to have com1 and com3 share IRQ4 and com2 and
com4 share IRQ3.
If you have devices on standard serial ports that share an IRQ with
your modem you are going to have problems. You need to make sure that
your modem serial port is on its own, unique IRQ. Many modern serial
cards (and better quality motherboard serial ports) allow you to move
the IRQ of the serial ports around.
If you are running Linux kernel 2, you can check the in-use IRQs using
cat /proc/interrupts, which will produce output like
______________________________________________________________________
0: 6766283 timer
1: 91545 keyboard
2: 0 cascade
4: 156944 + serial
7: 101764 WD8013
10: 134365 + BusLogic BT-958
13: 1 math error
15: 3671702 + serial
______________________________________________________________________
This shows a serial port on IRQ4 (a mouse) and a serial port on IRQ15
(the permanent modem based PPP link to the Internet. (There is also a
serial port on com2, IRQ3 and com4 is on IRQ14, but as they are not in
use, they do not show up).
Be warned - you need to know what you are doing if you are going to
play with your IRQs! Not only do you have to open up you computer,
pull out cards and play with jumpers, but you need to know what is on
which IRQ. In my case, this is a totally SCSI based PC, and so I can
disable the on motherboard IDE interfaces that normally use IRQ14 and
15!
You should also remember that if your PC boots other operating
systems, moving IRQs around may well mean that OS cannot boot properly
- or at all!
If you do move your serial ports to non-standard IRQs, then you need
to tell Linux which IRQ each port is using. This is done using
setserial and is best done as part of the boot process in rc.local or
rc.serial which is called from rc.local or as part of the SysV
initialisation. For the machine illustrated above, the commands used
are
______________________________________________________________________
/bin/setserial -b /dev/ttyS2 IRQ 11
/bin/setserial -b /dev/ttyS3 IRQ 15
______________________________________________________________________
However, if you are using serial modules dynamically loaded when
required by the kerneld process, you cannot set and forget the IRQ etc
once at boot time. This is because if the serial module is unloaded,
Linux forgets the special settings.
So, if you are loading the serial module on demand, you will need to
reconfigure the IRQs etc each time the module is loaded.
9.1. A note about serial ports and speed capabilities
If you are using a high speed (external) modem (14,400 Baud or above),
your serial port needs to be capable of handling the throughput that
such a modem is capable of producing, particularly when the modems are
compressing the data.
This requires your serial port to use a modern UART (Universal
Asynchronous Receiver Transmitter) such as a 16550(A). If you are
using an old machine (or old serial card), it is quite possible that
your serial port has only an 8250 UART, which will cause you
considerable problems when used with a high speed modem.
Use the command
setserial -a /dev/ttySx
to get Linux to report to you the type of UART you have. If you do not
have a 16550A type UART, invest in a new serial card (available for
under $50). When you purchase a new card, make sure you can move the
IRQs around on it!
Note: the first versions of the 16550 UART chip had an error. This was
rapidly discovered and a revision of the chip was released - the
16550A UART. A relatively small number of the faulty chips did however
get into circulation. It is unlikely that you will encounter one of
these but you should look for a response that says 16550A,
particularly on serial cards of some vintage.
9.2. Serial Port Names
Historically, Linux used cuaX devices for dial out and ttySx devices
for dial in.
The kernel code that required this was changed in kernel version 2.0.x
and you should now use ttySx for both dial in and dial out. I
understand that the cuaX device names may well disappear in future
kernel versions.
9.3. Configuring your modem
You will need to configure your modem correctly for PPP - to do this
READ YOUR MODEM MANUAL! Most modems come with a factory default
setting that selects the options required for PPP. The minimum
configuration specifies:-
· Hardware flow control (RTS/CTS) (&K3 on many Hayes modems)
Other settings (in standard Hayes commands) you should investigate
are:-
· E1 Command/usr/src/linux-2.0.27/include/linux/serial.h Echo ON
(required for chat to operate)
· Q0 Report result codes (required for chat to operate)
· S0=0 Auto Answer OFF (unless you want your modem to answer the
phone)
· &C1 Carrier Detect ON only after connect
· &S0 Data Set Ready (DSR) always ON
· (depends) Data Terminal Ready
There is a site offering modem setups for a growing variety of modem
makes and models at Modem setup information
<http://www.in.net/info/modems/index.html> which may assist you in
this.
It is also worth while investigating how the modem's serial interface
between your computer and modem operates. Most modern modems allow you
to run the serial interface at a FIXED speed whilst allowing the
telephone line interface to change its speed to the highest speed it
and the remote modem can both handle.
This is known as split speed operation. If your modem supports this,
lock the modem's serial interface to its highest available speed
(usually 115,200 baud but maybe 38,400 baud for 14,400 baud modems).
Use your communications software (e.g. minicom or seyon) to find out
about your modem configuration and set it to what is required for PPP.
Many modems report their current settings in response to AT&V, but you
should consult your modem manual.
If you completely mess up the settings, you can return to sanity
(usually) by issuing an AT&F - return to factory settings. (For most
modem modems I have encountered, the factory settings include all you
need for PPP - but you should check).
Once you have worked out the modem setup string required write it
down. You now have a decision: you can store these settings in your
modem non-volatile memory so they can be recalled by issuing the
appropriate AT command. Alternatively you can pass the correct
settings to your modem as part of the PPP dialing process.
If you only use your modem from Linux to call into your ISP or
corporate server, the simplest set up will have you save your modem
configuration in non-volatile RAM.
If on the other hand, you modem is used by other applications and
operating systems, it is safest to pass this information to the modem
as each call is made so that the modem is guaranteed to be in the
correct state for the call. (This has the added advantage also of
recording the modem setup string in case the modem looses the
contents of its NV-RAM, which can indeed happen).
9.4. Note on Serial Flow Control
When data is traveling on serial communication lines, it can happen
that data arrives faster than a computer can handle it (the computer
may be busy doing something else - remember, Linux is a multi-user,
multi- tasking operating system). In order to ensure that data is not
lost (data does not over run in the input buffer and hence get lost),
some method of controlling the flow of data is necessary.
There are two ways of doing this on serial lines:-
· Using hardware signals (Clear To Send/Request to Send - CTS/RTS)
· Using software signals (control S and control Q, also known as
XON/XOFF).
Whilst the latter may be fine for a terminal (text) link, data on a
PPP link uses all 8 bits - and it is quite probable that somewhere in
the data there will be data bytes that translate as control S and
control Q. So, if a modem is set up to use software flow control,
things can rapidly go berserk!
For high speed links using PPP (which uses 8 bits of data) hardware
flow control is vital and it is for this reason that you must use
hardware flow control.
9.5. Testing your modem for dial out
Now that you have sorted out the serial port and modem settings it is
a good idea to make sure that these setting do indeed work by dialing
you ISP and seeing if you can connect.
Using you terminal communications package (such as minicom), set up
the modem initialisation required for PPP and dial into the PPP server
you want to connect to with a PPP session.
(Note: at this stage we are NOT trying to make a PPP connection - just
establishing that we have the right phone number and also to find