home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 13 / CDA13.ISO / DOC / HOWTO / PPP_HOWT.GZ / PPP_HOWT
Encoding:
Text File  |  1996-08-25  |  121.4 KB  |  2,917 lines

  1.   Linux PPP HOWTO
  2.   Robert Hart, hartr@hedland.edu.au
  3.   v2.2, 25 August 1996
  4.  
  5.   This document shows how to connect your Linux PC to a PPP server, how
  6.   to use PPP to link two LANs together and provides one method of set¡
  7.   ting up your Linux computer as a PPP server.
  8.  
  9.   Copyright
  10.  
  11.   The copyright of this document is retained by the author.  Permission
  12.   is granted to distribute the document by electronic means and  on CDs
  13.   provided that it is kept entirely in its original format. Permission
  14.   is also granted to print a copy of this document for personal use.
  15.  
  16.   The republishing of this document in part or in whole without the
  17.   permission of the copyright holder by any means other than as noted
  18.   above is prohibited.
  19.  
  20.   Distribution
  21.  
  22.   This document will be posted to comp.os.linux.answers as new versions
  23.   of the document are produced.It is also available in HTML format at:-
  24.  
  25.   ╖  Linux Howto Index <http://sunsite.unc.edu/mdw/linux.html#howto>
  26.  
  27.   Other formats (SGML, ASCII, postscript, DVI) are available from Howtos
  28.   - other formats <ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/other-
  29.   formats>
  30.  
  31.   As sunsite.unc.edu carries a very heavy load, please use an
  32.   appropriate mirror site closest to you.
  33.  
  34.   Acknowledgements
  35.  
  36.   A growing number of people have provided me with assistance in
  37.   preparing this document. Special thanks go to Al Longyear for the
  38.   guidance on PPP itself (if there are mistakes here, they are mine not
  39.   his), Greg Hankins (maintainer of the Linux Howto system) and Daniel
  40.   Berinson for assistance with the linuxdoc-sgml package when it started
  41.   to choke on my text (3 days before a publication dead line, no less!)
  42.   and Debi Tackett (of MaximumAccess.com) for many helpful suggestions
  43.   on style, content order, logic and clarity of explanations.
  44.  
  45.   Finally, to the many people who have contacted me by email offering
  46.   comments - my thanks. As with all HOWTO authors,  the satisfaction of
  47.   helping is all the payment we receive and it is enough. By writing
  48.   this HOWTO I am repaying in a small way the debt I - and all other
  49.   Linux users - owe to the people who write and maintain our OS of
  50.   choice.
  51.  
  52.   1.  Introduction
  53.  
  54.   PPP (the Point to Point Protocol) is a mechanism for creating and
  55.   running IP  (the Internet Protocol) and other network protocols over a
  56.   serial link - be that a direct serial connection (using a null-modem
  57.   cable), over a telnet established link or a link made using modems and
  58.   telephone lines. Using PPP, you can connect your Linux PC to a PPP
  59.   server and access the resources of the network to which the server is
  60.   connected (almost) as if you were directly connected to that network.
  61.  
  62.   You can also set up your Linux PC as a PPP server, so that other
  63.   computers can dial into your computer and access the resources on your
  64.   local PC and/or network.
  65.  
  66.   As PPP is a peer-to-peer system, you can also use PPP on two Linux PCs
  67.   to link together two networks (or a local network to the Internet).
  68.  
  69.   One major difference between PPP and an Ethernet connection is of
  70.   course speed - a standard Ethernet connection operates at 10 Mbs
  71.   (million bits per second) maximum theoretical throughput, whereas a
  72.   modem operates at speeds up to 33.6 kbps (thousand bits per second).
  73.   Also, depending on the type of PPP connection, there may be some
  74.   limitations in usage of some applications and services.
  75.  
  76.   1.1.  Clients and Servers
  77.  
  78.   PPP is strictly a peer to peer protocol; there is (technically) no
  79.   difference between the machine that dials in and the machine that is
  80.   dialed into. However, for clarity's sake, it is useful to think in
  81.   terms of servers and clients.
  82.  
  83.   When you dial into a site to establish a PPP connection, you are a
  84.   client. The machine to which you connect is the server.
  85.  
  86.   When you are setting up a Linux box to receive and handle dial in PPP
  87.   connections, you are setting up a PPP server.
  88.  
  89.   Any Linux PC can be both a PPP server and client - even simultaneously
  90.   if you have more than one serial port (and modem if necessary). As
  91.   stated above, there is no real difference between clients and servers
  92.   as far as PPP is concerned, once the connection is made.
  93.  
  94.   This document refers to the machine that initiates the call (that
  95.   "dials in") as the CLIENT, whilst the machine that answers the
  96.   telephone, checks the authentication of the dial in request (using
  97.   user ids, passwords and possibly other mechanisms) is referred to as
  98.   the SERVER.
  99.  
  100.   The use of PPP as a client to link one or more machines at a location
  101.   into the Internet is probably, the one in which  most people are
  102.   interested - that is using their PC as a client.
  103.  
  104.   The procedure described in this document will allow you to establish
  105.   and automate your Internet connection.
  106.  
  107.   This document will also give you guidance in setting up your Linux PC
  108.   as a PPP server and in linking two LANs together (with full routing)
  109.   using PPP (this is frequently characterised as establishing a WAN -
  110.   wide area network - link).
  111.   1.2.  Differences between Linux distributions
  112.  
  113.   There are many different Linux distributions and they all have their
  114.   own idiosyncrasies and ways of doing things.
  115.  
  116.   In particular, there are two different ways a Linux (and Unix)
  117.   computer actually starts up, configures its interfaces and so forth.
  118.  
  119.   These are BSD style system initialisation and System V system
  120.   initialisation. If you dip into some of the Unix news groups, you will
  121.   find occasional religious wars between proponents of these two
  122.   systems. If that sort of thing amuses you, have fun burning bandwidth
  123.   and join in!
  124.  
  125.   Possibly the two most widely used distributions are
  126.  
  127.   ╖  Slackware
  128.      which uses BSD style system initialisation
  129.  
  130.   ╖  Red Hat (and its sibling Caldera)
  131.      which uses SysV system initialisation
  132.  
  133.   BSD style initialisation keeps its initialisation files in /etc/...
  134.   and these files are:-
  135.  
  136.   ______________________________________________________________________
  137.           /etc/rc
  138.           /etc/rc.local
  139.           /etc/rc.serial
  140.   ______________________________________________________________________
  141.  
  142.   System V initialisation keeps its initialisation files in
  143.   /etc/rc.d/... and a number of subdirectories under there:-
  144.  
  145.   ______________________________________________________________________
  146.   drwxr-xr-x   2 root     root         1024 Jul  6 15:12 init.d
  147.   -rwxr-xr-x   1 root     root         1776 Feb  9 05:01 rc
  148.   -rwxr-xr-x   1 root     root          820 Jan  2  1996 rc.local
  149.   -rwxr-xr-x   1 root     root         2567 Jul  5 20:30 rc.sysinit
  150.   drwxr-xr-x   2 root     root         1024 Jul  6 15:12 rc0.d
  151.   drwxr-xr-x   2 root     root         1024 Jul  6 15:12 rc1.d
  152.   drwxr-xr-x   2 root     root         1024 Jul  6 15:12 rc2.d
  153.   drwxr-xr-x   2 root     root         1024 Jul 18 18:07 rc3.d
  154.   drwxr-xr-x   2 root     root         1024 May 27  1995 rc4.d
  155.   drwxr-xr-x   2 root     root         1024 Jul  6 15:12 rc5.d
  156.   drwxr-xr-x   2 root     root         1024 Jul  6 15:12 rc6.d
  157.   ______________________________________________________________________
  158.  
  159.   If you are trying to track down where your Ethernet interface and
  160.   associated network routes are actually configured, you will need to
  161.   track through these files to actually find where the actual commands
  162.   are that do this.
  163.  
  164.   On some installations (for example Red Hat and Caldera), there is a X
  165.   Windows configured PPP dial up system. This HOWTO does not cover these
  166.   distribution specific tools. If you are having problems with them,
  167.   contact the distributors directly!
  168.  
  169.   2.  IP Numbers
  170.  
  171.   Every device that connects to the Internet must have its own, unique
  172.   IP number. These are assigned centrally by a designated authority for
  173.   each country.
  174.  
  175.   If you are connecting a local area network (LAN) to the Internet, YOU
  176.   MUST use an IP number from your own assigned network range for all the
  177.   computers and devices you have on your LAN. You MUST NOT pick IP
  178.   numbers out of the air and use these whilst connecting to another LAN
  179.   (let alone the Internet). At worst this will simply not work at all
  180.   and could cause total havoc as your 'stolen' IP number starts
  181.   interfering with the communications of another computer that is
  182.   already using the IP number you have picked out of the air.
  183.  
  184.   Please note that the IP numbers used throughout this document (with
  185.   some exceptions) are from the 'unconnected network numbers' series
  186.   that are reserved for use by networks that are not (ever) connected to
  187.   the Internet.
  188.  
  189.   There are IP numbers that are specifically dedicated to LANs that do
  190.   not connect to the Internet. The IP number sequences are:-
  191.  
  192.   ╖  One A Class Address
  193.      10.0.0.0 - 10.255.255.255
  194.  
  195.   ╖  16 B Class Addresses
  196.      172.16.0.0 - 172.31.255.255
  197.  
  198.   ╖  256 C Class Addresses
  199.      192.168.0.0 - 192.168.255.255
  200.  
  201.   If you have a LAN for which you have not been allocated IP numbers by
  202.   the responsible authority in your country, you should use one of the
  203.   network numbers from the above sequences for your machines.
  204.  
  205.   These numbers should never be used on the Internet. However, they can
  206.   be used for the local Ethernet on a machine that is connecting to the
  207.   Internet. This is because IP numbers are actually allocated to a
  208.   network interface, not to a computer. So whilst your Ethernet
  209.   interface may use 10.0.0.1 (for example), when you hook onto the
  210.   Internet using PPP, your PPP interface will be given another (and
  211.   valid) IP number by the server. Your PC will have Internet
  212.   connectivity, but the other computers on your LAN will not.
  213.  
  214.   However, using Linux and the IP masquerade capabilities of the ipfwadm
  215.   software, you can connect the rest of your LAN to the Internet (with
  216.   some restriction of services).
  217.  
  218.   For more information on how to do this see the IP Masquerade mini-
  219.   HOWTO at Linux IP Masquerade mini HOWTO
  220.   <http://sunsite.unc.edu/mdw/HOWTO/mini/IP-Masquerade>
  221.  
  222.   For most users, who are connecting a single machine to an Internet
  223.   service provider via PPP, obtaining an IP number (or more accurately,
  224.   a network number) will not be necessary.
  225.  
  226.   If you wish to connect a small LAN to the Internet, many Internet
  227.   Service Providers (ISPs) can provide you with a dedicated subnet (a
  228.   specific sequence of IP numbers) from their existing IP address space.
  229.  
  230.   For users, who are connecting a single PC to the Internet via an ISP,
  231.   most providers use dynamic IP number assignment. That is, as part of
  232.   the connection process, the PPP service you contact will tell your
  233.   machine what IP number to use for the PPP interface during the current
  234.   session.
  235.  
  236.   With dynamic IP numbers, you are not given the same IP number each
  237.   time you connect. This has implications for server type applications
  238.   on your Linux machine such as sendmail, ftpd, httpd and so forth. The
  239.   limitations of service due to dynamic IP number assignment (and ways
  240.   to work around these, where possible) are discussed later in the
  241.   document.
  242.  
  243.   3.  Aim of this Document
  244.  
  245.   3.1.  Setting up a PPP Client
  246.  
  247.   This document provides guidance to people who wish to use Linux and
  248.   PPP to dial into a PPP server and set up an IP connection using PPP.
  249.   It assumes that PPP has been compiled and installed on your Linux
  250.   machine (but does briefly cover reconfiguring/recompiling your kernel
  251.   to include PPP support).
  252.  
  253.   3.1.1.  Using DIP - don't, use CHAT instead
  254.  
  255.   Whilst DIP (the standard way of creating a SLIP connection) can be
  256.   used to forge a PPP connection, DIP scripts are generally quite
  257.   complex. For this reason, this document does NOT cover using DIP to
  258.   forge a PPP connection.
  259.  
  260.   Instead, this document describes the standard Linux PPP software
  261.   (chat/pppd).
  262.  
  263.   3.2.  Setting up a PPP server
  264.  
  265.   This document provides guidance on how to configure your Linux PC as a
  266.   PPP server (allowing other people to dial into your Linux PC and
  267.   establish a PPP connection).
  268.  
  269.   You should note that there are a myriad of ways of setting up Linux as
  270.   a PPP server. This document (currently) gives one method - that used
  271.   by the author to set up several small PPP server (each of 16 modems).
  272.  
  273.   This method is known to work well. However, it is not necessarily the
  274.   best method. If other users have particularly clever PPP server
  275.   setups, please feel free to email information on them to the author of
  276.   this HOWTO.
  277.  
  278.   3.3.  Linking two LANs or a LAN to the Internet using PPP
  279.  
  280.   This document provides (basic) information on linking two LANs or a
  281.   LAN to the Internet using PPP.
  282.  
  283.   3.4.  This document at present does NOT cover...
  284.  
  285.   ╖  Connecting and configuring a modem to Linux (in detail)
  286.      See the Serial-HOWTO
  287.  
  288.   ╖  Using DIP to make PPP connections
  289.      Use chat instead...
  290.  
  291.   ╖  Using socks or IP Masquerade
  292.      There are perfectly good documents already covering these two
  293.      packages.
  294.  
  295.   4.  Software versions covered
  296.  
  297.   This HOWTO assumes that you are using a Linux 1.2.x kernel with the
  298.   PPP 2.1.2 software or Linux 1.3.X/2.0.x and PPP 2.2
  299.  
  300.   It is possible to use PPP 2.2.0 with kernel 1.2.13. However, to do so
  301.   requires kernel patches. This document does NOT cover this mix of
  302.   software.
  303.  
  304.   Also, you should particularly not that you cannot use the PPP 2.1.2
  305.   software with Linux kernel version 2.0.X.
  306.  
  307.   Please note that this document does NOT cover problems arising from
  308.   the use of loadable modules for Linux kernel 2.0.x. Please see the
  309.   kerneld mini-HOWTO and the kernel/module 2.0.x documentation (in the
  310.   Linux 2.0.x source tree at /usr/src/linux/Documentation/...).
  311.  
  312.   As this document is designed to assist new users, it is highly
  313.   recommended that you use a version of Linux and the appropriate PPP
  314.   version that are known to be stable together.
  315.  
  316.   5.  Other Useful/Important Documents
  317.  
  318.   Users are advised to read :-
  319.  
  320.   ╖  the documentation that comes with the PPP package
  321.      (Look in /usr/doc...)
  322.  
  323.   ╖  the pppd and chat man pages
  324.      (use man chat and man pppd to explore these)
  325.  
  326.   ╖  the Linux Network Administration Guide (NAG)
  327.      The Network Administrators' Guide <http://sunsite.unc.edu/mdw/LDP-
  328.      books/nag-1.0/nag.html>
  329.  
  330.   ╖  the Net-2/3 HOWTO
  331.      Linux NET-2/3-HOWTO
  332.      <http://sunsite.unc.edu/mdw/HOWTO/NET-2-HOWTO.html>
  333.   ╖  Linux kernel documentation in /usr/src/linux/Documentation
  334.  
  335.   ╖  The excellent Unix/Linux books published by O'Reilly and
  336.      Associates. (O'Reilly and Associates On-Line Catalogue <
  337.      http://www.ora.com/>). If you are new to Unix/Linux, run (don't
  338.      walk) to your nearest computer book shop and invest in a number of
  339.      these immediately!
  340.  
  341.   The best general starting point for Linux documentation is The Linux
  342.   Documentation Project Home Page <http://sunsite.unc.edu/mdw/>
  343.  
  344.   Whilst you can use this document to create your PPP link without
  345.   reading any of these documents, you will have a far better
  346.   understanding of what is going on if you do so! You will also be able
  347.   to address problems yourself (or at least ask more intelligent
  348.   questions on the comp.os.linux... newsgroups).
  349.  
  350.   These documents (as well as various others, including the relevant
  351.   RFCs) provide additional and more detailed explanation than is
  352.   possible in this HOWTO.
  353.  
  354.   If you are connecting a LAN to the Internet using PPP, you will need
  355.   to know a reasonable amount about TCP/IP networking. In addition to
  356.   the documents above, you will find the O'Reilly books "TCP/IP Network
  357.   Administration" and "Building Internet Firewalls" of considerable
  358.   benefit!
  359.  
  360.   5.1.  Useful Linux Mailing Lists
  361.  
  362.   There are many Linux mailing lists that operate as a means of
  363.   communication between users of many levels of ability. By all means
  364.   subscribe to those that interest you and contribute your expertise and
  365.   views.
  366.  
  367.   A word to the wise: some lists are specifically aimed at "high
  368.   powered" users and/or specific topics. Whilst no-one will complain if
  369.   you 'lurk' (subscribe but don't post messages), you are likely to earn
  370.   heated comments (if not outright flames) if you post 'newbie'
  371.   questions to inappropriate lists! This is not because guru level users
  372.   hate new users, but because these lists are there to handle the
  373.   specific issues at particular levels of difficulty.
  374.  
  375.   By all means join the lists that offer open subscription, but keep you
  376.   comments relevant to the subject of the list!
  377.  
  378.   A good starting point for Linux mailing lists is Linux Mailing List
  379.   Directory <http://summer.snu.ac.kr/~djshin/linux/mail-
  380.   list/index.shtml>
  381.  
  382.   6.  Configuring your Linux Kernel
  383.  
  384.   In order to use PPP, your Linux kernel must be compiled to include PPP
  385.   support. Obtain the Linux source code for your kernel if you do not
  386.   already have this - it belongs in /usr/src/linux on Linux's standard
  387.   file system.
  388.  
  389.   Check out this directory - many Linux distributions install the source
  390.   tree (the files and subdirectories) as part of their installation
  391.   process.
  392.  
  393.   Linux kernel sources can be obtained by ftp from sunsite.unc.edu or
  394.   its mirror sites.
  395.  
  396.   6.1.  Installing the Linux Kernel source
  397.  
  398.   The following are brief instructions for obtaining and installing the
  399.   Linux kernel sources. Full information can be obtained from The Linux
  400.   Kernel HOWTO <http://sunsite.unc.edu/mdw/HOWTO/Kernel-HOWTO.html>.
  401.  
  402.   In order to install and compile the Linux kernel, you need to be
  403.   logged in as root.
  404.  
  405.   1. Change to the /usr/src directory
  406.      cd /usr/src
  407.  
  408.   2. Check in /usr/src/linux to see if you already have the sources
  409.      installed.
  410.  
  411.   3. If you don't have the sources, get them from Linux kernel source
  412.      directory <ftp://sunsite.unc.edu/pub/Linux/kernel/v2.0>
  413.      If you are looking for earlier versions of the kernel (such as
  414.      1.2.X), these are kept in Old Linux kernel source directory
  415.      <ftp://sunsite.unc.edu/pub/Linux/kernel/old>.
  416.  
  417.   4. Choose the appropriate kernel - usually the most recent one
  418.      available is what you are looking for. Retrieve this and put the
  419.      source tar file in /usr/src.
  420.      Note: a 'tar' file is an archive - possibly compressed, as are the
  421.      Linux kernel source tar files - containing many files in a number
  422.      of directories. It is the Linux equivalent of a DOS zip file.
  423.  
  424.   5. If you already have the Linux sources installed but are upgrading
  425.      to a new kernel, you must remove the old sources. Use the command
  426.      rm -rf /usr/src/linux
  427.  
  428.   6. Now uncompress and extract the sources using the command
  429.      tar xzf linux-2.0.6.tar.gz
  430.  
  431.   7. Now, cd /usr/src/linux and read the README file. This contains an
  432.      excellent explanation of how to go about configuring and compiling
  433.      a new kernel. Read this file (it's a good idea to print it out and
  434.      have a copy handy whilst you are compiling until you have done this
  435.      enough times to know your way around).
  436.  
  437.   6.2.  Knowing your hardware
  438.  
  439.   You MUST know what cards/devices you have inside your PC if you are
  440.   going to recompile your kernel!!! For some devices (such as sound
  441.   cards) you will also need to know various settings (such as IRQ's, I/O
  442.   addresses and such).
  443.  
  444.   6.3.  Kernel compilation - the Linux 1.2.13 kernel
  445.  
  446.   To start the configuration process, follow the instructions in the
  447.   README file to properly install the sources. You start the kernel
  448.   configuration process with
  449.  
  450.        make config
  451.  
  452.   In order to use PPP, you must configure the kernel to include PPP
  453.   support (PPP requires BOTH pppd AND kernel support for PPP).
  454.  
  455.   ______________________________________________________________________
  456.     PPP (point-to-point) support (CONFIG_PPP) [n] y
  457.   ______________________________________________________________________
  458.  
  459.   Answer the other make config questions according to the hardware in
  460.   your PC and the features of the Linux operating system you want. Then
  461.   continue to follow the README to compile and install your new kernel.
  462.  
  463.   The 1.2.13 kernel creates only 4 PPP devices. For multi- port serial
  464.   cards, you will need to edit the kernel PPP sources to obtain more
  465.   ports. (See the README.linux file that comes as part of the PPP-2.1.2
  466.   distribution for full details of the simple edits you need to make).
  467.  
  468.   Note: the 1.2.13 configuration dialogue does NOT allow you to go
  469.   backwards - so if you make a mistake in answering one of the questions
  470.   in the make config dialogue, exit by typing CTRL C and start again.
  471.  
  472.   6.4.  Kernel compilation - the Linux 1.3.x and 2.0.x kernels
  473.  
  474.   For Linux 2.0.x, you can use a similar process as for Linux 1.2.13.
  475.   Again, follow the instructions in the README file to properly install
  476.   the sources. You start the kernel configuration process with
  477.  
  478.        make config
  479.  
  480.   However, you also have the choice of
  481.  
  482.        make menuconfig
  483.  
  484.   This provides a menu based configuration system with online help that
  485.   allows you to jump around in the configuration process.
  486.  
  487.   There is also a highly recommended X windows based configuration
  488.   interface
  489.        make xconfig
  490.  
  491.   You can compile PPP support directly into your kernel or as a loadable
  492.   module. If you only use PPP some of the time that your Linux machine
  493.   is operating, then compiling PPP support as a loadable module is
  494.   recommended. Using 'kerneld', your kernel will automatically load the
  495.   module(s) required to provide PPP support when you start your PPP link
  496.   process. This saves valuable memory space: no part of the kernel can
  497.   be swapped out of memory, but loadable modules are automatically
  498.   removed if they are not in use.
  499.  
  500.   To do this, you need to enable loadable module support:-
  501.  
  502.   ______________________________________________________________________
  503.           Enable loadable module support (CONFIG_MODULES) [Y/n/?] y
  504.   ______________________________________________________________________
  505.  
  506.   To add PPP kernel support, answer the following question:-
  507.  
  508.   ______________________________________________________________________
  509.           PPP (point-to-point) support (CONFIG_PPP) [M/n/y/?]
  510.   ______________________________________________________________________
  511.  
  512.   For a PPP loadable module, answer M, otherwise for PPP compiled in as
  513.   part of the kernel, answer Y.
  514.  
  515.   Unlike kernel 1.2.13, kernel 2.0.x creates PPP devices on the fly as
  516.   needed and it is not necessary to hack the sources to increase
  517.   available PPP device numbers at all.
  518.  
  519.   6.5.  Note on PPP-2.2 and /proc/net/dev
  520.  
  521.   If you are using PPP-2.2, you will find that a side effect of the 'on
  522.   the fly' creation of the ppp devices is that no devices show up if you
  523.   look in the /proc/net file system until a device is created by
  524.   starting up pppd:-
  525.  
  526.   ______________________________________________________________________
  527.   [hartr@archenland hartr]$ cat /proc/net/dev
  528.   Inter-|   Receive                  |  Transmit
  529.    face |packets errs drop fifo frame|packets errs drop fifo colls carrier
  530.       lo:  92792    0    0    0    0    92792    0    0    0     0    0
  531.     eth0: 621737   13   13    0   23   501621    0    0    0  1309    0
  532.   ______________________________________________________________________
  533.  
  534.   Once you have one (or more) ppp services started, you will see entries
  535.   such as this (from our ppp server):-
  536.  
  537.   ______________________________________________________________________
  538.   [root@kepler contrib]# cat /proc/net/dev
  539.   Inter-|   Receive                  |  Transmit
  540.    face |packets errs drop fifo frame|packets errs drop fifo colls carrier
  541.       lo: 428021    0    0    0    0   428021    0    0    0     0    0
  542.     eth0:4788257  648  648  319  650  1423836    0    0    0  4623    5
  543.     ppp0:   2103    3    3    0    0     2017    0    0    0     0    0
  544.     ppp1:  10008    0    0    0    0     8782    0    0    0     0    0
  545.     ppp2:    305    0    0    0    0      297    0    0    0     0    0
  546.     ppp3:   6720    7    7    0    0     7498    0    0    0     0    0
  547.     ppp4: 118231  725  725    0    0   117791    0    0    0     0    0
  548.     ppp5:  38915    5    5    0    0    28309    0    0    0     0    0
  549.   ______________________________________________________________________
  550.  
  551.   6.6.  General kernel config considerations
  552.  
  553.   If you are setting up your Linux PC as a PPP server, you must compile
  554.   in IP forwarding support. This is also necessary if you want to use
  555.   Linux to link to LANs together or your LAN to the Internet.
  556.  
  557.   If you are linking a LAN to the Internet (or linking together two
  558.   LANs), you should be concerned about security. Adding support for IP
  559.   firewalls to the kernel is probably a MUST!
  560.  
  561.   You will also need this if you want to use IP masquerade to connect a
  562.   LAN that uses any of the above mentioned 'unconnected' IP network
  563.   numbers.
  564.  
  565.   Once you have installed and rebooted your new kernel, you can start
  566.   configuring and testing your PPP link(s).
  567.  
  568.   7.  Getting the Information you need about the PPP service
  569.  
  570.   Before you can establish a PPP connection with a server, you need to
  571.   obtain the following information (from the sysadmin/user support
  572.   people of the PPP server):-
  573.  
  574.   ╖  The telephone number(s) to dial for the service
  575.      If you are behind a PABX, you also need the PABX number that gives
  576.      you an outside dial tone - this is frequently digit zero (0) or
  577.      nine (9).
  578.  
  579.   ╖  Does the server use DYNAMIC or STATIC IP numbers?
  580.      If the server uses STATIC IP numbers, then you need to know what IP
  581.      number to use for your end of the PPP connection.
  582.      Most Internet Service Providers use DYNAMIC IP numbers. As
  583.      mentioned above, this has some implications in terms of the
  584.      services you can use.
  585.  
  586.   ╖  If you are using static IP numbers, ask for the network mask your
  587.      ISP uses as well.
  588.  
  589.   ╖  What are the IP numbers of the ISPs Domain Name Servers?
  590.      There should be at least two although only one is needed.
  591.  
  592.   ╖  Does the server require the use of PAP/CHAP?
  593.      If this is the case you need to know the "id" and "secret" you are
  594.      to use in connecting. (These are probably your username and
  595.      password).
  596.   ╖  Does the server automatically start PPP or do you need to issue any
  597.      commands to start PPP on the server once you are logged in?
  598.      If you must issue a command to start PPP, what is it?
  599.  
  600.   Carefully note down this information - you are going to use it!
  601.  
  602.   7.1.  Testing your Modem Connection for outgoing calls
  603.  
  604.   You should make sure that your modem is correctly set up and that you
  605.   know which serial port it is connected to.
  606.  
  607.   Remember:-
  608.  
  609.   ╖  DOS com1: = Linux /dev/cua0 (and /dev/ttyS0)
  610.  
  611.   ╖  DOS com2: = Linux /dev/cua1 (and /dev/ttyS1)
  612.      et cetera
  613.  
  614.   Using you terminal communications package (such as minicom), dial into
  615.   the PPP server you want to connect to with a PPP session.
  616.  
  617.   (Note: at this stage we are NOT trying to make a PPP connection - just
  618.   establishing that we have the right phone number and also to find out
  619.   exactly what the server sends to us in order to get logged in and
  620.   start PPP).
  621.  
  622.   During this process, either capture (log to a file) the entire login
  623.   process or carefully (very carefully) write down exactly what prompts
  624.   the remote server gives to let you know it is time to enter your user
  625.   name and password (and any other commands needed to establish the PPP
  626.   connection).
  627.  
  628.   It is worth dialing in at least twice - some servers change their
  629.   prompts (e.g. with the time!) every time you log in. The two critical
  630.   prompts your Linux box needs to be able to identify every time you
  631.   dial in are:-
  632.  
  633.   ╖  the prompt that requests you to enter your user name;
  634.  
  635.   ╖  the prompt that requests you to enter your password;
  636.  
  637.   If you have to issue a command to start PPP on the server, you will
  638.   also need to find out the prompt the server gives you once you are
  639.   logged in.
  640.  
  641.   If your server automatically starts PPP, once you have logged in, you
  642.   will start to see garbage on your screen - this is the PPP server
  643.   sending your machine information to start up and configure the PPP
  644.   connection.
  645.  
  646.   This should look something like this :-
  647.  
  648.        ~y}#.!}!}!} }8}!}$}%U}"}&} } } } }%}& ...}'}"}(}"} .~~y}
  649.  
  650.   (and it just keeps on coming!)
  651.  
  652.   At this point, you can hang up your modem (usually, type +++ quickly
  653.   and then issue the ATHO command once your modem responds with OK).
  654.  
  655.   On some systems PPP must be explicitly started on the server. This is
  656.   usually because the server has been set up to allow PPP logins and
  657.   shell logins using the same username/password pair. If this is the
  658.   case, issue this command once you have logged in. Again, you will see
  659.   the garbage as the server end of the PPP connection starts up - so you
  660.   can now hang up.
  661.  
  662.   If you do NOT see the garbage on your screen when the server starts up
  663.   PPP, it is quite likely (though not certain) that you have done
  664.   something wrong.
  665.  
  666.   Notwithstanding this, some PPP servers are set up to be passive - they
  667.   send nothing until the client (your computer) starts the PPP process
  668.   from your end.
  669.  
  670.   However, the majority of servers are active and you should see the
  671.   garbage.
  672.  
  673.   If you can't get your modem to work, read your modem manual, the man
  674.   pages for your communications software and the Serial HOWTO! Once you
  675.   have this sorted out, carry on as above.
  676.  
  677.   8.  A note about serial ports and speed capabilities
  678.  
  679.   If you are using a high speed (external) modem (14,400 Baud or above),
  680.   your serial port needs to be capable of handling the throughput that
  681.   such a modem is capable of producing, particularly when the modems are
  682.   compressing the data.
  683.  
  684.   This requires your serial port to use a modern UART (Universal
  685.   Asynchronous Receiver Transmitter) such as a 16550(A). If you are
  686.   using an old machine (or old serial card), it is quite possible that
  687.   your serial port has only an 8250 UART, which will cause you
  688.   considerable problems when used with a high speed modem.
  689.  
  690.   Use the command
  691.  
  692.        setserial -a /dev/ttySx
  693.  
  694.   to get Linux to report to you the type of UART you have. If you do not
  695.   have a 16550A type UART, invest in a new serial card (available for
  696.   under $50).
  697.  
  698.   Note: the first versions of the 16550 UART chip had an error. This was
  699.   rapidly discovered and a revision of the chip was released - the
  700.   16550A UART. A relatively small number of the faulty chips did however
  701.   get into circulation. It is unlikely that you will encounter one of
  702.   these but you should look for a response that says 16550A,
  703.   particularly on serial cards of some vintage.
  704.  
  705.   9.  Configuring your modem
  706.  
  707.   You will need to configure your modem correctly for PPP - to do this
  708.   READ YOUR MODEM MANUAL! Most modems come with a factory default
  709.   setting that selects the options required for PPP. The minimum
  710.   configuration specifies:-
  711.  
  712.   ╖  Hardware flow control (RTS/CTS) (&K3 on many Hayes modems)
  713.  
  714.   Other settings (in standard Hayes commands) you should investigate
  715.   are:-
  716.  
  717.   ╖  E1 Command Echo ON (required for chat to operate)
  718.  
  719.   ╖  Q0 Report result codes (required for chat to operate)
  720.  
  721.   ╖  S0=0 Auto Answer OFF (unless you want your modem to answer the
  722.      phone)
  723.  
  724.   ╖  &C1 Carrier Detect ON only after connect
  725.  
  726.   ╖  &S0 Data Set Ready (DSR) always ON
  727.  
  728.   ╖  (depends)   Data Terminal Ready
  729.  
  730.   It is also worth while investigating how the modem's serial interface
  731.   between your computer and modem operates. Most modern modems allow you
  732.   to run the serial interface at a FIXED speed whilst allowing the
  733.   telephone line interface to change its speed to the highest speed it
  734.   and the remote modem can both handle.
  735.  
  736.   This is known as split speed operation. If your modem supports this,
  737.   lock the modem's serial interface to its highest available speed
  738.   (usually 115,200 baud but maybe 38,400 baud for 14,400 baud modems).
  739.  
  740.   Use your communications software (e.g. minicom) to find out about your
  741.   modem configuration and set it to what is required for PPP. Many
  742.   modems report their current settings in response to AT&V, but you
  743.   should consult your modem manual. If you completely mess up the
  744.   settings, you can return to sanity (usually) by issuing an AT&F -
  745.   return to factory settings. (For most modem modems I have encountered,
  746.   the factory settings include all you need for PPP - but you should
  747.   check).
  748.  
  749.   Save your modem configuration in non-volatile RAM (usually the modem
  750.   command AT&W will do this - but check in your modem manual).
  751.  
  752.   With the correct modem configuration already in the modem, resetting
  753.   the modem will activate this. Arranging things this way considerably
  754.   simplifies the chat script necessary for the PPP connection.
  755.  
  756.   9.1.  Note on Serial Flow Control
  757.  
  758.   When data is traveling on serial communication lines, it can happen
  759.   that data arrives faster than a computer can handle it (the computer
  760.   may be busy doing something else - remember, Linux is a multi-user,
  761.   multi- tasking operating system). In order to ensure that data is not
  762.   lost (data does not over run in the input buffer and hence get lost),
  763.   some method of controlling the flow of data is necessary.
  764.  
  765.   There are two ways of doing this on serial lines:-
  766.  
  767.   ╖  Using hardware signals (Clear To Send/Request to Send - CTS/RTS)
  768.  
  769.   ╖  Using software signals (control S and control Q).
  770.  
  771.   Whilst the latter may be fine for a terminal (text) link, data on a
  772.   PPP link uses all 8 bits - and it is quite probable that somewhere in
  773.   the data there will be data bytes that translate as control S and
  774.   control Q. So, if a modem is set up to use software flow control,
  775.   things can rapidly go berserk!
  776.  
  777.   For PPP (which uses 8 bits of data) hardware flow control is vital.
  778.  
  779.   10.  Using PPP and root privileges
  780.  
  781.   Because PPP needs to set up networking devices, change the kernel
  782.   routing table and so forth, it requires root privileges to do this.
  783.  
  784.   If users other than root are to set up PPP connections, the pppd
  785.   program should be setuid root :-
  786.  
  787.        -r-sr-xr-x   1 root     root        95225 Jul 11 00:27 /usr/sbin/pppd
  788.  
  789.   If /usr/sbin/pppd is not set up this way, then as root issue the
  790.   command:-
  791.  
  792.        chmod u+s /usr/sbin/pppd
  793.  
  794.   What this does is make pppd run with root privileges even if the
  795.   binary is run by an ordinary user. This allows a normal user to run
  796.   pppd with the necessary privileges to set up the network interfaces
  797.   and the kernel routing table.
  798.  
  799.   Programs that run 'set uid root' are potential security holes and you
  800.   should be extremely cautious about making programs 'suid root'. A
  801.   number of programs (including pppd) have been carefully written to
  802.   minimise the danger of running suid root, so you should be safe with
  803.   this one (but no guarantees).
  804.  
  805.   Depending on how you want your system to operate - specifically if you
  806.   want ANY user on your system to be able to initiate a PPP link, you
  807.   should make your ppp-on/off scripts world read/execute. (This is
  808.   probably fine if your PC is used ONLY by you).
  809.  
  810.   However, if you do NOT want just anyone to be able to start up a PPP
  811.   connection (for example, your children have accounts on your Linux PC
  812.   and you do not want them hooking into the Internet without your
  813.   supervision), you will need to establish a PPP group (edit /etc/group)
  814.   and :-
  815.  
  816.   ╖  Make the ppp-on/off scripts owned by user root and group PPP
  817.  
  818.   ╖  Make the ppp-on/off scripts read/executable by group PPP
  819.  
  820.          -rwxr-x---   1 root     PPP           587 Mar 14  1995 /usr/sbin/ppp-on
  821.          -rwxr-x---   1 root     PPP           631 Mar 14  1995 /usr/sbin/ppp-off
  822.  
  823.   ╖  Make the other access rights for ppp-on/off nill.
  824.  
  825.   ╖  add the users who will be firing up PPP to the PPP group in
  826.      /etc/group
  827.  
  828.   Even if you do this, ordinary users will STILL not be able to shut
  829.   down the link under software control! Running the ppp-off script
  830.   requires root privileges. However, any user can just turn off the
  831.   modem!
  832.  
  833.   On my home PC, I do NOT make pppd suid root. In order to start the ppp
  834.   link I must then become root - and know the password! This provides me
  835.   with the ability to supervise my son's access to the Internet!
  836.  
  837.   11.  Setting up the PPP connection files
  838.  
  839.   You now need to be logged in as root to create the directories and
  840.   edit the files needed to set up PPP, even if you want PPP to be
  841.   accessible to all users.
  842.  
  843.   PPP uses a number of files to connect and set up a ppp connection.
  844.   These differ in name and location between PPP 2.1.2 and 2.2.
  845.  
  846.   For PPP 2.1.2 the files are:-
  847.  
  848.   ______________________________________________________________________
  849.   /usr/sbin/pppd          # the ppp binary
  850.   /usr/sbin/ppp-on        # the dialer/connection script
  851.   /usr/sbin/ppp-off       # the disconnection script
  852.   /etc/ppp/options        # the options pppd uses for all connections
  853.   /etc/ppp/options.ttyXX  # the option specific to a connection on this port
  854.   ______________________________________________________________________
  855.  
  856.   For PPP 2.2 the files are:-
  857.  
  858.   ______________________________________________________________________
  859.   /usr/sbin/pppd                  # the ppp binary
  860.   /etc/ppp/scripts/ppp-on         # the dialer/connection script
  861.   /etc/ppp/scripts/ppp-on-dialer  # part 1 of the dialer script
  862.   /etc/ppp/scripts/ppp-off        # the actual chat script itself
  863.   /etc/ppp/options                # the options pppd uses for all connections
  864.   /etc/ppp/options.ttyXX  # the option specific to a connection on this port
  865.   ______________________________________________________________________
  866.  
  867.   As you can see, in your /etc directory there should be a ppp
  868.   directory:-
  869.  
  870.        drwxrwxr-x   2 root     root         1024 Oct  9 11:01 ppp
  871.  
  872.   If it does not exist - create it.
  873.  
  874.   If the directory already existed, it should contain a template options
  875.   file called options.tpl. This file is included below.
  876.  
  877.   Print it out as it contains an explanation of all the PPP options
  878.   (these are useful to read in conjunction with the pppd man pages).
  879.   Whilst you can use this file as the basis of your /etc/ppp/options
  880.   file, it is probably better to create your own options file that does
  881.   not include all the comments in the template - it will be much shorter
  882.   and easier to read/maintain.
  883.  
  884.   If you have multiple serial lines/modems (typically the case for PPP
  885.   servers), create a general /etc/ppp/options file containing the
  886.   options that are common for all the serial ports on which you are
  887.   supporting dial in and set up individual option files for each serial
  888.   line on which you will be establishing a PPP connection with the
  889.   individual settings required for each port.
  890.  
  891.   These are named options.ttyx1<, options.ttyx2 and so forth (where x is
  892.   the appropriate letter for your serial ports).
  893.  
  894.   However, for a single PPP connection, you can happily use the
  895.   /etc/ppp/options file. Alternatively, you can put all the options as
  896.   arguments in the pppd command itself.
  897.  
  898.   It is easier to maintain a setup that uses /etc/ppp/options.ttySx
  899.   files. If you use PPP to connect to a number of different sites, you
  900.   can create option files for each site in /etc/ppp/options.site and
  901.   then specify the option file as a parameter to the PPP command as you
  902.   connect.
  903.  
  904.   11.1.  The supplied options.tpl file
  905.  
  906.   Some distributions of PPP seem to have lost the options.tpl file, so
  907.   here is the complete file. I suggest that you do NOT edit this file to
  908.   create your /etc/ppp/options file(s). Rather, copy this to a new file
  909.   and then edit that. If you mess up your edits, you can then go back to
  910.   the original ands start again.
  911.  
  912.   ______________________________________________________________________
  913.   # /etc/ppp/options -*- sh -*- general options for pppd
  914.   # created 13-Jul-1995 jmk
  915.   # autodate: 01-Aug-1995
  916.   # autotime: 19:45
  917.  
  918.   # Use the executable or shell command specified to set up the serial
  919.   # line.  This script would typically use the "chat" program to dial the
  920.   # modem and start the remote ppp session.
  921.   #connect "echo You need to install a connect command."
  922.  
  923.   # Run the executable or shell command specified after pppd has
  924.   # terminated the link.  This script could, for example, issue commands
  925.   # to the modem to cause it to hang up if hardware modem control signals
  926.   # were not available.
  927.   #disconnect "chat -- \d+++\d\c OK ath0 OK"
  928.  
  929.   # async character map -- 32-bit hex; each bit is a character
  930.   # that needs to be escaped for pppd to receive it.  0x00000001
  931.   # represents '\x01', and 0x80000000 represents '\x1f'.
  932.   #asyncmap 0
  933.  
  934.   # Require the peer to authenticate itself before allowing network
  935.   # packets to be sent or received.
  936.   #auth
  937.  
  938.   # Use hardware flow control (i.e. RTS/CTS) to control the flow of data
  939.   # on the serial port.
  940.   #crtscts
  941.  
  942.   # Use software flow control (i.e. XON/XOFF) to control the flow of data
  943.   # on the serial port.
  944.   #xonxoff
  945.  
  946.   # Add a default route to the system routing tables, using the peer as
  947.   # the gateway, when IPCP negotiation is successfully completed.  This
  948.   # entry is removed when the PPP connection is broken.
  949.   #defaultroute
  950.  
  951.   # Specifies that certain characters should be escaped on transmission
  952.   # (regardless of whether the peer requests them to be escaped with its
  953.   # async control character map).  The characters to be escaped are
  954.   # specified as a list of hex numbers separated by commas.  Note that
  955.   # almost any character can be specified for the escape option, unlike
  956.   # the asyncmap option which only allows control characters to be
  957.   # specified.  The characters which may not be escaped are those with hex
  958.   # values 0x20 - 0x3f or 0x5e.
  959.   #escape 11,13,ff
  960.  
  961.   # Don't use the modem control lines.
  962.   #local
  963.  
  964.   # Specifies that pppd should use a UUCP-style lock on the serial device
  965.   # to ensure exclusive access to the device.
  966.   #lock
  967.  
  968.   # Use the modem control lines.  On Ultrix, this option implies hardware
  969.   # flow control, as for the crtscts option.  (This option is not fully
  970.   # implemented.)
  971.   #modem
  972.  
  973.   # Set the MRU [Maximum Receive Unit] value to <n> for negotiation.  pppd
  974.   # will ask the peer to send packets of no more than <n> bytes. The
  975.   # minimum MRU value is 128.  The default MRU value is 1500.  A value of
  976.   # 296 is recommended for slow links (40 bytes for TCP/IP header + 256
  977.   # bytes of data).
  978.   #mru 542
  979.  
  980.   # Set the interface netmask to <n>, a 32 bit netmask in "decimal dot"
  981.   # notation (e.g. 255.255.255.0).
  982.   #netmask 255.255.255.0
  983.  
  984.   # Disables the default behaviour when no local IP address is specified,
  985.   # which is to determine (if possible) the local IP address from the
  986.   # hostname. With this option, the peer will have to supply the local IP
  987.   # address during IPCP negotiation (unless it specified explicitly on the
  988.   # command line or in an options file).
  989.   #noipdefault
  990.  
  991.   # Enables the "passive" option in the LCP.  With this option, pppd will
  992.   # attempt to initiate a connection; if no reply is received from the
  993.   # peer, pppd will then just wait passively for a valid LCP packet from
  994.   # the peer (instead of exiting, as it does without this option).
  995.   #passive
  996.  
  997.   # With this option, pppd will not transmit LCP packets to initiate a
  998.   # connection until a valid LCP packet is received from the peer (as for
  999.   # the "passive" option with old versions of pppd).
  1000.   #silent
  1001.  
  1002.   # Don't request or allow negotiation of any options for LCP and IPCP
  1003.   # (use default values).
  1004.   #-all
  1005.  
  1006.   # Disable Address/Control compression negotiation (use default, i.e.
  1007.   # address/control field disabled).
  1008.   #-ac
  1009.  
  1010.   # Disable asyncmap negotiation (use the default asyncmap, i.e. escape
  1011.   # all control characters).
  1012.   #-am
  1013.  
  1014.   # Don't fork to become a background process (otherwise pppd will do so
  1015.   # if a serial device is specified).
  1016.   #-detach
  1017.  
  1018.   # Disable IP address negotiation (with this option, the remote IP
  1019.   # address must be specified with an option on the command line or in an
  1020.   # options file).
  1021.   #-ip
  1022.  
  1023.   # Disable magic number negotiation.  With this option, pppd cannot
  1024.   # detect a looped-back line.
  1025.   #-mn
  1026.  
  1027.   # Disable MRU [Maximum Receive Unit] negotiation (use default, i.e.
  1028.   # 1500).
  1029.   #-mru
  1030.  
  1031.   # Disable protocol field compression negotiation (use default, i.e.
  1032.   # protocol field compression disabled).
  1033.   #-pc
  1034.  
  1035.   # Require the peer to authenticate itself using PAP.
  1036.   #+pap
  1037.  
  1038.   # Don't agree to authenticate using PAP.
  1039.   #-pap
  1040.  
  1041.   # Require the peer to authenticate itself using CHAP [Cryptographic
  1042.   # Handshake Authentication Protocol] authentication.
  1043.   #+chap
  1044.   # Don't agree to authenticate using CHAP.
  1045.   #-chap
  1046.  
  1047.   # Disable negotiation of Van Jacobson style IP header compression (use
  1048.   # default, i.e. no compression).
  1049.   #-vj
  1050.  
  1051.   # Increase debugging level (same as -d).  If this option is given, pppd
  1052.   # will log the contents of all control packets sent or received in a
  1053.   # readable form.  The packets are logged through syslog with facility
  1054.   # daemon and level debug. This information can be directed to a file by
  1055.   # setting up /etc/syslog.conf appropriately (see syslog.conf(5)).  (If
  1056.   # pppd is compiled with extra debugging enabled, it will log messages
  1057.   # using facility local2 instead of daemon).
  1058.   #debug
  1059.  
  1060.   # Append the domain name <d> to the local host name for authentication
  1061.   # purposes.  For example, if gethostname() returns the name porsche,
  1062.   # but the fully qualified domain name is porsche.Quotron.COM, you would
  1063.   # use the domain option to set the domain name to Quotron.COM.
  1064.   #domain <d>
  1065.  
  1066.   # Enable debugging code in the kernel-level PPP driver.  The argument n
  1067.   # is a number which is the sum of the following values: 1 to enable
  1068.   # general debug messages, 2 to request that the contents of received
  1069.   # packets be printed, and 4 to request that the contents of transmitted
  1070.   # packets be printed.
  1071.   #kdebug n
  1072.  
  1073.   # Set the MTU [Maximum Transmit Unit] value to <n>. Unless the peer
  1074.   # requests a smaller value via MRU negotiation, pppd will request that
  1075.   # the kernel networking code send data packets of no more than n bytes
  1076.   # through the PPP network interface.
  1077.   #mtu <n>
  1078.  
  1079.   # Set the name of the local system for authentication purposes to <n>.
  1080.   #name <n>
  1081.  
  1082.   # Set the user name to use for authenticating this machine with the peer
  1083.   # using PAP to <u>.
  1084.   #user <u>
  1085.  
  1086.   # Enforce the use of the hostname as the name of the local system for
  1087.   # authentication purposes (overrides the name option).
  1088.   #usehostname
  1089.  
  1090.   # Set the assumed name of the remote system for authentication purposes
  1091.   # to <n>.
  1092.   #remotename <n>
  1093.  
  1094.   # Add an entry to this system's ARP [Address Resolution Protocol]
  1095.   # table with the IP address of the peer and the Ethernet address of this
  1096.   # system.
  1097.   #proxyarp
  1098.  
  1099.   # Use the system password database for authenticating the peer using
  1100.   # PAP.
  1101.   #login
  1102.  
  1103.   # If this option is given, pppd will send an LCP echo-request frame to
  1104.   # the peer every n seconds. Under Linux, the echo-request is sent when
  1105.   # no packets have been received from the peer for n seconds. Normally
  1106.   # the peer should respond to the echo-request by sending an echo-reply.
  1107.   # This option can be used with the lcp-echo-failure option to detect
  1108.   # that the peer is no longer connected.
  1109.   #lcp-echo-interval <n>
  1110.   # If this option is given, pppd will presume the peer to be dead if n
  1111.   # LCP echo-requests are sent without receiving a valid LCP echo-reply.
  1112.   # If this happens, pppd will terminate the connection.  Use of this
  1113.   # option requires a non-zero value for the lcp-echo-interval parameter.
  1114.   # This option can be used to enable pppd to terminate after the physical
  1115.   # connection has been broken (e.g., the modem has hung up) in
  1116.   # situations where no hardware modem control lines are available.
  1117.   #lcp-echo-failure <n>
  1118.  
  1119.   # Set the LCP restart interval (retransmission timeout) to <n> seconds
  1120.   # (default 3).
  1121.   #lcp-restart <n>
  1122.  
  1123.   # Set the maximum number of LCP terminate-request transmissions to <n>
  1124.   # (default 3).
  1125.   #lcp-max-terminate <n>
  1126.  
  1127.   # Set the maximum number of LCP configure-request transmissions to <n>
  1128.   # (default 10).
  1129.   #lcp-max-configure <n>
  1130.  
  1131.   # Set the maximum number of LCP configure-NAKs returned before starting
  1132.   # to send configure-Rejects instead to <n> (default 10).
  1133.   #lcp-max-failure <n>
  1134.  
  1135.   # Set the IPCP restart interval (retransmission timeout) to <n>
  1136.   # seconds (default 3).
  1137.   #ipcp-restart <n>
  1138.  
  1139.   # Set the maximum number of IPCP terminate-request transmissions to <n>
  1140.   # (default 3).
  1141.   #ipcp-max-terminate <n>
  1142.  
  1143.   # Set the maximum number of IPCP configure-request transmissions to <n>
  1144.   # (default 10).
  1145.   #ipcp-max-configure <n>
  1146.  
  1147.   # Set the maximum number of IPCP configure-NAKs returned before starting
  1148.   # to send configure-Rejects instead to <n> (default 10).
  1149.   #ipcp-max-failure <n>
  1150.  
  1151.   # Set the PAP restart interval (retransmission timeout) to <n> seconds
  1152.   # (default 3).
  1153.   #pap-restart <n>
  1154.  
  1155.   # Set the maximum number of PAP authenticate-request transmissions to
  1156.   # <n> (default 10).
  1157.   #pap-max-authreq <n>
  1158.  
  1159.   # Set the CHAP restart interval (retransmission timeout for
  1160.   # challenges) to <n> seconds (default 3).
  1161.   #chap-restart <n>
  1162.  
  1163.   # Set the maximum number of CHAP challenge transmissions to <n>
  1164.   # (default 10).
  1165.   #chap-max-challenge
  1166.  
  1167.   # If this option is given, pppd will rechallenge the peer every <n>
  1168.   # seconds.
  1169.   #chap-interval <n>
  1170.  
  1171.   # With this option, pppd will accept the peer's idea of our local IP
  1172.   # address, even if the local IP address was specified in an option.
  1173.   #ipcp-accept-local
  1174.  
  1175.   # With this option, pppd will accept the peer's idea of its (remote) IP
  1176.   # address, even if the remote IP address was specified in an option.
  1177.   #ipcp-accept-remote
  1178.   ______________________________________________________________________
  1179.  
  1180.   11.2.  What options should I use?
  1181.  
  1182.   Well, as in all things that depends (sigh).
  1183.  
  1184.   Provided here are two basic versions of the options file that cover
  1185.   the most common cases.
  1186.  
  1187.   However, if it does NOT work, READ THE TEMPLATE FILE
  1188.   (/etc/ppp/options.tpl) and the pppd man pages and speak to the
  1189.   sysadmin/user support people who run the server into which you are
  1190.   connecting.
  1191.  
  1192.   11.2.1.  /etc/ppp/options (NO PAP/CHAP)
  1193.  
  1194.   The following should work for connections that do not require PAP/CHAP
  1195.   authentication.
  1196.  
  1197.   ______________________________________________________________________
  1198.   # /etc/ppp/options (NO PAP/CHAP)
  1199.   #
  1200.   # Prevent pppd from forking into the background
  1201.   -detach
  1202.   # If you are using a STATIC IP number, edit the 0.0.0.0 part of the
  1203.   # following line to your static IP number.
  1204.   0.0.0.0:
  1205.   #
  1206.   # use the modem control lines
  1207.   modem
  1208.   # use uucp style locks to ensure exclusive access to the serial device
  1209.   lock
  1210.   # use hardware flow control
  1211.   crtscts
  1212.   # create a default route for this connection in the routing table
  1213.   defaultroute
  1214.   # do NOT set up any "escaped" control sequences
  1215.   asyncmap 0
  1216.   # use a maximum transmission packet size of 552 bytes
  1217.   mtu 552
  1218.   # use a maximum receive packet size of 552 bytes
  1219.   mru 552
  1220.   #
  1221.   #-------END OF SAMPLE /etc/ppp/options (no PAP/CHAP)
  1222.   ______________________________________________________________________
  1223.  
  1224.   11.2.2.  /etc/ppp/options (using PAP/CHAP)
  1225.  
  1226.   If the server to which you are connecting requires PAP or CHAP
  1227.   authentication, to the above options file, add the following lines
  1228.  
  1229.   ______________________________________________________________________
  1230.   #
  1231.   # force pppd to use your ISP username as your 'host name' during the
  1232.   # authentication process
  1233.   name <your ISP username>        # you need to edit this line
  1234.   #
  1235.   # If you need to force PAP or CHAP authentication on the server,
  1236.   # uncomment the appropriate one of the following lines.
  1237.   #+chap
  1238.   #+pap
  1239.   #
  1240.   # If you are using ENCRYPTED secrets in the /etc/ppp/pap-secrets
  1241.   # file, then uncomment the following line.
  1242.   #+papcrypt
  1243.   ______________________________________________________________________
  1244.  
  1245.   12.  Setting up your /etc/resolv.conf file
  1246.  
  1247.   Whilst we humans like to give names to things, computers really like
  1248.   numbers. On a TCP/IP network (which is what the Internet is), we call
  1249.   machines by a particular name - and every machine lives in a
  1250.   particular dquot;domaindquot;. For example, my Linux workstation is
  1251.   called archenland and it resides in the hedland.edu.au domain. Its
  1252.   human readable address is thus archenland.hedland.edu.au. In order for
  1253.   this machine to be findable by other computers on the Internet, it is
  1254.   actually known by its IP number.
  1255.  
  1256.   Translating (resolving) machine (and domain) names into the numbers
  1257.   actually used on the Internet is the business of machines that offer
  1258.   the Domain Name Service.
  1259.  
  1260.   When you make a PPP connection, you need to tell your Linux machine
  1261.   where it can get host name to IP number (address resolution)
  1262.   information so that you can use the machine names but your computer
  1263.   can translate these to the IP numbers it needs to work.
  1264.  
  1265.   One way is to enter every host that you want to talk to into the
  1266.   /etc/hosts file (which is in reality totally impossible if you are
  1267.   connecting to the Internet); another is to use the machine IP numbers
  1268.   as opposed to the names (an impossible memory task for all but the
  1269.   smallest LANs).
  1270.  
  1271.   The best way is to set up Linux so that it knows where to go to get
  1272.   this name to number information - automatically. This service is
  1273.   provided by the Domain Name Server system. All that is necessary is to
  1274.   enter the IP numbers in your /etc/resolv.conf file.
  1275.  
  1276.   Your PPP server sysadmin/user support people should provide you with
  1277.   two DNS IP numbers (only one is necessary - but two gives some
  1278.   redundancy in the event of failure).
  1279.  
  1280.   Your /etc/resolv.conf should look something like :-
  1281.  
  1282.   ______________________________________________________________________
  1283.   domain your.isp.domain.name
  1284.   nameserver 10.25.0.1
  1285.   nameserver 10.25.1.2
  1286.   ______________________________________________________________________
  1287.  
  1288.   Edit this file (creating it if necessary) to represent the information
  1289.   that your ISP has provided. It should have ownership and permissions
  1290.   as follows :-
  1291.  
  1292.        -rw-r--r--   1 root     root           73 Feb 19 01:46 /etc/resolv.conf
  1293.  
  1294.   If you have already set up a /etc/resolv.conf because you are on a
  1295.   LAN, simply add the IP numbers of the PPP DNS servers to your existing
  1296.   file.
  1297.  
  1298.   13.  The PAP/CHAP secrets file
  1299.  
  1300.   If you are using pap or chap authentication, then you also need to
  1301.   create the secrets file. These are:
  1302.  
  1303.   ______________________________________________________________________
  1304.   /etc/ppp/pap-secrets
  1305.   /etc/pp/chap-secrets
  1306.   ______________________________________________________________________
  1307.  
  1308.   The first point to note about PAP and CHAP is that they are designed
  1309.   to authenticate computer systems not users.
  1310.  
  1311.   "Huh? What's the difference?" I hear you ask.
  1312.  
  1313.   Well now, once your computer has made its PPP connection to the
  1314.   server, ANY user on your system can use that connection - not just
  1315.   you.  This is why you can set up a WAN (wide area network) link that
  1316.   joins two LANs (local area networks) using PPP.
  1317.  
  1318.   That being said, your ISP will probably have given you a username and
  1319.   password to allow you to connect to their system and thence the
  1320.   Internet. Your ISP is not interested in your computer's name at all,
  1321.   so you will probably need to use the username at your ISP as the name
  1322.   for your computer.
  1323.  
  1324.   This is done using the name username option to pppd. So, if you are to
  1325.   use the username given you by your ISP, add the line
  1326.  
  1327.   ______________________________________________________________________
  1328.   name your_username_at_your_ISP
  1329.   ______________________________________________________________________
  1330.  
  1331.   to your /etc/ppp/options file.
  1332.  
  1333.   Technically, you should really use user our_username_at_your_ISP for
  1334.   PAP, but pppd is sufficiently intelligent to interpret name as user if
  1335.   it is required to use PAP. The advantage of using the name option is
  1336.   that this is also valid for CHAP.
  1337.  
  1338.   As PAP/CHAP are for authenticating computers, technically you need
  1339.   also to specify a remote computer name. However, as most people only
  1340.   have one ISP, you can use a wild card (*) for the remote host name in
  1341.   the secrets file.
  1342.  
  1343.   It is also worth noting that many ISPs operate multiple modem banks
  1344.   connected to different terminal servers - each with a different name,
  1345.   but ACCESSED from a single (rotary) dial in number. It can therefore
  1346.   be quite difficult in some circumstances to know ahead of time what
  1347.   the name of the remote computer is!
  1348.  
  1349.   13.1.  The PAP secrets file
  1350.  
  1351.   The /etc/ppp/pap-secrets file looks like
  1352.  
  1353.   ______________________________________________________________________
  1354.   # Secrets for authentication using PAP
  1355.   # client        server       secret     acceptable local IP addresses
  1356.   ______________________________________________________________________
  1357.  
  1358.   The four fields are white space delimited.
  1359.  
  1360.   Suppose your ISP gave you a username of fred and a password of
  1361.   flintstone you would set the name fred option in
  1362.   /etc/ppp/options.ttySx and set up your /etc/ppp/pap-secrets file as
  1363.   follows
  1364.  
  1365.   ______________________________________________________________________
  1366.   # Secrets for authentication using PAP
  1367.   # client        server  secret          acceptable local IP addresses
  1368.   fred            *       flintstone
  1369.   ______________________________________________________________________
  1370.  
  1371.   This says for the local machine name fred (which we have told pppd to
  1372.   use even though it is not our local machine name) and for ANY server,
  1373.   use the password (secret) of flintstone.
  1374.  
  1375.   Note that we do not need to specify a local IP address, unless we are
  1376.   required to FORCE a particular local, static IP address.
  1377.  
  1378.   If you have several machines to which you connect using PAP, either
  1379.   arrange to have different usernames on each machine or find out the
  1380.   remote machine name to which you will be connecting. This will allow
  1381.   you to add lines to your pap-secrets file - provided you correctly set
  1382.   the name option for each separate machine to which you connect.
  1383.   13.2.  The CHAP secrets file
  1384.  
  1385.   The current pppd version requires that you have mutual authentication
  1386.   methods - that is you must allow for both your machine to authenticate
  1387.   the remote server AND the remote server to authenticate your machine.
  1388.  
  1389.   So, if your machine is fred and the remote is barney, your machine
  1390.   would set name fred remotename barney and the remote machine would set
  1391.   name barney remotename fred in their respective /etc/ppp/options.ttySx
  1392.   files.
  1393.  
  1394.   The /etc/chap-secrets file for fred would look like
  1395.  
  1396.   ______________________________________________________________________
  1397.   # Secrets for authentication using CHAP
  1398.   # client        server  secret            acceptable local IP addresses
  1399.   fred            barney  flintstone
  1400.   ______________________________________________________________________
  1401.  
  1402.   and for barney
  1403.  
  1404.   ______________________________________________________________________
  1405.   # Secrets for authentication using CHAP
  1406.   # client        server  secret            acceptable local IP addresses
  1407.   barney          fred    flintstone
  1408.   ______________________________________________________________________
  1409.  
  1410.   14.  Setting up the PPP connection manually
  1411.  
  1412.   Now that you have created your /etc/ppp/options and /etc/resolv.conf
  1413.   files (and, if necessary, the /etc/ppp/pap|chap-secrets file), you can
  1414.   test the settings by manually establishing a PPP connection. (Once we
  1415.   have the manual connection working, we will automate the process).
  1416.  
  1417.   To do this, your communications software must be capable of quitting
  1418.   WITHOUT resetting the modem. Minicom can do this - ALT Q (or in older
  1419.   version of minicom CTRL A Q)
  1420.  
  1421.   Make sure you are logged in as root.
  1422.  
  1423.   Fire up you communications software (such as minicom), dial into the
  1424.   PPP server and log in as normal. If you need to issue a command to
  1425.   start up PPP on the server, do so. You will now see the garbage you
  1426.   saw before.
  1427.  
  1428.   If you are using pap/chap, then merely connecting to the remote system
  1429.   should start ppp on the remote and you will see the garbage without
  1430.   logging in (although this may not happen for some servers).
  1431.  
  1432.   Now quit the communications software without resetting the modem (ALT
  1433.   Q or CTL A Q in minicom) and at the Linux prompt (as root) type
  1434.        pppd -d -detach /dev/cuaX &
  1435.  
  1436.   The -d option turns on debugging - the ppp connection start up
  1437.   "conversation" will be logged to your system log - which is useful if
  1438.   you are having trouble.
  1439.  
  1440.   Naturally, you should use cua0 or cua1 etc - the actual port to which
  1441.   your modem is connected, NOT cuaX!
  1442.  
  1443.   Your modem lights should now flash as the PPP connection is
  1444.   established.  It will take a short while for the PPP connection to be
  1445.   made.
  1446.  
  1447.   At this point you can look at the PPP interface, by issuing the
  1448.   command
  1449.  
  1450.        ifconfig
  1451.  
  1452.   In addition to any Ethernet and loop back devices you have, you should
  1453.   see something like :-
  1454.  
  1455.   ______________________________________________________________________
  1456.     ppp0     Link encap:Point-Point Protocol
  1457.              inet addr:10.144.153.104  P-t-P:10.144.153.51 Mask:255.255.255.0
  1458.              UP POINTOPOINT RUNNING  MTU:552  Metric:1
  1459.              RX packets:0 errors:0 dropped:0 overruns:0
  1460.              TX packets:0 errors:0 dropped:0 overruns:0
  1461.   ______________________________________________________________________
  1462.  
  1463.   Where
  1464.  
  1465.   ╖  inet addr:10.144.153.10 is the IP number of your end of the link.
  1466.  
  1467.   ╖  P-t-P:10.144.153.5 is the SERVER's IP number.
  1468.  
  1469.   (Naturally, ifconfig will not report these IP numbers, but the ones
  1470.   used by your PPP server.)
  1471.  
  1472.   Note: ifconfig also tells you that the link is UP and RUNNING!
  1473.  
  1474.   If you get something like
  1475.  
  1476.   ______________________________________________________________________
  1477.     ppp0     Link encap:Point-Point Protocol
  1478.              inet addr:0.0.0.0  P-t-P:0.0.0.0  Mask:0.0.0.0
  1479.              POINTOPOINT  MTU:1500  Metric:1
  1480.              RX packets:0 errors:0 dropped:0 overruns:0
  1481.              TX packets:0 errors:0 dropped:0 overruns:0
  1482.   ______________________________________________________________________
  1483.  
  1484.   Your PPP connection has not been made...see the later section on
  1485.   debugging!
  1486.  
  1487.   You should also be able to see a route to the the remote host (and
  1488.   beyond). To do this, issue the command
  1489.  
  1490.        route -n>
  1491.  
  1492.   You should se something like:-
  1493.  
  1494.   ______________________________________________________________________
  1495.   Kernel routing table
  1496.   Destination     Gateway         Genmask         Flags MSS    Window Use Iface
  1497.   10.144.153.3    *               255.255.255.255 UH    1500   0        1 ppp0
  1498.   127.0.0.0       *               255.0.0.0       U     3584   0       11 lo
  1499.   10.0.0.0        *               255.0.0.0       U     1500   0       35 eth0
  1500.   default         10.144.153.3    *               UG    1500   0        5 ppp0
  1501.   ______________________________________________________________________
  1502.  
  1503.   Of particular importance here, notice we have TWO entries pointing to
  1504.   our ppp interface.
  1505.  
  1506.   The first is a HOST route (indicated by the H flag) and that allows us
  1507.   to see the host to which we are connected to - but no further.
  1508.  
  1509.   The second is the default route - this is the route that tells our
  1510.   Linux PC to send any packets NOT destined for the local Ethernet(s) -
  1511.   to which we have specific network routes - to the PPP server itself.
  1512.   The PPP server then is responsible for routing our packets out onto
  1513.   the Internet and routing the return packets back to us.
  1514.  
  1515.   If you do not see a routing table with two entries, something is wrong
  1516.   (see the debugging section).
  1517.  
  1518.   Now test the link by 'pinging' the server at its IP number as reported
  1519.   by the ifconfig output, i.e.
  1520.  
  1521.   ping 10.144.153.51
  1522.  
  1523.   You should receive output like
  1524.  
  1525.        PING 10.144.153.51 (10.144.153.51): 56 data bytes
  1526.        64 bytes from 10.144.153.51: icmp_seq=0 ttl=255 time=328.3 ms
  1527.        64 bytes from 10.144.153.51: icmp_seq=1 ttl=255 time=190.5 ms
  1528.        64 bytes from 10.144.153.51: icmp_seq=2 ttl=255 time=187.5 ms
  1529.        64 bytes from 10.144.153.51: icmp_seq=3 ttl=255 time=170.7 ms
  1530.  
  1531.   This listing will go on for ever - to stop it press CTRL C, at which
  1532.   point you will receive some more information :-
  1533.  
  1534.        --- 10.144.153.51 ping statistics ---
  1535.        4 packets transmitted, 4 packets received, 0% packet loss
  1536.        round-trip min/avg/max = 170.7/219.2/328.3 ms
  1537.  
  1538.   So far so good.
  1539.  
  1540.   Now try pinging a host by name (not the name of the PPP server itself)
  1541.   but a host at another site that you KNOW is probably going to be up
  1542.   and running...). For example
  1543.  
  1544.        ping sunsite.unc.edu
  1545.  
  1546.   This time there will be a bit of a pause as Linux obtains the IP
  1547.   number for the fully qualified host name you have 'ping'ed from the
  1548.   DNS you specified in /etc/resolv.conf - so don't worry (but you will
  1549.   see your modem lights flash). Shortly you will receive output like
  1550.  
  1551.         PING sunsite.unc.edu (152.2.254.81): 56 data bytes
  1552.        64 bytes from 152.2.254.81: icmp_seq=0 ttl=254 time=190.1 ms
  1553.        64 bytes from 152.2.254.81: icmp_seq=1 ttl=254 time=180.6 ms
  1554.        64 bytes from 152.2.254.81: icmp_seq=2 ttl=254 time=169.8 ms
  1555.        64 bytes from 152.2.254.81: icmp_seq=3 ttl=254 time=170.6 ms
  1556.        64 bytes from 152.2.254.81: icmp_seq=4 ttl=254 time=170.6 ms
  1557.  
  1558.   Again, stop the output by pressing CTRL C and get the statistics...
  1559.  
  1560.        --- sunsite.unc.edu ping statistics ---
  1561.        5 packets transmitted, 5 packets received, 0% packet loss
  1562.        round-trip min/avg/max = 169.8/176.3/190.1 ms
  1563.  
  1564.   If you don't get any response, check in the debugging section of this
  1565.   document.
  1566.  
  1567.   If everything works, shut down the connection by typing
  1568.  
  1569.        ppp-off
  1570.  
  1571.   After a short pause, the modem should hang itself up.
  1572.  
  1573.   If that does not work, either turn off your modem or fire up your
  1574.   communications software and interrupt the modem with +++ and then hang
  1575.   up with ATH0 when you receive the modem's OK prompt.
  1576.  
  1577.   You may also need to clean up the lock file created by pppd
  1578.  
  1579.   ______________________________________________________________________
  1580.   rm -f /var/lock/LCK..cuaX
  1581.   ______________________________________________________________________
  1582.  
  1583.   15.  Automating your connections - Creating the connection scripts
  1584.  
  1585.   A chat script automates the log in and PPP start up so all you have to
  1586.   do (as root or as a member of the ppp group) is issue a single command
  1587.   to fire up your connection.
  1588.  
  1589.   15.1.  Connection scripts for Username/Password Authentication
  1590.  
  1591.   If your ISP does NOT require the use of PAP/CHAP, these are the
  1592.   scripts for you!
  1593.  
  1594.   If the ppp package installed correctly, you should have two example
  1595.   files.  For PPP 2.1.2 they are in /usr/sbin and for PPP 2.2 they are
  1596.   in /etc/ppp/scripts. They are called
  1597.  
  1598.   for PPP-2.1.2
  1599.  
  1600.   ppp-on
  1601.   ppp-off
  1602.  
  1603.   and for PPP-2.2
  1604.  
  1605.        ppp-off
  1606.        ppp-on
  1607.        ppp-on-dialer
  1608.  
  1609.   Now, if you are using PPP 2.1.2, I strongly urge you to delete the
  1610.   sample files. There are potential problems with these - and don't tell
  1611.   me they work fine - I used them for ages too (and recommended them in
  1612.   the first version of this HOWTO!
  1613.  
  1614.   For the benefit of PPP 2.1.2 users, here are BETTER template versions,
  1615.   taken from the PPP 2.2 distribution. I suggest you copy and use these
  1616.   scripts instead of the old PPP-2.1.2 scripts.
  1617.  
  1618.   15.2.  The ppp-on script
  1619.  
  1620.   This is the first of a PAIR of scripts that actually fire up the
  1621.   connection.
  1622.  
  1623.   ______________________________________________________________________
  1624.   #!/bin/sh
  1625.   #
  1626.   # Script to initiate a PPP connection. This is the first part of the
  1627.   # pair of scripts. This is not a secure pair of scripts as the codes
  1628.   # are visible with the 'ps' command.  However, it is simple.
  1629.   #
  1630.   # These are the parameters. Change as needed.
  1631.   TELEPHONE=555-1212      # The telephone number for the connection
  1632.   ACCOUNT=george          # The account name for logon (as in 'George Burns')
  1633.   PASSWORD=gracie         # The password for this account (and 'Gracie Allen')
  1634.   LOCAL_IP=0.0.0.0        # Local IP address if known. Dynamic = 0.0.0.0
  1635.   REMOTE_IP=0.0.0.0       # Remote IP address if desired. Normally 0.0.0.0
  1636.   NETMASK=255.255.255.0   # The proper netmask if needed
  1637.   #
  1638.   # Export them so that they will be available to 'ppp-on-dialer'
  1639.   export TELEPHONE ACCOUNT PASSWORD
  1640.   #
  1641.   # This is the location of the script which dials the phone and logs
  1642.   # in.  Please use the absolute file name as the $PATH variable is not
  1643.   # used on the connect option.  (To do so on a 'root' account would be
  1644.   # a security hole so don't ask.)
  1645.   #
  1646.   DIALER_SCRIPT=/etc/ppp/ppp-on-dialer
  1647.   #
  1648.   # Initiate the connection
  1649.   #
  1650.   #
  1651.   exec /usr/sbin/pppd debug /dev/ttySx 38400 \
  1652.           $LOCAL_IP:$REMOTE_IP \
  1653.           connect $DIALER_SCRIPT
  1654.   ______________________________________________________________________
  1655.  
  1656.   Here is the ppp-on-dialer script:-
  1657.  
  1658.   ______________________________________________________________________
  1659.   #!/bin/sh
  1660.   #
  1661.   # This is part 2 of the ppp-on script. It will perform the connection
  1662.   # protocol for the desired connection.
  1663.   #
  1664.   chat -v                                                 \
  1665.           TIMEOUT         3                               \
  1666.           ABORT           '\nBUSY\r'                      \
  1667.           ABORT           '\nNO ANSWER\r'                 \
  1668.           ABORT           '\nRINGING\r\n\r\nRINGING\r'    \
  1669.           ''              \rAT                            \
  1670.           'OK-+++\c-OK'   ATH0                            \
  1671.           TIMEOUT         30                              \
  1672.           OK              ATDT$TELEPHONE                  \
  1673.           CONNECT         ''                              \
  1674.           ogin:--ogin:    $ACCOUNT                        \
  1675.           assword:        $PASSWORD
  1676.   ______________________________________________________________________
  1677.  
  1678.   15.3.  Editing the supplied PPP startup scripts
  1679.  
  1680.   As the new scripts come in two parts, we will edit them in turn.
  1681.  
  1682.   15.3.1.  The ppp-on script
  1683.  
  1684.   You will need to edit the script to reflect YOUR user name at your
  1685.   ISP, YOUR password at your ISP, the telephone number of your ISP.
  1686.  
  1687.   Each of the lines like TELEPHONE= actually set up shell variables that
  1688.   contain the information to the right of the '=' (excluding the
  1689.   comments of course). So edit each of these lines so it is correct for
  1690.   your ISP and connection.
  1691.  
  1692.   Also, as you are setting the IP number (if you need to) in the
  1693.   /etc/ppp/options file, DELETE the line that says
  1694.  
  1695.   ______________________________________________________________________
  1696.           $LOCAL_IP:$REMOTE_IP \
  1697.   ______________________________________________________________________
  1698.  
  1699.   Also, make sure that the shell variable DIALER_SCRIPT points at the
  1700.   full path and name of the dialer script that you are actually going to
  1701.   use. So, if you have moved this or renamed the script, make sure you
  1702.   edit this line correctly in the ppp-on script!
  1703.  
  1704.   If you have set up your ppp-on script correctly and your PPP server
  1705.   uses username/password authentication, you should not need to edit the
  1706.   ppp-on-dialer script at all!
  1707.  
  1708.   Although you can set up your serial port using /etc/rc.serial at boot
  1709.   time, I have found that it is a good idea to explicitly set up the
  1710.   serial port in the ppp-on script. This allows for my using the modem
  1711.   for other purposes (which may reset the serial settings) between
  1712.   times.
  1713.  
  1714.   Immediately before the line that actually starts pppd, add the line
  1715.  
  1716.   ______________________________________________________________________
  1717.   /bin/setserial /dev/cuaX spd_vhi
  1718.   ______________________________________________________________________
  1719.  
  1720.   This sets up the serial port to actually set the baud rate to 115,200
  1721.   baud when a speed of 38,400 baud is requested. This is fine for 28.8k
  1722.   (and faster) baud modems. However, many 14,400 baud modems cannot
  1723.   actually run their serial interface back to the computer at this
  1724.   speed.
  1725.  
  1726.   Check you modem manual and if the maximum serial speed for your modem
  1727.   is 38,400 use the line
  1728.  
  1729.   ______________________________________________________________________
  1730.   /bin/setserial /dev/cuaX spd_normal
  1731.   ______________________________________________________________________
  1732.  
  1733.   15.3.2.  Starting PPP at the server end
  1734.  
  1735.   Whilst the ppp-on-dialer script is fine for servers that automatically
  1736.   start pppd at the server end once you have logged in, some servers
  1737.   require that you explicitly start PPP on the server.
  1738.  
  1739.   If you need to issue a command to start up PPP on the server, you DO
  1740.   need to edit the ppp-on-dialer script.
  1741.  
  1742.   At the END of the script (after the password line) add an additional
  1743.   expect send pair - this one would look for your login prompt (beware
  1744.   of characters that have a special meaning in the Bourne shell - such
  1745.   as $ and  or  (open and close square brackets).
  1746.  
  1747.   Once chat has found the shell prompt, chat must issue the ppp start up
  1748.   command required for your ISPs PPP server.
  1749.  
  1750.   In my case, my PPP server uses the standard Linux Bash prompt
  1751.  
  1752.   ______________________________________________________________________
  1753.   [hartr@kepler hartr]$
  1754.   ______________________________________________________________________
  1755.  
  1756.   and requires that I type
  1757.  
  1758.   ______________________________________________________________________
  1759.   ppp
  1760.   ______________________________________________________________________
  1761.  
  1762.   to start up PPP on the server.
  1763.  
  1764.   It is a good idea to allow for a bit of error recovery here, so in my
  1765.   case I use
  1766.  
  1767.   ______________________________________________________________________
  1768.           hartr--hartr    ppp
  1769.   ______________________________________________________________________
  1770.  
  1771.   This says - if we don't receive the prompt within the timeout, send a
  1772.   carriage return and looks for the prompt again.
  1773.  
  1774.   Once the prompt is received, then send the string 'ppp'.
  1775.  
  1776.   Note: don't forget to add a  to the end of the previous line so chat
  1777.   still thinks the entire chat script is on one line!
  1778.  
  1779.   Unfortunately, some servers produce a very variable set of prompts!
  1780.   You may need to log in several times using minicom to understand what
  1781.   is going on and pick the stable "expect" strings.
  1782.  
  1783.   15.3.3.  The ppp-on-dialer script
  1784.  
  1785.   This is the second of the scripts that actually brings up our ppp
  1786.   link.
  1787.  
  1788.   Note: a chat script is normally all on one line. the backslashes are
  1789.   used to allow line continuations across several physical lines (for
  1790.   human readability) and do not form part of the script itself.
  1791.  
  1792.   However, it is very useful to look at it in detail so that we
  1793.   understand what it is actually (supposed) to be doing!
  1794.  
  1795.   15.4.  What a Chat script means...
  1796.  
  1797.   A chat script is a sequence of "expect string" "send string" pairs. In
  1798.   particular, note that we ALWAYS expect something before we send
  1799.   something.
  1800.  
  1801.   If we are to send something WITHOUT receiving anything first, we must
  1802.   use an empty expect string (indicated by "") and similarly for
  1803.   expecting something without sending anything! Also, if a string
  1804.   consists of several words, (e.g. NO CARRIER), you must quote the
  1805.   string so that it is seen as a single entity by chat.
  1806.  
  1807.   The chat line in our template is:-
  1808.  
  1809.   ╖  exec chat -v
  1810.      Invoke chat, the -v tells chat to copy ALL its I/O into the system
  1811.      log (usually /var/log/messages).
  1812.      Once you are happy that the chat script is working reliably, edit
  1813.      this line to remove the -v to save unnecessary clutter in your
  1814.      syslog.
  1815.  
  1816.   ╖  TIMEOUT         3
  1817.      This sets the timeout for the receipt of expected input to three
  1818.      seconds. You may need to increase this to say 5 or 10 seconds if
  1819.      you are using a really slow modem!
  1820.  
  1821.   ╖  ABORT           '\nBUSY\r'
  1822.      If the string BUSY is received, abort the operation.
  1823.  
  1824.   ╖  ABORT           '\nNO ANSWER\r'
  1825.      If the string NO ANSWER is received, abort the operation
  1826.  
  1827.   ╖  ABORT           '\nRINGING\r\n\r\nRINGING\r'
  1828.      If the (repeated) string RINGING is received, abort the operation.
  1829.      This is because someone is ringing your phone line!
  1830.  
  1831.   ╖  ┤┤              \rAT
  1832.      Expect nothing from the modem and send the string AT.
  1833.  
  1834.   ╖  ┤OK-+++\c-OK┤   ATH0
  1835.      This one is a bit more complicated as it uses some of chat's error
  1836.      recovery capabilities. What is says is...
  1837.      Expect OK, if it is NOT received (because the modem is not in
  1838.      command mode) then send +++ (the standard Hayes-compatible modem
  1839.      string that returns the modem to command mode) and expect OK; then
  1840.      send ATH0 (the modem hang up string).
  1841.      This allows your script to cope with the situation of your modem
  1842.      being stuck on-line!
  1843.  
  1844.   ╖  TIMEOUT         30
  1845.      Set the timeout to 30 seconds for the remainder of the script. If
  1846.      you experience trouble with the chat script aborting due to
  1847.      timeouts, increase this to 45 seconds or more.
  1848.  
  1849.   ╖  OK              ATDT$TELEPHONE
  1850.      Expect OK (the modem's response to the ATH0 command) and dial the
  1851.      number we want to call.
  1852.  
  1853.   ╖  CONNECT         ''
  1854.      Expect CONNECT (which our modem sends when the remote modem
  1855.      answers) and send nothing in reply.
  1856.  
  1857.   ╖  ogin:--ogin:    $ACCOUNT
  1858.      Again, we have some error recovery built in here. Expect the login
  1859.      prompt (...ogin:) but if we don't receive it by the timeout, send a
  1860.      return and then look for the login prompt again. When the prompt is
  1861.      received, send the username (stored in the shell variable
  1862.      $ACCOUNT).
  1863.  
  1864.   ╖  assword:        $PASSWORD
  1865.      Expect the password prompt and send our password (again, stored in
  1866.      a shell variable).
  1867.  
  1868.   This chat script has reasonable error recovery capability. Chat has
  1869.   considerably more features than demonstrated here. For more
  1870.   information consult the chat manual page (man 8 chat).
  1871.  
  1872.   15.5.  A chat script for PAP/CHAP authenticated connections
  1873.  
  1874.   If your ISP is using PAP/CHAP, then your chat script is much simpler.
  1875.   All your chat script needs to do is dial the telephone, wait for a
  1876.   connect and then let pppd handle the logging in!
  1877.  
  1878.   ______________________________________________________________________
  1879.   #!/bin/sh
  1880.   #
  1881.   # This is part 2 of the ppp-on script. It will perform the connection
  1882.   # protocol for the desired connection.
  1883.   #
  1884.   exec chat -v                                            \
  1885.           TIMEOUT         3                               \
  1886.           ABORT           '\nBUSY\r'                      \
  1887.           ABORT           '\nNO ANSWER\r'                 \
  1888.           ABORT           '\nRINGING\r\n\r\nRINGING\r'    \
  1889.           ''              \rAT                            \
  1890.           'OK-+++\c-OK'   ATH0                            \
  1891.           TIMEOUT         30                              \
  1892.           OK              ATDT$TELEPHONE                  \
  1893.           CONNECT         ''                              \
  1894.   ______________________________________________________________________
  1895.  
  1896.   15.6.  The pppd debug and -f option_ file options
  1897.  
  1898.   As we have already seen, you can turn on debug information logging
  1899.   with the -d option to pppd. The 'debug' option is equivalent to this.
  1900.  
  1901.   As we are establishing a new connection with a new script, leave in
  1902.   the debug option for now. (Warning: if your disk space is tight,
  1903.   logging pppd exchanges can rapidly extend your syslog file and run you
  1904.   into trouble - but to do this you must fail to connect and keep on
  1905.   trying for quite a few minutes).
  1906.  
  1907.   Once you are happy that all is working properly, then you can remove
  1908.   this option.
  1909.  
  1910.   If you have called your ppp options file anything other than
  1911.   /etc/ppp/options or /etc/ppp/options.ttySx, specify the file name with
  1912.   the -f option to pppd - e.g.
  1913.  
  1914.   ______________________________________________________________________
  1915.   exec /usr/sbin/pppd debug -f options.myserver /dev/ttySx 38400 \
  1916.   ______________________________________________________________________
  1917.  
  1918.   16.  Testing your connection script
  1919.  
  1920.   Open a new root Xterm (if you are in X) or open a new virtual console
  1921.   and log in as root.
  1922.  
  1923.   In this new session, issue the command
  1924.  
  1925.        tail -f /var/log/messages
  1926.  
  1927.   (or whatever your system log file is).
  1928.  
  1929.   In the first window (or virtual console) issue the command
  1930.  
  1931.        ppp-on &
  1932.  
  1933.   (or whatever name you have called your edited version of
  1934.   /usr/sbin/ppp- on). If you do not put the script into the background
  1935.   by specifying & at the end of the command, you will not get your
  1936.   terminal prompt back until ppp exits (when the link terminates).
  1937.  
  1938.   Now switch back to the window that is tracking your system log.
  1939.  
  1940.   You will see something like the following (provided you specified -v
  1941.   to chat and -d to pppd)....this is the chat script and responses being
  1942.   logged to the system log file followed by the start up information for
  1943.   pppd :-
  1944.  
  1945.   ______________________________________________________________________
  1946.   Oct 21 16:09:58 hwin chat[19868]: abort on (NO CARRIER)
  1947.   Oct 21 16:09:59 hwin chat[19868]: abort on (BUSY)
  1948.   Oct 21 16:09:59 hwin chat[19868]: send (ATZ^M)
  1949.   Oct 21 16:09:59 hwin chat[19868]: expect (OK)
  1950.   Oct 21 16:10:00 hwin chat[19868]: ATZ^M^M
  1951.   Oct 21 16:10:00 hwin chat[19868]: OK -- got it
  1952.   Oct 21 16:10:00 hwin chat[19868]: send (ATDT722298^M)
  1953.   Oct 21 16:10:00 hwin chat[19868]: expect (CONNECT)
  1954.   Oct 21 16:10:00 hwin chat[19868]: ^M
  1955.   Oct 21 16:10:22 hwin chat[19868]: ATDT722298^M^M
  1956.   Oct 21 16:10:22 hwin chat[19868]: CONNECT -- got it
  1957.   Oct 21 16:10:22 hwin chat[19868]: send (^M)
  1958.   Oct 21 16:10:22 hwin chat[19868]: expect (ogin:)
  1959.   Oct 21 16:10:22 hwin chat[19868]:  57600^M
  1960.   Oct 21 16:10:23 hwin chat[19868]: ^[[;H^[[2J^M^M
  1961.   Oct 21 16:10:23 hwin chat[19868]: ^M
  1962.   Oct 21 16:10:23 hwin chat[19868]: ^M
  1963.   Oct 21 16:10:23 hwin chat[19868]: ^I^I      This is node  kepler.hedland.edu.au^M
  1964.   Oct 21 16:10:23 hwin chat[19868]: ^I^I^I      at Hedland Campus^M
  1965.   Oct 21 16:10:23 hwin chat[19868]: ^I^I^I       Hedland College^M
  1966.   Oct 21 16:10:23 hwin chat[19868]: ^M
  1967.   Oct 21 16:10:23 hwin chat[19868]: ^I^I  Authorised user ONLY are to use this system^M
  1968.   Oct 21 16:10:23 hwin chat[19868]: ^M
  1969.   Oct 21 16:10:23 hwin chat[19868]: ^M
  1970.   Oct 21 16:10:23 hwin chat[19868]: ^I^I For more information, contact ComputerSystems^M
  1971.   Oct 21 16:10:23 hwin chat[19868]: ^I^I^I     on +61 (0)91 72 0400^M
  1972.   Oct 21 16:10:23 hwin chat[19868]: ^I^I^I^I     or^M
  1973.   Oct 21 16:10:23 hwin chat[19868]: ^I^I       email:  help@hedunx.hedland.edu.au^M
  1974.   Oct 21 16:10:23 hwin chat[19868]: ^M
  1975.   Oct 21 16:10:23 hwin last message repeated 3 times
  1976.   Oct 21 16:10:23 hwin chat[19868]: kepler login: -- got it
  1977.   Oct 21 16:10:23 hwin chat[19868]: send (hartr^M)
  1978.   Oct 21 16:10:23 hwin chat[19868]: expect (ssword:)
  1979.   Oct 21 16:10:23 hwin chat[19868]:  hartr^M
  1980.   Oct 21 16:10:23 hwin chat[19868]: Password: -- got it
  1981.   Oct 21 16:10:23 hwin chat[19868]: send (??????^M)
  1982.   Oct 21 16:10:23 hwin chat[19868]: expect (hartr)
  1983.   Oct 21 16:10:23 hwin chat[19868]:  ^M^M
  1984.   Oct 21 16:10:24 hwin chat[19868]: Last login: Sat Oct 21 14:55:53 on  ttyC0^M
  1985.   Oct 21 16:10:24 hwin chat[19868]: ^M
  1986.   Oct 21 16:10:24 hwin last message repeated 9 times
  1987.   Oct 21 16:10:24 hwin chat[19868]: ^I^IYou have logged into node  kepler.hedland.edu.au^M
  1988.   Oct 21 16:10:24 hwin chat[19868]: ^M
  1989.   Oct 21 16:10:24 hwin chat[19868]:            This is a Compaq Prolinea 486DX2/50 running Linux 1.1.54^M
  1990.   Oct 21 16:10:24 hwin chat[19868]: ^M
  1991.   Oct 21 16:10:24 hwin chat[19868]:        This computer operates as the main Hedland Campus communications^M
  1992.   Oct 21 16:10:24 hwin chat[19868]: ^I       node, providing dial-in terminal and SLIP access,^M
  1993.   Oct 21 16:10:24 hwin chat[19868]: ^I^I      Kepler also runs the Hedland end of^M
  1994.   Oct 21 16:10:24 hwin chat[19868]: ^I^I    the Hedland/Newman inter-Campus WAN link^M
  1995.   Oct 21 16:10:24 hwin chat[19868]: ^M
  1996.   Oct 21 16:10:24 hwin chat[19868]: ^M
  1997.   Oct 21 16:10:24 hwin chat[19868]: [hartr -- got it
  1998.   Oct 21 16:10:24 hwin chat[19868]: send (ppp^M)
  1999.   Oct 21 16:10:27 hwin pppd[19872]: pppd 2.1.2 started by root, uid 0
  2000.   Oct 21 16:10:27 hwin pppd[19873]: Using interface ppp0
  2001.   Oct 21 16:10:27 hwin pppd[19873]: Connect: ppp0 <--> /dev/cua1
  2002.   Oct 21 16:10:27 hwin pppd[19873]: fsm_sdata(LCP): Sent code 1, id 1.
  2003.   Oct 21 16:10:27 hwin pppd[19873]: LCP: sending Configure-Request, id 1
  2004.   Oct 21 16:10:27 hwin pppd[19873]: fsm_rconfreq(LCP): Rcvd id 1.
  2005.   Oct 21 16:10:27 hwin pppd[19873]: lcp_reqci: rcvd MRU
  2006.   Oct 21 16:10:27 hwin pppd[19873]: (1500)
  2007.   Oct 21 16:10:27 hwin pppd[19873]:  (ACK)
  2008.   Oct 21 16:10:27 hwin pppd[19873]: lcp_reqci: rcvd ASYNCMAP
  2009.   Oct 21 16:10:27 hwin pppd[19873]: (0)
  2010.   Oct 21 16:10:27 hwin pppd[19873]:  (ACK)
  2011.   Oct 21 16:10:27 hwin pppd[19873]: lcp_reqci: rcvd MAGICNUMBER
  2012.   Oct 21 16:10:27 hwin pppd[19873]: (a098b898)
  2013.   Oct 21 16:10:27 hwin pppd[19873]:  (ACK)
  2014.   Oct 21 16:10:27 hwin pppd[19873]: lcp_reqci: rcvd PCOMPRESSION
  2015.   Oct 21 16:10:27 hwin pppd[19873]:  (ACK)
  2016.   Oct 21 16:10:27 hwin pppd[19873]: lcp_reqci: rcvd ACCOMPRESSION
  2017.   Oct 21 16:10:27 hwin pppd[19873]:  (ACK)
  2018.   Oct 21 16:10:27 hwin pppd[19873]: lcp_reqci: returning CONFACK.
  2019.   Oct 21 16:10:27 hwin pppd[19873]: fsm_sdata(LCP): Sent code 2, id 1.
  2020.   Oct 21 16:10:27 hwin pppd[19873]: fsm_rconfack(LCP): Rcvd id 1.
  2021.   Oct 21 16:10:27 hwin pppd[19873]: fsm_sdata(IPCP): Sent code 1, id 1.
  2022.   Oct 21 16:10:27 hwin pppd[19873]: IPCP: sending Configure-Request, id 1
  2023.   Oct 21 16:10:27 hwin pppd[19873]: fsm_rconfreq(IPCP): Rcvd id 1.
  2024.   Oct 21 16:10:27 hwin pppd[19873]: ipcp: received ADDR
  2025.   Oct 21 16:10:27 hwin pppd[19873]: (10.144.153.51)
  2026.   Oct 21 16:10:27 hwin pppd[19873]:  (ACK)
  2027.   Oct 21 16:10:27 hwin pppd[19873]: ipcp: received COMPRESSTYPE
  2028.   Oct 21 16:10:27 hwin pppd[19873]: (45)
  2029.   Oct 21 16:10:27 hwin pppd[19873]:  (ACK)
  2030.   Oct 21 16:10:27 hwin pppd[19873]: ipcp: returning Configure-ACK
  2031.   Oct 21 16:10:28 hwin pppd[19873]: fsm_sdata(IPCP): Sent code 2, id 1.
  2032.   Oct 21 16:10:30 hwin pppd[19873]: fsm_sdata(IPCP): Sent code 1, id 1.
  2033.   Oct 21 16:10:30 hwin pppd[19873]: IPCP: sending Configure-Request, id 1
  2034.   Oct 21 16:10:30 hwin pppd[19873]: fsm_rconfreq(IPCP): Rcvd id 255.
  2035.   Oct 21 16:10:31 hwin pppd[19873]: ipcp: received ADDR
  2036.   Oct 21 16:10:31 hwin pppd[19873]: (10.144.153.51)
  2037.   Oct 21 16:10:31 hwin pppd[19873]:  (ACK)
  2038.   Oct 21 16:10:31 hwin pppd[19873]: ipcp: received COMPRESSTYPE
  2039.   Oct 21 16:10:31 hwin pppd[19873]: (45)
  2040.   Oct 21 16:10:31 hwin pppd[19873]:  (ACK)
  2041.   Oct 21 16:10:31 hwin pppd[19873]: ipcp: returning Configure-ACK
  2042.   Oct 21 16:10:31 hwin pppd[19873]: fsm_sdata(IPCP): Sent code 2, id 255.
  2043.   Oct 21 16:10:31 hwin pppd[19873]: fsm_rconfack(IPCP): Rcvd id 1.
  2044.   Oct 21 16:10:31 hwin pppd[19873]: ipcp: up
  2045.   Oct 21 16:10:31 hwin pppd[19873]: local  IP address 10.144.153.104
  2046.   Oct 21 16:10:31 hwin pppd[19873]: remote IP address 10.144.153.51
  2047.   ______________________________________________________________________
  2048.  
  2049.   (Note - I am using STATIC IP numbers - hence my machine sent that to
  2050.   the PPP server - you won't see this if you are using DYNAMIC IP
  2051.   numbers.)
  2052.  
  2053.   This looks OK - so test it out as before with pings to IP numbers and
  2054.   host names.
  2055.  
  2056.   Fire up you web browser or whatever and go surfing - you are
  2057.   connected!
  2058.  
  2059.   17.  Shutting down the PPP link
  2060.  
  2061.   When you have finished with the PPP link, use the standard ppp-off
  2062.   command to shut it down (remember - you need to be root or a member of
  2063.   the PPP group!).
  2064.  
  2065.   In your system log you will see something like:-
  2066.  
  2067.   ______________________________________________________________________
  2068.   Oct 21 16:10:45 hwin pppd[19873]: Interrupt received: terminating link
  2069.   Oct 21 16:10:45 hwin pppd[19873]: ipcp: down
  2070.   Oct 21 16:10:45 hwin pppd[19873]: default route ioctl(SIOCDELRT): Bad address
  2071.   Oct 21 16:10:45 hwin pppd[19873]: fsm_sdata(LCP): Sent code 5, id 2.
  2072.   Oct 21 16:10:46 hwin pppd[19873]: fsm_rtermack(LCP).
  2073.   Oct 21 16:10:46 hwin pppd[19873]: Connection terminated.
  2074.   Oct 21 16:10:46 hwin pppd[19873]: Exit.
  2075.   ______________________________________________________________________
  2076.  
  2077.   Don't worry about the SIOCDELRT - this is just pppd noting that it is
  2078.   terminating and is nothing to worry about.
  2079.  
  2080.   18.  Debugging
  2081.  
  2082.   There are any number of reasons that your connection does not work -
  2083.   chat has failed to complete correctly, you have a dirty line, etc. So
  2084.   check your syslog for indications.
  2085.  
  2086.   A VERY common mistake is that you have mistyped something in your
  2087.   scripts. You need to check these through very carefully - and bear in
  2088.   mind that we humans have a tendency to read what we THINK we have
  2089.   typed - not what is actually there!
  2090.  
  2091.   Another is to try to use PPP-2.2 with kernel 1.2.X or PPP-2.1.2 with
  2092.   kernel 1.3.X/2.0.X - use the right version of pppd for your kernel!
  2093.  
  2094.   Now look in the PPP FAQ (which is really a series of questions and
  2095.   answers). This is a very comprehensive document and the answers ARE
  2096.   there! From my own (sad) experience, if the answer to your problems is
  2097.   not there, the problem is NOT ppp's fault! In my case I was using an
  2098.   ELF kernel that I had not upgraded to  the appropriate kernel modules.
  2099.   I only wasted about 2 days (and most of one night) cursing what had
  2100.   been a perfect PPP server before the light dawned!
  2101.  
  2102.   18.1.  I compiled in PPP but Linux says I don't have it!
  2103.  
  2104.   You are using kernel 1.3.X/2.0.X and have compiled in module support
  2105.   and then compiled PPP support as a module (and installed the modules)
  2106.   - haven't you?
  2107.  
  2108.   If you are NOT using kerneld to autoload the required modules, then
  2109.   you must explicitly load the ppp module (and possibly the serial
  2110.   support module too) before you can run PPP!
  2111.  
  2112.   You can do this by hand - as root, type
  2113.  
  2114.   ______________________________________________________________________
  2115.           insmod ppp
  2116.   ______________________________________________________________________
  2117.  
  2118.   You may also need to load the serial support module first...
  2119.  
  2120.   ______________________________________________________________________
  2121.           insmod slhc
  2122.   ______________________________________________________________________
  2123.  
  2124.   However, you should sort out the auto-loading of kernel modules - so
  2125.   go check out the kerneld mini-howto!
  2126.  
  2127.   Another possibility is that you are trying to use ppp-2.1.2 with Linux
  2128.   kernel 2.0.x (or alternatively that you are using ppp-2.2 with Linux
  2129.   kernel 1.2.x and haven't made the patches necessary to the kernel).
  2130.  
  2131.   Check your versions of kernel and ppp! To re-iterate:-
  2132.  
  2133.   Linux kernel version 2.0.x REQUIRES ppp-2.2.
  2134.  
  2135.   bf/Linux kernel version 1.2.x works with ppp-2.1.2 but can be made to
  2136.   work with ppp-2.2./
  2137.  
  2138.   18.2.  I cannot set up a default route
  2139.  
  2140.   You have a local Ethernet (or another network connection of some kind)
  2141.   with an existing default route already set up.
  2142.  
  2143.   The section on routing in 'Linking two networks using PPP' covers
  2144.   correctly setting this up (briefly).
  2145.  
  2146.   Your problem is that you cannot have more than a single default route.
  2147.   A default route is the destination to which all packets are sent that
  2148.   are not covered by a specific route. Generally, the default route will
  2149.   point at the route from your computer to the Internet.
  2150.  
  2151.   Unfortunately, some Linux distributions set up a default route to the
  2152.   local Ethernet interface. You will need to change the system
  2153.   initialisation that handles configuring your Ethernet interface and
  2154.   establishes the routing across that interface so that it sets up a
  2155.   specific route to your local Ethernet(s).
  2156.  
  2157.   See the NET2-Howto and the Linux Network Administrator Guide for this
  2158.   information.
  2159.  
  2160.   19.  Linking two networks using PPP
  2161.  
  2162.   There is basically no difference between linking a single Linux PC to
  2163.   a PPP server and linking two LANs using PPP on a machine on each LAN.
  2164.   Remember, PPP is a peer to peer protocol.
  2165.  
  2166.   However, you DEFINITELY need to understand about how routing is
  2167.   established. Read the NET-2 howto and the Linux Network Administrator
  2168.   Guide (NAG). You will also find " TCP/IP Network Administration"
  2169.   (published by O'Reilly and Assoc - ISBN 0-937175-82-X) to be of
  2170.   invaluable assistance.
  2171.   In order to link two LANs, you must be using different IP network
  2172.   numbers (or subnets of the same network number) and you will need to
  2173.   use static IP numbers - or use IP masquerade. If you want to use IP
  2174.   masquerade, see the IP masquerade mini-howto for instructions on
  2175.   setting that up.
  2176.  
  2177.   19.1.  Setting up IP numbers
  2178.  
  2179.   Arrange with the network administrator of the other LAN the IP numbers
  2180.   that will be used for each end of the PPP interface. If you are using
  2181.   static IP numbers, this will also probably require you to dial into a
  2182.   specific telephone number.
  2183.  
  2184.   Now edit the appropriate /etc/ppp/options[.ttyXX] file - it's a good
  2185.   idea to have a specific modem and port at your end for this
  2186.   connection. This may well require you to change your /etc/ppp/options
  2187.   file too - and create appropriate options.ttyXX files for any other
  2188.   connections too!
  2189.  
  2190.   Specify the IP numbers for your end of the PPP link in the appropriate
  2191.   options file exactly as shown above for static IP numbers.
  2192.  
  2193.   19.2.  Setting up the routing
  2194.  
  2195.   You must arrange that packets on your local LAN are routed across the
  2196.   interface that the PPP link establishes. This is a two stage process.
  2197.  
  2198.   First of all, you need to establish a route from the machine running
  2199.   the PPP link to the network(s) at the far end of the link. If the link
  2200.   is to the Internet, this can be handled by a default route established
  2201.   by pppd itself at your end of the connection using the 'defaultroute'
  2202.   option to pppd.
  2203.  
  2204.   If however, the link is only linking two LANs, then a specific network
  2205.   route must be added. This is done using a 'route' command in the
  2206.   /etc/ppp/ip-up script (see After the link comes up...) for
  2207.   instructions on doing this.
  2208.  
  2209.   The second thing you need to do is to tell the other computers on your
  2210.   LAN that your Linux computer is actually the 'gateway' for the
  2211.   network(s) at the far end of the ppp link.
  2212.  
  2213.   Of course, the network administrator at the other end of the link has
  2214.   to do all this too! However, as s/he will be routing packets to your
  2215.   specific networks, a specific network route will be required, not a
  2216.   default route (unless the LANs at the far and of the link are linking
  2217.   into you to access the Internet across your connection).
  2218.  
  2219.   19.3.  Network security
  2220.  
  2221.   If you are linking you LAN to the Internet using PPP - or even just to
  2222.   a "foreign" LAN, you need to think about security issues. I strongly
  2223.   urge you to think about setting up a firewall!
  2224.  
  2225.   20.  After the link comes up...
  2226.  
  2227.   Once the PPP link is established, pppd looks for /etc/ppp/ip-up. If
  2228.   this script exists and is executable, the PPP daemon executes the
  2229.   script. This allows you to automate any special routing commands that
  2230.   may be necessary and any other actions that you want to occur every
  2231.   time the PPP link is activated.
  2232.  
  2233.   This is just a shell script and can do anything that a shell script
  2234.   can do (i.e. virtually anything you want).
  2235.  
  2236.   For example, you can get sendmail to dispatch any waiting outbound
  2237.   messages in the mail queue.
  2238.  
  2239.   Similarly, you can insert the commands into ip-up to collect (using
  2240.   pop) any email waiting for you at your ISP.
  2241.  
  2242.   20.1.  Special routing
  2243.  
  2244.   If you are linking two LANs, you will need to set up a specific route
  2245.   to the 'foreign' LANs. This is easily done using the /etc/ppp/ip-up
  2246.   script. The only difficulty arises if your machine handles multiple
  2247.   PPP links.
  2248.  
  2249.   This is because the /etc/ppp/ip-up is executed for EVERY ppp
  2250.   connection that comes up, so you need to carefully execute the correct
  2251.   routing commands for the particular link that comes up.
  2252.  
  2253.   Using the bash 'case' statement on an appropriate parameter that pppd
  2254.   passes into the script accomplishes this. For example, this is the
  2255.   /etc/ppp/ip-up script I use to handle our WAN links and the link to my
  2256.   home Ethernet (also handled on the same ppp server).
  2257.  
  2258.   ______________________________________________________________________
  2259.   #!/bin/bash
  2260.   #
  2261.   # Script which handles the routing issues as necessary for pppd
  2262.   # Only the link to Newman requires this handling.
  2263.   #
  2264.   # When the ppp link comes up, this script is called with the following
  2265.   # parameters
  2266.   #       $1      the interface name used by pppd (e.g. ppp3)
  2267.   #       $2      the tty device name
  2268.   #       $3      the tty device speed
  2269.   #       $4      the local IP address for the interface
  2270.   #       $5      the remote IP address
  2271.   #       $6      the parameter specified by the 'ipparam' option to pppd
  2272.   #
  2273.   case "$5" in
  2274.   # Handle the routing to the Newman Campus server
  2275.           202.12.126.1)
  2276.                   /sbin/route add -net 202.12.126.0 gw 202.12.126.1
  2277.   # and flush the mail queue to get their email there asap!
  2278.                   /usr/sbin/sendmail -q &
  2279.                   ;;
  2280.           139.130.177.2)
  2281.   # Our Internet link
  2282.   # When the link comes up, start the time server and synchronise to the world
  2283.   # provided it is not already running
  2284.                   if [ ! -f /var/lock/subsys/xntpd ]; then
  2285.                           /etc/rc.d/init.d/xntpd.init start &
  2286.                   fi
  2287.   # Start the news server (if not already running)
  2288.                   if [ ! -f /var/lock/subsys/news ]; then
  2289.                           /etc/rc.d/init.d/news start &
  2290.                   fi
  2291.                   ;;
  2292.           203.18.8.104)
  2293.   # Get the email down to my home machine as soon as the link comes up
  2294.   # No routing is required as my home Ethernet is handled by IP
  2295.   # masquerade and proxyarp routing.
  2296.                   /usr/sbin/sendmail -q &
  2297.                   ;;
  2298.           *)
  2299.   esac
  2300.   exit 0
  2301.   ______________________________________________________________________
  2302.  
  2303.   As a result of bringing up the ppp link to our Newman campus and this
  2304.   script, we end up with the following routing table entries (this
  2305.   machine also is our general dial up PPP server AND handles our
  2306.   Internet link). I have interspersed comments in the output to help
  2307.   explain what each entry is) :-
  2308.  
  2309.   ______________________________________________________________________
  2310.   [root@kepler /root]# route -n
  2311.   Kernel routing table
  2312.   Destination     Gateway         Genmask         Flags MSS    Window Use Iface
  2313.   # the HOST route to our remote internet gateway
  2314.   139.130.177.2   *               255.255.255.255 UH    1500   0      134 ppp4
  2315.   # the HOST route to our Newman campus server
  2316.   202.12.126.1    *               255.255.255.255 UH    1500   0       82 ppp5
  2317.   # the HOST route to my home ethernet
  2318.   203.18.8.104    *               255.255.255.255 UH    1500   0       74 ppp3
  2319.   # two of our general dial up PPP lines
  2320.   203.18.8.64     *               255.255.255.255 UH    552    0        0 ppp2
  2321.   203.18.8.62     *               255.255.255.255 UH    552    0        1 ppp1
  2322.   # the specific network route to the Newman campus LAN
  2323.   202.12.126.0    202.12.126.1    255.255.255.0   UG    1500   0        0 ppp5
  2324.   # the route to our local ethernet (super-netting two adjacent C classes)
  2325.   203.18.8.0      *               255.255.254.0   U     1500   0     1683 eth0
  2326.   # the route to the loop back device
  2327.   127.0.0.0       *               255.0.0.0       U     3584   0      483 lo
  2328.   # the default route to the Internet
  2329.   default         139.130.177.2   *               UG    1500   0     3633 ppp4
  2330.   ______________________________________________________________________
  2331.  
  2332.   20.2.  Handling email
  2333.  
  2334.   The previous section shows how to handle the outgoing mail - simply by
  2335.   flushing the mail queue once the link is up.
  2336.  
  2337.   If you are running a WAN link, you can arrange with the network
  2338.   administrator of the remote LAN to do exactly the same thing. For
  2339.   example, at the Newman Campus end of our WAN link, the /etc/ppp/ip-up
  2340.   script looks like :-
  2341.  
  2342.   ______________________________________________________________________
  2343.   #!/bin/bash
  2344.   #
  2345.   # Script which handles the routing issues as necessary for pppd
  2346.   # Only the link to Hedland requires this handling.
  2347.   #
  2348.   # When the ppp link comes up, this script is called with the following
  2349.   # parameters
  2350.   #       $1      the interface name used by pppd (e.g. ppp3)
  2351.   #       $2      the tty device name
  2352.   #       $3      the tty device speed
  2353.   #       $4      the local IP address for the interface
  2354.   #       $5      the remote IP address
  2355.   #       $6      the parameter specified by the 'ipparam' option to pppd
  2356.   #
  2357.   case "$5" in
  2358.           203.18.8.4)
  2359.                   /usr/sbin/sendmail -q
  2360.                   ;;
  2361.           *)
  2362.   esac
  2363.   exit 0
  2364.   ______________________________________________________________________
  2365.  
  2366.   If however you have only a dynamic IP PPP link to your ISP, you need
  2367.   to get your email from the account on your ISPs machine. This is
  2368.   usually done using the POP (Post Office Protocol). This process can be
  2369.   handled using the 'popclient' program - and the ip-up script can
  2370.   automate this process for you too!
  2371.  
  2372.   Simply create a /etc/ppp/ip-up script that contains the appropriate
  2373.   invocation of popclient. For my laptop that runs Red Hat Linux (which
  2374.   I take on any travels), this is
  2375.  
  2376.   ______________________________________________________________________
  2377.   popclient -3 -c -u hartr -p <password> kepler.hedland.edu.au |formail -s procmail
  2378.   ______________________________________________________________________
  2379.  
  2380.   You could use slurp or whatever to do the same for news, and so forth.
  2381.   Remember, the ip-up script is just a standard bash script and so can
  2382.   be used to automate ANY function that needs to be accomplished every
  2383.   time the appropriate PPP link comes up.
  2384.  
  2385.   21.  Shutting down the link
  2386.  
  2387.   The existing /usr/sbin/ppp-off script should work just fine when run
  2388.   as user root. The only changes you may wish to make are for the script
  2389.   to wait for any outgoing email currently being processed by sendmail.
  2390.  
  2391.   This is left as an exercise for the student!
  2392.  
  2393.   In addition, you can create a script file that will be executed once
  2394.   the link has been terminated. This is stored in /etc/ppp/ip-down. It
  2395.   can be used to undo anything special that you did in the corresponding
  2396.   /etc/ppp/ip-up script.
  2397.  
  2398.   22.  Routing issues on a LAN
  2399.  
  2400.   If you are connected to a LAN but still want to use PPP on your
  2401.   personal Linux machine , you need to address some issues of the routes
  2402.   packets need to take from your machine to reach your LAN (through your
  2403.   Ethernet interface) and also to the remote PPP server and beyond.
  2404.  
  2405.   This section does NOT attempt to teach you about routing - it deals
  2406.   only with a simple, special case of (static) routing!
  2407.  
  2408.   I strongly urge you to read the Linux Network Administrator Guide
  2409.   (NAG) if you are NOT familiar with routing. Also the O'Reilly book
  2410.   "TCP/IP Network Administration" covers this topic in a very
  2411.   understandable form.
  2412.  
  2413.   The basic rule of static routing is that the DEFAULT route should be
  2414.   the one that points to the MOST number of network addresses. For other
  2415.   networks, enter specific routes to the routing table.
  2416.  
  2417.   The ONLY situation I am going to cover here is where your Linux box is
  2418.   on a LAN that is not connected to the Internet - and you want to dial
  2419.   out to the Internet for personal use whilst still connected to the
  2420.   LAN.
  2421.  
  2422.   First of all, make sure that your Ethernet route is set up to the
  2423.   specific network addresses available across your LAN - NOT set to the
  2424.   default route!
  2425.  
  2426.   Check this by issuing a route command, you should see something like
  2427.   the following:-
  2428.  
  2429.        [root@hwin /root]# route -n
  2430.        Kernel routing table
  2431.        Destination     Gateway         Genmask         Flags MSS    Window Use Iface
  2432.        loopback        *               255.255.255.0   U     1936   0       50 lo
  2433.        10.0.0.0        *               255.255.255.0   U     1436   0      565 eth0
  2434.  
  2435.   If your Ethernet interface (eth0) is pointing at the default route,
  2436.   (the first column will show "default" in the eth0 line) you need to
  2437.   change your Ethernet initialisation scripts to make it point at the
  2438.   specific network numbers rather than the default route (consult the
  2439.   Net2 HOWTO and NAG).
  2440.  
  2441.   This will allow pppd to set up your default route as shown below:-
  2442.  
  2443.        [root@hwin /root]# route -n
  2444.        Kernel routing table
  2445.  
  2446.        Destination     Gateway         Genmask         Flags MSS    Window Use Iface
  2447.        10.144.153.51   *               255.255.255.255 UH    488    0        0 ppp0
  2448.        127.0.0.0       *               255.255.255.0   U     1936   0       50 lo
  2449.        10.1.0.0        *               255.255.255.0   U     1436   0      569 eth0
  2450.        default         10.144.153.51   *               UG    488    0        3 ppp0
  2451.  
  2452.   As you can see, we have a host route to the PPP server (
  2453.   10.144.153.51) via ppp0 and also a default network route that uses the
  2454.   PPP server as its gateway.
  2455.  
  2456.   If your set up needs to be more complex than this - read the routing
  2457.   documents already mentioned and consult an expert at your site!
  2458.  
  2459.   If your LAN already has routers on it, you will already have gateways
  2460.   established to the wider networks available at your site. You should
  2461.   STILL point your default route at the PPP interface - and make the
  2462.   other routes specific to the networks they serve.
  2463.  
  2464.   22.1.  Note on Security
  2465.  
  2466.   When you set up a Linux box on an existing LAN to link into the
  2467.   Internet, you are potentially opening your entire LAN to the Internet
  2468.   - and the hackers that reside there. Before you do this, I strongly
  2469.   urge you to consult your network administrator and site security
  2470.   policy. If your PPP connection to the Internet is used to successfully
  2471.   attack your site, you will at the very least earn the intense anger of
  2472.   your fellow users, network and system administrators. You may also
  2473.   find yourself in very much more serious trouble!
  2474.  
  2475.   Before you connect a LAN to the Internet, you should consider the
  2476.   security implications of even a DYNAMIC connection - hence the earlier
  2477.   reference to the O'Reilly "Building Internet Firewalls"!
  2478.  
  2479.   23.  Getting Help when totally stuck
  2480.  
  2481.   If you can't get your PPP link to work, go back through this document
  2482.   and check everything - in conjunction with the output created by
  2483.   "chat-v..."  and "pppd -d" in you system log.
  2484.  
  2485.   Also consult the PPP documentation and FAQ plus the other documents
  2486.   mention herein!
  2487.  
  2488.   If you are still stuck, try the comp.os.linux.misc and
  2489.   comp.os.linux.networking newsgroups are reasonably regularly scanned
  2490.   by people that can help you with PPP as is comp.protocols.ppp
  2491.  
  2492.   You can try sending me personal email, but I do have a day job (and a
  2493.   life) and I do not guarantee to respond quickly (if at all) as this
  2494.   depends on my current work load and the state of my private life!
  2495.  
  2496.   In particular - DO NOT POST REAMS OF DEBUGGING OUTPUT TO THE NEWS
  2497.   GROUPS NOR SEND IT TO ME BY EMAIL - the former wastes huge amounts of
  2498.   network bandwidth and the latter will be consigned to /dev/null
  2499.   (unless I have specifically requested it).
  2500.  
  2501.   24.  Common Problems once the link is working
  2502.  
  2503.   One problem you will find is that many service providers will only
  2504.   support the connection software package that they distribute to new
  2505.   accounts. This is (typically) for Microsoft Windows :-( - and many
  2506.   service provider help desks seem to know nothing about Unix (or
  2507.   Linux). So, be prepared for limited assistance from them!
  2508.  
  2509.   You could of course do the individual a favour and educate then about
  2510.   Linux (any ISP help desk person should be reasonably 'with it' in
  2511.   Internet terms and that means they should have a home Linux box - of
  2512.   course it does)!
  2513.  
  2514.   24.1.  I can't see beyond the PPP server I connect to
  2515.  
  2516.   OK - your PPP connection is up and running and you can ping the PPP
  2517.   server by IP number (the second or "remote" IP number shown by
  2518.   ifcongig ppp0), but you can't reach anything beyond this.
  2519.  
  2520.   First of all, try pinging the IP numbers you have specified in
  2521.   /etc/resolv.conf as name servers. If this works, you can see beyond
  2522.   your PPP server (unless this has the same IP number as the "remote" IP
  2523.   number of your connection). So now try pinging the full Internet name
  2524.   of your service provider - eg
  2525.  
  2526.        ping my.provider.net.au
  2527.  
  2528.   If this does NOT work, you have a problem with the name resolution.
  2529.   This is probably because of a typo in your /etc/resolv.conf file.
  2530.   Check this carefully against the information you acquired by ringing
  2531.   your service provider. If all looks OK, ring your service provider and
  2532.   check that you wrote down the IP numbers correctly.
  2533.  
  2534.   If it STILL doesn't work (and your service provider confirms that his
  2535.   name servers are up and running), you have a problem somewhere else -
  2536.   and I suggest you check carefully through your Linux installation
  2537.   (looking particularly for file permissions).
  2538.  
  2539.   If you STILL can't ping your service provider's IP name servers by IP
  2540.   number, either they are down (give them a voice call and check) or
  2541.   there is a routing problem at your service provider's end. Again, ring
  2542.   them and check this out.
  2543.  
  2544.   One possibility is that the "remote end" is a Linux PPP server where
  2545.   the IP forwarding option has not been specified in the kernel!
  2546.  
  2547.   A good general test is to try hooking in to your service provider
  2548.   using the software that most supply for (gulp) Microsoft Windows. If
  2549.   everything works from another operating system to exactly the same
  2550.   account, then the problem is with your Linux system and NOT your
  2551.   service provider.
  2552.  
  2553.   24.2.  I can send email, but not receive it
  2554.  
  2555.   If you are using dynamic IP numbers, this is perfectly normal. See
  2556.   "Setting up Services" below.
  2557.  
  2558.   24.3.  Why can't people finger, WWW, gopher, talk etc to my machine?
  2559.  
  2560.   Again, if you are using dynamic IP numbers, this is perfectly normal.
  2561.   See "Setting up Services" below.
  2562.  
  2563.   25.  Using Internet services with Dynamic IP numbers
  2564.  
  2565.   If you are using dynamic IP number (and many service providers will
  2566.   only give you a dynamic IP number unless you pay significantly more
  2567.   for your connection), then you have to recognise the limitations this
  2568.   imposes.
  2569.  
  2570.   First of all, outbound service requests will work just fine. That is
  2571.   you can send email using sendmail, ftp files from remote sites, finger
  2572.   users on other machines, browse the web etc.
  2573.  
  2574.   In particular, you can answer email that you have brought down to your
  2575.   machine whilst you are off line. Mail will simply sit in your mail
  2576.   queue until you dial back into your ISP.
  2577.  
  2578.   However, your machine is NOT connected to the Internet 24 hours a day,
  2579.   nor does it have the same IP number every time it is connected. So it
  2580.   is impossible for you to receive email directed to your machine, and
  2581.   very difficult to set up a web or ftp server that your friends can
  2582.   access! As far as the Internet is concerned your machine does not
  2583.   exist as a unique, permanently contactable machine as it does not have
  2584.   a unique IP number (remember - other machines will be using the IP
  2585.   number when they are allocated it on dial in).
  2586.  
  2587.   If you set up a WWW (or any other server), it is totally unknown by
  2588.   any user on the Internet UNLESS they know that your machine is
  2589.   connected AND its actual (current) IP number. There are a number of
  2590.   ways they can get this info, ranging from you ringing them, sending
  2591.   them email to tell them or cunning use of ".plan" files on a shell
  2592.   account at your service provider (assuming that your provider allows
  2593.   shell access).
  2594.  
  2595.   Now, for most users, this is not a problem - all that most people want
  2596.   is to send and receive email (using your account on your service
  2597.   provider) and make outbound connections to WWW, ftp and other servers
  2598.   on the Internet. If you MUST have inbound connections to your server,
  2599.   you should really get a static IP number. Alternatively you can
  2600.   explore the methods hinted at above...
  2601.  
  2602.   25.1.  Setting up email
  2603.  
  2604.   Even for dynamic IP numbers, you can certainly configure sendmail on
  2605.   your machine to send out any email that you compose locally.
  2606.   Configuration of sendmail can be obscure and difficult - so this
  2607.   document does not attempt to tell you how to do this. However, you
  2608.   should probably configure sendmail so that your Internet service
  2609.   provider is designated as your "smart relay" host (the sendmail.cf DS
  2610.   option). (For more sendmail configuration info, see the sendmail
  2611.   documents - and look at the m4 configurations that come with sendmail.
  2612.   There is almost certain to be one there that will meet your needs).
  2613.  
  2614.   There are also excellent books on Sendmail (notably the 'bible' from
  2615.   O'Reilly and Associates), but these are almost certainly overkill for
  2616.   most users!
  2617.  
  2618.   Once you have sendmail configured, you will probably want to have
  2619.   sendmail dispatch any messages that have been sitting in the outbound
  2620.   mail queue as soon as the PPP connection comes up. To do this, add the
  2621.   command
  2622.  
  2623.        sendmail -q &
  2624.  
  2625.   to your /etc/ppp/ip-up script.
  2626.  
  2627.   Inbound email is a problem for dynamic IP numbers. The way to handle
  2628.   this is to:-
  2629.  
  2630.   ╖  configure your mail user agent so that all mail is sent out with a
  2631.      "reply to" header giving your email address at your Internet
  2632.      Service provider.
  2633.      If you can, you should also set your FROM address to be your email
  2634.      address at your ISP as well.
  2635.  
  2636.   ╖  use the popclient program to retrieve your email from your service
  2637.      provider.
  2638.  
  2639.   You can automate this process at dial up time by putting the necessary
  2640.   commands in the /etc/ppp/ip-up script.
  2641.  
  2642.   25.2.  Setting Up a local Name server
  2643.  
  2644.   Whilst you can quite happily use the domain name servers located at
  2645.   your ISP, you can also set up a local caching only (secondary) name
  2646.   server that is brought up by the ip-up script. The advantage of
  2647.   running a local (caching only) name server is that it will save you
  2648.   time (and bandwidth) if you frequently contact the same sites during a
  2649.   long on-line session.
  2650.  
  2651.   DNS configuration for a caching only nameserver (that uses a
  2652.   "forwarders' line in the named.boot file pointing at your ISPs DNS) is
  2653.   relatively simple. The O'Reilly book (DNS and Bind) explains all you
  2654.   want to know about this.
  2655.  
  2656.   There is also a DNS-HOWTO available.
  2657.  
  2658.   One point of Nettiquette: ask permission of your ISP before you start
  2659.   using a secondary, caching only name server in your ISP's domain.
  2660.   Properly configured, your DNS will not cause any problems to your ISP
  2661.   at all, but if you get things wrong, it can cause problems...
  2662.  
  2663.   26.  Setting up a PPP server
  2664.  
  2665.   As already mentioned, there are many ways to do this. What I present
  2666.   here is the way I do it (using a Cyclades multi-port serial card) and
  2667.   a rotary dial in set of telephone lines.
  2668.  
  2669.   If you don't like the method I present here, please feel free to go
  2670.   your own way. I would however, be pleased to include additional
  2671.   methods in future versions of the HOWTO. So, please send me your
  2672.   comments and methods!
  2673.  
  2674.   Please note, this section only concerns setting up Linux as a PPP
  2675.   server. I do not (ever) intend to include information on setting up
  2676.   special terminal servers and such.
  2677.  
  2678.   Also, I have yet to experiment with shadow passwords (but will be
  2679.   doing so sometime). Information currently presented does NOT therefore
  2680.   include any bells and whistles that are required by the shadow suite.
  2681.   26.1.  Kernel compilation
  2682.  
  2683.   All the earlier comments regarding kernel compilation and kernel
  2684.   versions versus pppd versions apply. This section assumes that you
  2685.   have read the earlier sections of this document!
  2686.  
  2687.   For a PPP server, you MUST include IP forwarding in your kernel.  You
  2688.   may also wish to include other capabilities (such as IP firewalls,
  2689.   accounting etc etc).
  2690.  
  2691.   If you are using a multi-port serial card, then you must obviously
  2692.   include the necessary drivers in your kernel too!
  2693.  
  2694.   26.2.  Overview of the server system
  2695.  
  2696.   We offer dial up PPP (and SLIP) accounts and shell accounts using the
  2697.   same username/password pair. This has the advantages (for us) that a
  2698.   user requires only one account and can use it for all types of
  2699.   connectivity.
  2700.  
  2701.   As we are an educational organisation, we do not charge our staff and
  2702.   students for access, and so do not have to worry about accounting and
  2703.   charging issues.
  2704.  
  2705.   We operate a firewall between our site and the Internet, and this
  2706.   restricts some user access as the dial up lines are inside our
  2707.   (Internet) firewall (for fairly obvious reasons, details of our other
  2708.   internal firewalls are not presented here and are irrelevant in any
  2709.   case).
  2710.  
  2711.   The process a user goes through to establish a PPP link to our site
  2712.   (once they have a valid account of course) is :-
  2713.  
  2714.   ╖  Dial into our rotary dialer (this is a single phone number that
  2715.      connects to a bank of modems - the first free modem is then used).
  2716.  
  2717.   ╖  Log in using a valid username and password pair.
  2718.  
  2719.   ╖  At the shell prompt, issue the command ppp to start PPP on the
  2720.      server.
  2721.  
  2722.   ╖  Start PPP on their PC (be it running Windows, DOS, Linux MAC OS or
  2723.      whatever - that is their problem).
  2724.  
  2725.   The server uses individual /etc/ppp/options.ttyXX files for each dial
  2726.   in port that set the remote IP number for dynamic IP allocation.  The
  2727.   server users proxyarp routing for the remote clients (set via the
  2728.   appropriate option to pppd). This obviates the need for routed or
  2729.   gated.
  2730.  
  2731.   When the user hangs up at their end, pppd detects this and tells the
  2732.   modem to hang up, bringing down the PPP link at the same time.
  2733.  
  2734.   26.3.  Getting the software together
  2735.  
  2736.   You will need the following software:-
  2737.  
  2738.   ╖  Linux, properly compiled to include the necessary options.
  2739.  
  2740.   ╖  The appropriate version of pppd for your kernel.
  2741.  
  2742.   ╖  A 'getty' program that intelligently handles modem communications.
  2743.      We use getty_ps2.0.7h, but mgetty is highly thought of. I
  2744.      understand that mgetty can detect a call that is using pap/chap
  2745.      (pap is the standard for Windows95) and invoke pppd automatically,
  2746.      but I have yet to explore this.
  2747.  
  2748.   ╖  An operational domain name server (DNS) that is accessible to your
  2749.      dial up users.
  2750.      You should really be running your own DNS if possible...
  2751.  
  2752.   26.4.  Setting up standard (shell access) dialup.
  2753.  
  2754.   Before you can set up your PPP server, your Linux box must be capable
  2755.   of handling standard dial up access.
  2756.  
  2757.   This howto does NOT cover setting this up. Please see the
  2758.   documentation of the getty of your choice and serial HOWTO for
  2759.   information on this.
  2760.  
  2761.   26.5.  Setting up the PPP options files
  2762.  
  2763.   You will need to set up the overall /etc/ppp/options with the common
  2764.   options for all dial up ports. The options we use are:-
  2765.  
  2766.   ______________________________________________________________________
  2767.   asyncmap 0
  2768.   netmask 255.255.254.0
  2769.   proxyarp
  2770.   lock
  2771.   crtscts
  2772.   modem
  2773.   ______________________________________________________________________
  2774.  
  2775.   Note - we do NOT use any (obvious) routing - and in particular there
  2776.   is no defaultroute option. The reason for this is that all you (as a
  2777.   PPP server) are required to do is to route packets from the ppp client
  2778.   out across your LAN/Internet and route packets to the client from your
  2779.   LAN and beyond.
  2780.  
  2781.   All that is necessary for this is a host route to the client machine
  2782.   and the use of the 'proxyarp' option to pppd.
  2783.  
  2784.   The 'proxyarp' option sets up (surprise) a proxy arp entry in the PPP
  2785.   server's arp table that basically says 'send all packets destined for
  2786.   the PPP client to me'. This is the easiest way to set up routing to a
  2787.   single PPP client - but you cannot use this if you are routing between
  2788.   two LANs - you must add proper network routes which can't use proxy
  2789.   arp.
  2790.  
  2791.   You will almost certainly wish to provide dynamic IP number allocation
  2792.   to your dial up users. You can accomplish this by allocating an IP
  2793.   number to each dial up port. Now, create a /etc/ppp/options.ttyXX for
  2794.   each dial up port.
  2795.  
  2796.   In this, simply put the local (server) IP number and the IP number
  2797.   that is to be used for that port. For example
  2798.  
  2799.   ______________________________________________________________________
  2800.   kepler:slip01
  2801.   ______________________________________________________________________
  2802.  
  2803.   In particular, note that you can use valid host names in this file (I
  2804.   find that I only remember the IP numbers of critical machines and
  2805.   devices on my networks - names are more meaningful)!
  2806.  
  2807.   26.6.  Setting pppd up to allow users to (successfully) run it
  2808.  
  2809.   As starting a ppp link implies configuring a kernel device (a network
  2810.   interface) and manipulating the kernel routing tables, special
  2811.   privileges are required - in fact full root privileges.
  2812.  
  2813.   Fortunately, pppd has been designed to be 'safe' to run set uid to
  2814.   root.  So you will need to
  2815.  
  2816.   ______________________________________________________________________
  2817.   chmod u+s /usr/sbin/pppd
  2818.   ______________________________________________________________________
  2819.  
  2820.   When you list the file, it should then appear as
  2821.  
  2822.   ______________________________________________________________________
  2823.   -rwsr-xr-x   1 root     root        74224 Apr 28 07:17 /usr/sbin/pppd
  2824.   ______________________________________________________________________
  2825.  
  2826.   If you do not do this, users will be unable to set up their ppp link.
  2827.  
  2828.   26.7.  Setting up the global alias for pppd
  2829.  
  2830.   In order to simplify things for our dial up PPP users, we create a
  2831.   global alias (in /etc/bashrc) so that one simple command will start
  2832.   ppp on the server once they are logged in.
  2833.  
  2834.   This looks like
  2835.  
  2836.   ______________________________________________________________________
  2837.   alias ppp="exec /usr/sbin/pppd -detach"
  2838.   ______________________________________________________________________
  2839.  
  2840.   What this does is
  2841.  
  2842.   ╖  exec : this means replace the running program (in this case the
  2843.      shell) with the program that is run.
  2844.  
  2845.   ╖  pppd -detach : start up pppd and do NOT fork into the background.
  2846.      This ensures that when pppd exits there is no process hanging
  2847.      around.
  2848.  
  2849.   When a user logs in like this, they will appear in the output of 'w'
  2850.   as
  2851.  
  2852.   ______________________________________________________________________
  2853.     6:24pm  up 3 days,  7:00,  4 users,  load average: 0.05, 0.03, 0.00
  2854.   User     tty       login@  idle   JCPU   PCPU  what
  2855.   hartr    ttyC0     3:05am  9:14                -
  2856.   ______________________________________________________________________
  2857.  
  2858.   And that is it...I told you this was a simple, basic PPP server
  2859.   system!
  2860.  
  2861.   27.  Using PPP across a null modem (direct serial) connection
  2862.  
  2863.   This is very simple - there is no modem in the way so things are much
  2864.   simpler.
  2865.  
  2866.   First of all, choose one of the machines as a 'server', setting up a
  2867.   getty on the serial port so you can test that you do have connectivity
  2868.   using minicom to access the serial port on the 'client'.
  2869.  
  2870.   Once you have this functioning, you can remove the getty UNLESS you
  2871.   want to make sure that the connection is validated using
  2872.   username/password pairs as for a dial up connection. As you have
  2873.   'physical control' of both machines, I will presume that you do NOT
  2874.   want to do this.
  2875.  
  2876.   Now, on the server, remove the getty and make sure that you have the
  2877.   serial ports on both machines configured correctly using 'setserial'.
  2878.  
  2879.   All you need to do now is to start pppd on both systems. I will assume
  2880.   that the connection uses /dev/cua4 on both machines. So, on both
  2881.   machines execute the command:-
  2882.  
  2883.   ______________________________________________________________________
  2884.   pppd -detach crtscts lock <local IP>:<remote IP> /dev/cua4 38400 &
  2885.   ______________________________________________________________________
  2886.  
  2887.   This will bring up the link - but as yet you have no routing
  2888.   specified.  You can test the link by pinging to and fro to each
  2889.   machine. If this works, bring down the link by killing one of the pppd
  2890.   processes.
  2891.  
  2892.   The routing you need  will of course depend on exactly what you are
  2893.   trying to do of course. generally, one of the machines will be
  2894.   connected to an Ethernet (and beyond) and so the routing required is
  2895.   exactly the same as for a PPP server and client.
  2896.  
  2897.   So on the Ethernet equipped machine, the pppd command would be
  2898.  
  2899.   ______________________________________________________________________
  2900.   pppd -detach crtscts lock proxyarp <local IP>:<remote IP> /dev/cua4 38400 &
  2901.   ______________________________________________________________________
  2902.  
  2903.   and on the other machine
  2904.  
  2905.   ______________________________________________________________________
  2906.   pppd -detach crtscts lock defaultroute <local IP>:<remote IP> /dev/cua4 38400 &
  2907.   ______________________________________________________________________
  2908.  
  2909.   If you are linking to networks (using a serial link!) or have more
  2910.   complex routing requirements, you can use /etc/ppp/ip-up in exactly
  2911.   the same way as mentioned earlier in this document.
  2912.  
  2913.   Robert Hart
  2914.   Port Hedland, Western Australia
  2915.   August 1996
  2916.  
  2917.