home *** CD-ROM | disk | FTP | other *** search
/ Hackers Toolkit v2.0 / Hackers_Toolkit_v2.0.iso / HTML / archive / Unix / HOWTOs / PPP-HOWT < prev    next >
Text File  |  1999-11-04  |  159KB  |  3,714 lines

  1.   Linux PPP HOWTO
  2.   Robert Hart, hartr@interweft.com.au
  3.   v3.0, 31 March 1997
  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.The document also provides
  8.   help in debugging non-functional PPP connections.
  9.  
  10.   Copyright
  11.  
  12.   This document is distributed under the terms of the GPL (GNU Public
  13.   License).
  14.  
  15.   Distribution
  16.  
  17.   This document will be posted to comp.os.linux.answers as new versions
  18.   of the document are produced. It is also available in HTML format at:-
  19.  
  20.   ╖  Linux Howto Index <http://sunsite.unc.edu/mdw/linux.html#howto>
  21.  
  22.   ╖  PPP-HOWTO <http://www.interweft.com.au/other/ppp-howto/ppp-
  23.      howto.html>
  24.  
  25.   Other formats (SGML, ASCII, postscript, DVI) are available from Howtos
  26.   - other formats <ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/other-
  27.   formats>.
  28.  
  29.   As sunsite.unc.edu carries a very heavy load, please use an
  30.   appropriate mirror site close to you.
  31.  
  32.   Acknowledgements
  33.  
  34.   A growing number of people have provided me with assistance in
  35.   preparing this document. Special thanks go to Al Longyear for the
  36.   guidance on PPP itself (if there are mistakes here, they are mine not
  37.   his), Greg Hankins (maintainer of the Linux Howto system)and Debi
  38.   Tackett (of MaximumAccess.com) for many helpful suggestions on style,
  39.   content order, logic and clarity of explanations.
  40.  
  41.   Finally, to the many people who have contacted me by email offering
  42.   comments - my thanks. As with all HOWTO authors,  the satisfaction of
  43.   helping is all the payment we receive and it is enough. By writing
  44.   this HOWTO I am repaying in a small way the debt I - and all other
  45.   Linux users - owe to the people who write and maintain our OS of
  46.   choice.
  47.  
  48.   1.  Introduction
  49.  
  50.   PPP (the Point to Point Protocol) is a mechanism for creating and
  51.   running IP  (the Internet Protocol) and other network protocols over a
  52.   serial link - be that a direct serial connection (using a null-modem
  53.   cable), over a telnet established link or a link made using modems and
  54.   telephone lines (and of course using digital lines such as ISDN).
  55.  
  56.   Using PPP, you can connect your Linux PC to a PPP server and access
  57.   the resources of the network to which the server is connected (almost)
  58.   as if you were directly connected to that network.
  59.  
  60.   You can also set up your Linux PC as a PPP server, so that other
  61.   computers can dial into your computer and access the resources on your
  62.   local PC and/or network.
  63.  
  64.   As PPP is a peer-to-peer system, you can also use PPP on two Linux PCs
  65.   to link together two networks (or a local network to the Internet),
  66.   creating a Wide Area Network (WAN).
  67.  
  68.   One major difference between PPP and an Ethernet connection is of
  69.   course speed - a standard Ethernet connection operates at 10 Mbs (Mega
  70.   - million bits per second) maximum theoretical throughput, whereas an
  71.   analogue modem operates at speeds up to 56 kbps (kilo - thousand bits
  72.   per second).
  73.  
  74.   Also, depending on the type of PPP connection, there may be some
  75.   limitations in usage of some applications and services.
  76.  
  77.   1.1.  Clients and Servers
  78.  
  79.   PPP is strictly a peer to peer protocol; there is (technically) no
  80.   difference between the machine that dials in and the machine that is
  81.   dialed into. However, for clarity's sake, it is useful to think in
  82.   terms of servers and clients.
  83.  
  84.   When you dial into a site to establish a PPP connection, you are a
  85.   client. The machine to which you connect is the server.
  86.  
  87.   When you are setting up a Linux box to receive and handle dial in PPP
  88.   connections, you are setting up a PPP server.
  89.  
  90.   Any Linux PC can be both a PPP server and client - even simultaneously
  91.   if you have more than one serial port (and modem if necessary). As
  92.   stated above, there is no real difference between clients and servers
  93.   as far as PPP is concerned, once the connection is made.
  94.  
  95.   This document refers to the machine that initiates the call (that
  96.   dials in) as the CLIENT, whilst the machine that answers the
  97.   telephone, checks the authentication of the dial in request (using
  98.   user names, passwords and possibly other mechanisms) is referred to as
  99.   the SERVER.
  100.  
  101.   The use of PPP as a client to link one or more machines at a location
  102.   into the Internet is, probably, the one in which  most people are
  103.   interested - that is using their Linux PC as a client.
  104.  
  105.   The procedure described in this document will allow you to establish
  106.   and automate your Internet connection.
  107.  
  108.   This document will also give you guidance in setting up your Linux PC
  109.   as a PPP server and in linking two LANs together (with full routing)
  110.   using PPP (this is frequently characterised as establishing a WAN -
  111.   wide area network - link).
  112.  
  113.   1.2.  Differences between Linux distributions
  114.  
  115.   There are many different Linux distributions and they all have their
  116.   own idiosyncrasies and ways of doing things.
  117.  
  118.   In particular, there are two different ways a Linux (and Unix)
  119.   computer actually starts up, configures its interfaces and so forth.
  120.  
  121.   These are BSD system initialisation and System V system
  122.   initialisation. If you dip into some of the Unix news groups, you will
  123.   find occasional religious wars between proponents of these two
  124.   systems. If that sort of thing amuses you, have fun burning bandwidth
  125.   and join in!
  126.  
  127.   Possibly the most widely used distributions are
  128.  
  129.   ╖  Slackware
  130.      which uses BSD style system initialisation
  131.  
  132.   ╖  Red Hat (and its former associate Caldera)
  133.      which use SysV system initialisation (although in a slightly
  134.      modified form)
  135.  
  136.   ╖  Debian
  137.      which uses SysV system initialisation
  138.  
  139.   BSD style initialisation typically keeps its initialisation files in
  140.   /etc/... and these files are:-
  141.  
  142.   ______________________________________________________________________
  143.           /etc/rc
  144.           /etc/rc.local
  145.           /etc/rc.serial
  146.                   (and possibly other files)
  147.   ______________________________________________________________________
  148.  
  149.   Of recent times, some BSD system initialisation schemes use a
  150.   /etc/rc.d...  directory to hold the start up file rather than putting
  151.   everything into /etc.
  152.  
  153.   System V initialisation keeps its initialisation files in directories
  154.   under /etc/... or  /etc/rc.d/... and a number of subdirectories under
  155.   there:-
  156.  
  157.   ______________________________________________________________________
  158.   drwxr-xr-x   2 root     root         1024 Jul  6 15:12 init.d
  159.   -rwxr-xr-x   1 root     root         1776 Feb  9 05:01 rc
  160.   -rwxr-xr-x   1 root     root          820 Jan  2  1996 rc.local
  161.   -rwxr-xr-x   1 root     root         2567 Jul  5 20:30 rc.sysinit
  162.   drwxr-xr-x   2 root     root         1024 Jul  6 15:12 rc0.d
  163.   drwxr-xr-x   2 root     root         1024 Jul  6 15:12 rc1.d
  164.   drwxr-xr-x   2 root     root         1024 Jul  6 15:12 rc2.d
  165.   drwxr-xr-x   2 root     root         1024 Jul 18 18:07 rc3.d
  166.   drwxr-xr-x   2 root     root         1024 May 27  1995 rc4.d
  167.   drwxr-xr-x   2 root     root         1024 Jul  6 15:12 rc5.d
  168.   drwxr-xr-x   2 root     root         1024 Jul  6 15:12 rc6.d
  169.   ______________________________________________________________________
  170.  
  171.   If you are trying to track down where your Ethernet interface and
  172.   associated network routes are actually configured, you will need to
  173.   track through these files to actually find where the commands are that
  174.   do this.
  175.  
  176.   1.3.  Distribution specific PPP configuration tools
  177.  
  178.   On some installations (for example Red Hat and Caldera), there is a X
  179.   Windows configured PPP dial up system. This HOWTO does not cover these
  180.   distribution specific tools. If you are having problems with them,
  181.   contact the distributors directly!
  182.  
  183.   For Red Hat 4.x users, there is now a Red Hat PPP-TIP
  184.   <http://www.interweft.com.au> in the Linux resources area and also
  185.   from Red Hat Software <http://www.redhat.com> in the support area.
  186.  
  187.   2.  IP Numbers
  188.  
  189.   Every device that connects to the Internet must have its own, unique
  190.   IP number. These are assigned centrally by a designated authority for
  191.   each country.
  192.  
  193.   If you are connecting a local area network (LAN) to the Internet, YOU
  194.   MUST use an IP number from your own assigned network range for all the
  195.   computers and devices you have on your LAN. You MUST NOT pick IP
  196.   numbers out of the air and use these whilst connecting to another LAN
  197.   (let alone the Internet). At worst this will simply not work at all
  198.   and could cause total havoc as your 'stolen' IP number starts
  199.   interfering with the communications of another computer that is
  200.   already using the IP number you have picked out of the air.
  201.  
  202.   Please note that the IP numbers used throughout this document (with
  203.   some exceptions) are from the 'unconnected network numbers' series
  204.   that are reserved for use by networks that are not (ever) connected to
  205.   the Internet.
  206.  
  207.   There are IP numbers that are specifically dedicated to LANs that do
  208.   not connect to the Internet. The IP number sequences are:-
  209.  
  210.   ╖  One A Class Network Address
  211.      10.0.0.0 (netmask 255.0.0.0)
  212.   ╖  16 B Class Network Addresses
  213.      172.16.0.0 - 172.31.0.0 (netmask 255.255.0.0)
  214.  
  215.   ╖  256 C Class Network Addresses
  216.      192.168.0.0 - 192.168.255.0 (netmask 255.255.255.0)
  217.  
  218.   If you have a LAN for which you have not been allocated IP numbers by
  219.   the responsible authority in your country, you should use one of the
  220.   network numbers from the above sequences for your machines.
  221.  
  222.   These numbers should never be used on the Internet.
  223.  
  224.   However, they can be used for the local Ethernet on a machine that is
  225.   connecting to the Internet. This is because IP numbers are actually
  226.   allocated to a network interface, not to a computer. So whilst your
  227.   Ethernet interface may use 10.0.0.1 (for example), when you hook onto
  228.   the Internet using PPP, your PPP interface will be given another (and
  229.   valid) IP number by the server. Your PC will have Internet
  230.   connectivity, but the other computers on your LAN will not.
  231.  
  232.   However, using Linux and the IP Masquerade (also known as NAT -
  233.   Network address Translation) capabilities of the Linux and the ipfwadm
  234.   software, you can connect your LAN to the Internet (with some
  235.   restriction of services), even if you do not have valid IP numbers for
  236.   the machines on your Ethernet.
  237.  
  238.   For more information on how to do this see the IP Masquerade mini-
  239.   HOWTO at Linux IP Masquerade mini HOWTO
  240.   <http://sunsite.unc.edu/mdw/HOWTO/mini/IP-Masquerade>
  241.  
  242.   For most users, who are connecting a single machine to an Internet
  243.   service provider via PPP, obtaining an IP number (or more accurately,
  244.   a network number) will not be necessary.
  245.  
  246.   If you wish to connect a small LAN to the Internet, many Internet
  247.   Service Providers (ISPs) can provide you with a dedicated subnet (a
  248.   specific sequence of IP numbers) from their existing IP address space.
  249.   Alternatively, use IP Masquerading.
  250.  
  251.   For users, who are connecting a single PC to the Internet via an ISP,
  252.   most providers use dynamic IP number assignment. That is, as part of
  253.   the connection process, the PPP service you contact will tell your
  254.   machine what IP number to use for the PPP interface during the current
  255.   session. This number will not be the same every time you connect to
  256.   your ISP.
  257.  
  258.   With dynamic IP numbers, you are not given the same IP number each
  259.   time you connect. This has implications for server type applications
  260.   on your Linux machine such as sendmail, ftpd, httpd and so forth.
  261.   These services are based on the premise that the computer offering the
  262.   service is accessible at the same IP number all the time (or at least
  263.   the same fully qualified domain name - FQDN - and that DNS resolution
  264.   of the name to IP address is available).
  265.  
  266.   The limitations of service due to dynamic IP number assignment (and
  267.   ways to work around these, where possible) are discussed later in the
  268.   document.
  269.  
  270.   3.  Aims of this Document
  271.  
  272.   3.1.  Setting up a PPP Client
  273.  
  274.   This document provides guidance to people who wish to use Linux and
  275.   PPP to dial into a PPP server and set up an IP connection using PPP.
  276.   It assumes that PPP has been compiled and installed on your Linux
  277.   machine (but does briefly cover reconfiguring/recompiling your kernel
  278.   to include PPP support).
  279.  
  280.   Whilst DIP (the standard way of creating a SLIP connection) can be
  281.   used to set up a PPP connection, DIP scripts are generally quite
  282.   complex. For this reason, this document does NOT cover using DIP to
  283.   set up a PPP connection.
  284.  
  285.   Instead, this document describes the standard Linux PPP software
  286.   (chat/pppd).
  287.  
  288.   3.2.  Linking two LANs or a LAN to the Internet using PPP
  289.  
  290.   This document provides (basic) information on linking two LANs or a
  291.   LAN to the Internet using PPP.
  292.  
  293.   3.3.  Setting up a PPP server
  294.  
  295.   This document provides guidance on how to configure your Linux PC as a
  296.   PPP server (allowing other people to dial into your Linux PC and
  297.   establish a PPP connection).
  298.  
  299.   You should note that there are a myriad of ways of setting up Linux as
  300.   a PPP server. This document gives one method - that used by the author
  301.   to set up several small PPP servers (each of 16 modems).
  302.  
  303.   This method is known to work well. However, it is not necessarily the
  304.   best method.
  305.  
  306.   3.4.  Using PPP over a direct null modem connection
  307.  
  308.   This document provides a brief overview of using PPP to link two Linux
  309.   PCs via a null modem cable. It is possible to link other OS's to Linux
  310.   this way as well. To do so, you will need to consult the documentation
  311.   for the operating system you are interested in.
  312.  
  313.   3.5.  This document at present does NOT cover...
  314.  
  315.   ╖  Compiling the PPP daemon software
  316.      See the documentation that comes with the version of pppd you are
  317.      using.
  318.  
  319.   ╖  Connecting and configuring a modem to Linux (in detail)
  320.      See the Serial-HOWTO and for modem specific initialisation, see
  321.      Modem Setup Information <http://www.in.net/info/modems/index.html>
  322.      for information that may help you to configure your modem.
  323.  
  324.   ╖  Using DIP to make PPP connections
  325.      Use chat instead...
  326.  
  327.   ╖  Using socks or IP Masquerade
  328.      There are perfectly good documents already covering these two
  329.      packages.
  330.  
  331.   ╖  Using diald to set up an automated connection
  332.      See the diald documentation for information on this.
  333.  
  334.   ╖  Using EQL to gang together two modems into a single PPP link.
  335.  
  336.   ╖  Distribution specific PPP connection methods (such as the Red Hat
  337.      4.x network configuration tool.
  338.      See the distribution for documentation on the methods used.
  339.  
  340.   ╖  The growing number of tools available to automate PPP set up
  341.      See the appropriate documentation.
  342.  
  343.   4.  Software versions covered
  344.  
  345.   This HOWTO assumes that you are using a Linux 1.2.x kernel with the
  346.   PPP 2.1.2 software or Linux 1.3.X/2.0.x and PPP 2.2.
  347.  
  348.   At the time of writing, the latest official version of PPP available
  349.   for Linux is ppp-2.2f. The new version (ppp-2.3) is still in beta.
  350.  
  351.   It is possible to use PPP 2.2.0 with kernel 1.2.13. This requires
  352.   kernel patches. It is recommended that version 1.2.13 kernel users
  353.   move up to ppp-2.2 as it includes several bug fixes and enhancements.
  354.  
  355.   Also, you should particularly note that you cannot use the PPP 2.1.2
  356.   software with Linux kernel version 2.0.X.
  357.  
  358.   Please note that this document does NOT cover problems arising from
  359.   the use of loadable modules for Linux kernel 2.0.x. Please see the
  360.   kerneld mini-HOWTO and the kernel/module 2.0.x documentation (in the
  361.   Linux 2.0.x source tree at /usr/src/linux/Documentation/...).
  362.  
  363.   As this document is designed to assist new users, it is highly
  364.   recommended that you use a version of the Linux kernel and the
  365.   appropriate PPP version that are known to be stable together.
  366.  
  367.   5.  Other Useful/Important Documents
  368.  
  369.   Users are advised to read :-
  370.  
  371.   ╖  the documentation that comes with the PPP package;
  372.  
  373.   ╖  the pppd and chat man pages;
  374.      (use man chat and man pppd to explore these)
  375.  
  376.   ╖  the Linux Network Administration Guide (NAG);
  377.      see The Network Administrators' Guide
  378.      <http://sunsite.unc.edu/mdw/LDP-books/nag-1.0/nag.html>
  379.  
  380.   ╖  the Net-2/3 HOWTO;
  381.      see Linux NET-2/3-HOWTO
  382.      <http://sunsite.unc.edu/mdw/HOWTO/NET-2-HOWTO.html>
  383.   ╖  Linux kernel documentation installed in
  384.      /usr/src/linux/Documentation when you install the Linux source
  385.      code;
  386.  
  387.   ╖  The modem setup information page - see Modem Setup Information
  388.      <http://www.in.net/info/modems/index.html>
  389.  
  390.   ╖  The excellent Unix/Linux books published by O'Reilly and
  391.      Associates. See (O'Reilly and Associates On-Line Catalogue <
  392.      http://www.ora.com/>). If you are new to Unix/Linux, run (don't
  393.      walk) to your nearest computer book shop and invest in a number of
  394.      these immediately!
  395.  
  396.   ╖  The PPP-FAQ maintained by Al Longyear, available from Linux PPP-FAQ
  397.      <ftp://sunsite.unc.edu/pub/Linux/docs/faqs>.
  398.      This contains a great deal of useful information in question/answer
  399.      format that is very useful when working out why PPP is not working
  400.      (properly).
  401.  
  402.   ╖  The growing number of Linux books from various publishing houses
  403.      and authors;
  404.      You are actively encouraged to check the currency of these books.
  405.      Linux development and distributions tend to evolve fairly rapidly,
  406.      whilst the revision of books move (generally) much more slowly!
  407.      Buying an excellent book (and there are many) that is now out of
  408.      date will cause new users considerable confusion and frustration.
  409.  
  410.   The best general starting point for Linux documentation is The Linux
  411.   Documentation Project Home Page <http://sunsite.unc.edu/mdw/>. The
  412.   HOWTO's tend to be revised reasonably regularly.
  413.  
  414.   Whilst you can use this document to create your PPP link without
  415.   reading any of these documents, you will have a far better
  416.   understanding of what is going on if you do so! You will also be able
  417.   to address problems yourself (or at least ask more intelligent
  418.   questions on the comp.os.linux... newsgroups or Linux mailing lists).
  419.  
  420.   These documents (as well as various others, including the relevant
  421.   RFCs) provide additional and more detailed explanation than is
  422.   possible in this HOWTO.
  423.  
  424.   If you are connecting a LAN to the Internet using PPP, you will need
  425.   to know a reasonable amount about TCP/IP networking. In addition to
  426.   the documents above, you will find the O'Reilly books "TCP/IP Network
  427.   Administration" and "Building Internet Firewalls" of considerable
  428.   benefit!
  429.  
  430.   5.1.  Useful Linux Mailing Lists
  431.  
  432.   There are many Linux mailing lists that operate as a means of
  433.   communication between users of many levels of ability. By all means
  434.   subscribe to those that interest you and contribute your expertise and
  435.   views.
  436.  
  437.   A word to the wise: some lists are specifically aimed at "high
  438.   powered" users and/or specific topics. Whilst no-one will complain if
  439.   you 'lurk' (subscribe but don't post messages), you are likely to earn
  440.   heated comments (if not outright flames) if you post 'newbie'
  441.   questions to inappropriate lists.
  442.  
  443.   This is not because guru level users hate new users, but because these
  444.   lists are there to handle the specific issues at particular levels of
  445.   difficulty.
  446.  
  447.   By all means join the lists that offer open subscription, but keep
  448.   your comments relevant to the subject of the list!
  449.  
  450.   A good starting point for Linux mailing lists is Linux Mailing List
  451.   Directory <http://summer.snu.ac.kr/~djshin/linux/mail-
  452.   list/index.shtml>
  453.  
  454.   6.  Overview of what has to be done to get PPP working as a client
  455.  
  456.   This document contains a great deal of information - and with each
  457.   version it grows!
  458.  
  459.   As a consequence, this section aims to provide a concise overview of
  460.   the actions you will need to take to get your Linux system connected
  461.   as a client to a PPP server.
  462.  
  463.   6.1.  Obtaining/Installing the software
  464.  
  465.   If your Linux distribution does not include the PPP software, you will
  466.   need to obtain this from the Linux PPP daemon
  467.   <ftp://sunsite.unc.edu/pub/Linux/system/Network/serial/ppp/ppp-2.2.0f.tar.gz>.
  468.  
  469.   This is the latest official version at the time of writing. However,
  470.   choose the latest version available from this site (ppp-2.3 is in beta
  471.   at the time of writing and should be released soon).
  472.  
  473.   The PPP package contains instructions on how to compile and install
  474.   the software so this HOWTO does not!
  475.  
  476.   6.2.  Compiling PPP support into the kernel
  477.  
  478.   Linux PPP operations come in two parts
  479.  
  480.   ╖  the PPP daemon mentioned above
  481.  
  482.   ╖  kernel support for PPP
  483.  
  484.   Many distributions seem to provide PPP kernel support in their default
  485.   installation kernels, but others do not.
  486.  
  487.   If at boot your kernel reports messages like
  488.  
  489.   ______________________________________________________________________
  490.   PPP Dynamic channel allocation code copyright 1995 Caldera, Inc.
  491.   PPP line discipline registered.
  492.   ______________________________________________________________________
  493.  
  494.   your kernel does have PPP support compiled in.
  495.  
  496.   That said, you will probably want to compile your own kernel whatever
  497.   your distribution to provide the most efficient use of system
  498.   resources given your particular hardware configuration. It is worth
  499.   remembering that the kernel cannot be swapped out of memory and so
  500.   keeping the kernel as small as possible has advantages on a memory
  501.   limited machine.
  502.  
  503.   This document provides minimal kernel re-compilation instructions at
  504.   section ``Configuring your Linux Kernel''.
  505.  
  506.   For greater detail, see the Kernel-HOWTO at The Linux Kernel HOWTO
  507.   <http://sunsite.unc.edu/mdw/HOWTO/Kernel-HOWTO.html>
  508.  
  509.   6.3.  Obtaining information from your ISP
  510.  
  511.   There are an almost infinite number of ways in which a PPP server can
  512.   be set up. In order to connect to your ISP (or corporate PPP server to
  513.   access your intranet), you will need to obtain information on how the
  514.   PPP server operates.
  515.  
  516.   Because you are using Linux, you may have some difficulty with some
  517.   ISP help desks (and work site based PPP intranet servers) which know
  518.   only about MS Windows clients.
  519.  
  520.   However, a rapidly growing number of ISPs use Linux to provide their
  521.   service - and Linux is also penetrating the corporate environment as
  522.   well, so you may be lucky if you do strike problems.
  523.  
  524.   Section ``Getting the Information you need about the PPP server''
  525.   tells you what you need to know about the PPP server to which you are
  526.   going to connect - and how to find out the information you need to
  527.   know.
  528.  
  529.   6.4.  Configuring your modem and serial port
  530.  
  531.   In order to connect to a PPP server and to obtain the best possible
  532.   data transfer rate, your modem needs to be configured correctly.
  533.  
  534.   Similarly, the serial ports on your modem and computer need to be set
  535.   up correctly.
  536.  
  537.   Section ``Configuring your modem and serial port'' provides
  538.   information on this.
  539.  
  540.   6.5.  Setting up Name to Address Resolution (DNS)
  541.  
  542.   In addition to the files that run PPP and perform the automated log in
  543.   to the PPP server, there are a number of text configuration files that
  544.   have to be set up for your computer to be able to resolve names like
  545.   www.interweft.com.au to the IP address that is actually used to
  546.   contact that computer. These are:-
  547.  
  548.   ╖  /etc/resolv.conf
  549.  
  550.   ╖  /etc/host.conf
  551.  
  552.   Section ``Setting up Name to Address Resolution'' for details on
  553.   setting this up.
  554.  
  555.   In particular, you do NOT need to run a name server on your Linux PC
  556.   in order to connect to the Internet (although you may wish to). All
  557.   you need is to know the IP number of at least one name server that you
  558.   can use (preferably one at your ISPs site).
  559.  
  560.   6.6.  PPP and root Privileges
  561.  
  562.   As establishing a PPP link between you Linux computer and another PPP
  563.   server requires manipulation of network devices (the PPP interface is
  564.   a network interface) and the kernel routing table, pppd requires root
  565.   privileges.
  566.  
  567.   For details on this, see section ``Using PPP and root privileges''.
  568.  
  569.   6.7.  Checking your distribution PPP Files and setting up the PPP
  570.   Options
  571.  
  572.   There are a number of configuration and dialer files that need to be
  573.   set up to get PPP operational. There are examples as part of the PPP
  574.   distribution and this section shows what files you should have:-
  575.  
  576.   ______________________________________________________________________
  577.   /etc/ppp/options
  578.   /etc/ppp/scripts/ppp-on
  579.   /etc/ppp/scripts/ppp-on-dialer
  580.   /etc/ppp/options.tpl
  581.   ______________________________________________________________________
  582.  
  583.   You may need to create some additional files depending on exactly what
  584.   you are aiming to achieve with PPP:-
  585.  
  586.   ______________________________________________________________________
  587.   /etc/ppp/options.ttyXX
  588.   /etc/ppp/ip-up
  589.   /etc/ppp/pap-secrets
  590.   /etc/ppp/chap-secrets
  591.   ______________________________________________________________________
  592.  
  593.   In addition, the PPP daemon can use a large number of command line
  594.   options and it is important to use the right ones; so this section
  595.   takes you through the standard PPP options and helps you choose the
  596.   options you should use.
  597.  
  598.   For details on this, see ``Setting up the PPP connection files''.
  599.  
  600.   6.8.  If your PPP server uses PAP (Password Authentication Protocol)
  601.  
  602.   Many ISPs and corporate PPP servers use PAP. If your server does not
  603.   require you to use PAP (if you can log in manually and receive the
  604.   standard user name/password text based prompts it does not use PAP),
  605.   you can safely ignore this section.
  606.  
  607.   Instead of logging into such a server using a user name and password
  608.   when prompted to enter them by the server, a PPP server using PAP does
  609.   not require a text based login.
  610.  
  611.   The user authentication information instead is exchanged as part of
  612.   the link control protocol (LCP) which is the first part of
  613.   establishing a PPP link.
  614.  
  615.   Section ``If your PPP server uses PAP (Password Authentication
  616.   Protocol)'' provides information on the files you need to set up to
  617.   establish a PPP link using PAP.
  618.  
  619.   6.9.  Connecting to the PPP server by hand
  620.  
  621.   Having set up the basic files, it is a good idea to test these by
  622.   connecting (using minicom or seyon) and starting pppd on your Linux PC
  623.   by hand.
  624.  
  625.   See Section ``Setting up the PPP connection manually'' for full
  626.   details of setting this up.
  627.  
  628.   6.10.  Automating your PPP Connection
  629.  
  630.   Once you are able to log in by hand, you can now move to setting up a
  631.   set of scripts that will automate the establishment of the connection.
  632.  
  633.   Section ``Automating your connections - Creating the connection
  634.   scripts'' covers setting up the necessary scripts, with considerable
  635.   attention paid to chat and scripting the login process to the PPP
  636.   server.
  637.  
  638.   This section discusses scripts for user name/password authentication
  639.   as well as scripts for PAP/CHAP authenticating servers.
  640.  
  641.   6.11.  Shutting down the link
  642.  
  643.   Once your link is up and working, you need to be able to deactivate
  644.   the link.
  645.  
  646.   This is covered in Section ``Shutting down the PPP link''.
  647.  
  648.   6.12.  If you have problems
  649.  
  650.   Many people have problems getting PPP to work straight away. The
  651.   variation in PPP servers and how they require you to set up the
  652.   connection is enormous. Similarly, there are many options to PPP - and
  653.   some combinations of these just do not work together, ever.
  654.  
  655.   In addition to the problems of logging in and starting the PPP
  656.   service, there are problems with the modems and the actual telephone
  657.   lines as well!
  658.  
  659.   Section ``Fixing problems'' provides some basic information about
  660.   common errors, how to isolate these and fix them.
  661.  
  662.   This is NOT intended to provide more than just the basics. Al Longyear
  663.   maintains the PPP-FAQ which contains much more information on this
  664.   topic!
  665.  
  666.   6.13.  After the link comes up
  667.  
  668.   Once a PPP link is operational (specifically, once the IP layer is
  669.   operational), Linux PPP can automatically run (as the root user), a
  670.   script to perform any function you can write a script to accomplish.
  671.  
  672.   Section ``After the link comes up'' provides information on the
  673.   /etc/ppp/ip-up script, the parameters it receives from PPP and how to
  674.   use it to do things like acquire your email from your ISP account,
  675.   send any queued email waiting transmission on your machine and such.
  676.  
  677.   6.14.  Problems with standard IP services on a Dynamic IP number PPP
  678.   link
  679.  
  680.   As noted in the introduction, dynamic IP numbers affect the ability of
  681.   your Linux PC to act as a server on the Internet.
  682.  
  683.   Section ``Problems with standard IP services on a Dynamic IP number
  684.   PPP link'' provides information on the (main) services affected and
  685.   what you can do (if anything) to overcome this.
  686.  
  687.   7.  Configuring your Linux Kernel
  688.  
  689.   In order to use PPP, your Linux kernel must be compiled to include PPP
  690.   support. Obtain the Linux source code for your kernel if you do not
  691.   already have this - it belongs in /usr/src/linux on Linux's standard
  692.   file system.
  693.  
  694.   Check out this directory - many Linux distributions install the source
  695.   tree (the files and subdirectories) as part of their installation
  696.   process.
  697.  
  698.   At bootup, your Linux kernel prints out a great deal of information.
  699.   Amongst this is information about PPP support if the kernel includes
  700.   this. To view this information, look at your syslog file or use dmesg
  701.   | less to display the information to the screen. If your kernel
  702.   includes PPP support, you will see lines like
  703.  
  704.   ______________________________________________________________________
  705.   PPP Dynamic channel allocation code copyright 1995 Caldera, Inc.
  706.   PPP line discipline registered.
  707.   ______________________________________________________________________
  708.  
  709.   (this is for the Linux 2.0.x kernel series).
  710.  
  711.   Linux kernel sources can be obtained by ftp from sunsite.unc.edu or
  712.   its mirror sites.
  713.  
  714.   7.1.  Installing the Linux Kernel source
  715.  
  716.   The following are brief instructions for obtaining and installing the
  717.   Linux kernel sources. Full information can be obtained from The Linux
  718.   Kernel HOWTO <http://sunsite.unc.edu/mdw/HOWTO/Kernel-HOWTO.html>.
  719.  
  720.   In order to install and compile the Linux kernel, you need to be
  721.   logged in as root.
  722.  
  723.   1. Change directory to the /usr/src directory
  724.      cd /usr/src
  725.  
  726.   2. Check in /usr/src/linux to see if you already have the sources
  727.      installed.
  728.  
  729.   3. If you don't have the sources, get them from Linux kernel source
  730.      directory <ftp://sunsite.unc.edu/pub/Linux/kernel/v2.0> or your
  731.      nearest mirror.
  732.      If you are looking for earlier versions of the kernel (such as
  733.      1.2.X), these are kept in Old Linux kernel source directory
  734.      <ftp://sunsite.unc.edu/pub/Linux/kernel/old>.
  735.  
  736.   4. Choose the appropriate kernel - usually the most recent one
  737.      available is what you are looking for. Retrieve this and put the
  738.      source tar file in /usr/src.
  739.      Note: a 'tar' file is an archive - possibly compressed (as are the
  740.      Linux kernel source tar files) containing many files in a number of
  741.      directories. It is the Linux equivalent of a DOS multi-directory
  742.      zip file.
  743.  
  744.   5. If you already have the Linux sources installed but are upgrading
  745.      to a new kernel, you must remove the old sources. Use the command
  746.      rm -rf /usr/src/linux
  747.  
  748.   6. Now uncompress and extract the sources using the command
  749.      tar xzf linux-2.0.XX.tar.gz
  750.  
  751.   7. Now, cd /usr/src/linux and read the README file. This contains an
  752.      excellent explanation of how to go about configuring and compiling
  753.      a new kernel. Read this file (it's a good idea to print it out and
  754.      have a copy handy whilst you are compiling until you have done this
  755.      enough times to know your way around).
  756.  
  757.   7.2.  Knowing your hardware
  758.  
  759.   You MUST know what cards/devices you have inside your PC if you are
  760.   going to recompile your kernel!!! For some devices (such as sound
  761.   cards) you will also need to know various settings (such as IRQ's, I/O
  762.   addresses and such).
  763.  
  764.   7.3.  Kernel compilation - the Linux 1.2.13 kernel
  765.  
  766.   To start the configuration process, follow the instructions in the
  767.   README file to properly install the sources. You start the kernel
  768.   configuration process with
  769.        make config
  770.  
  771.   In order to use PPP, you must configure the kernel to include PPP
  772.   support (PPP requires BOTH pppd AND kernel support for PPP).
  773.  
  774.   ______________________________________________________________________
  775.     PPP (point-to-point) support (CONFIG_PPP) [n] y
  776.   ______________________________________________________________________
  777.  
  778.   Answer the other make config questions according to the hardware in
  779.   your PC and the features of the Linux operating system you want. Then
  780.   continue to follow the README to compile and install your new kernel.
  781.  
  782.   The 1.2.13 kernel creates only 4 PPP devices. For multi- port serial
  783.   cards, you will need to edit the kernel PPP sources to obtain more
  784.   ports. (See the README.linux file that comes as part of the PPP-2.1.2
  785.   distribution for full details of the simple edits you need to make).
  786.  
  787.   Note: the 1.2.13 configuration dialogue does NOT allow you to go
  788.   backwards - so if you make a mistake in answering one of the questions
  789.   in the make config dialogue, exit by typing CTRL C and start again.
  790.  
  791.   7.4.  Kernel compilation - the Linux 1.3.x and 2.0.x kernels
  792.  
  793.   For Linux 1.3.x and 2.0.x, you can use a similar process as for Linux
  794.   1.2.13. Again, follow the instructions in the README file to properly
  795.   install the sources. You start the kernel configuration process with
  796.  
  797.        make config
  798.  
  799.   However, you also have the choice of
  800.  
  801.        make menuconfig
  802.  
  803.   This provides a menu based configuration system with online help that
  804.   allows you to move backwards and forwards in the configuration
  805.   process.
  806.  
  807.   There is also a highly recommended X windows based configuration
  808.   interface
  809.  
  810.   make xconfig
  811.  
  812.   You can compile PPP support directly into your kernel or as a loadable
  813.   module.
  814.  
  815.   If you only use PPP some of the time that your Linux machine is
  816.   operating, then compiling PPP support as a loadable module is
  817.   recommended. Using 'kerneld', your kernel will automatically load the
  818.   module(s) required to provide PPP support when you start your PPP link
  819.   process. This saves valuable memory space: no part of the kernel can
  820.   be swapped out of memory, but loadable modules are automatically
  821.   removed if they are not in use.
  822.  
  823.   To do this, you need to enable loadable module support:-
  824.  
  825.   ______________________________________________________________________
  826.           Enable loadable module support (CONFIG_MODULES) [Y/n/?] y
  827.   ______________________________________________________________________
  828.  
  829.   To add PPP kernel support, answer the following question:-
  830.  
  831.   ______________________________________________________________________
  832.           PPP (point-to-point) support (CONFIG_PPP) [M/n/y/?]
  833.   ______________________________________________________________________
  834.  
  835.   For a PPP loadable module, answer M, otherwise for PPP compiled in as
  836.   part of the kernel, answer Y.
  837.  
  838.   Unlike kernel 1.2.13, kernel 2.0.x creates PPP devices on the fly as
  839.   needed and it is not necessary to hack the sources to increase
  840.   available PPP device numbers at all.
  841.  
  842.   7.5.  Note on PPP-2.2 and /proc/net/dev
  843.  
  844.   If you are using PPP-2.2, you will find that a side effect of the 'on
  845.   the fly' creation of the PPP devices is that no devices show up if you
  846.   look in the /proc/net file system until a device is created by
  847.   starting up pppd:-
  848.  
  849.   ______________________________________________________________________
  850.   [hartr@archenland hartr]$ cat /proc/net/dev
  851.   Inter-|   Receive                  |  Transmit
  852.    face |packets errs drop fifo frame|packets errs drop fifo colls carrier
  853.       lo:  92792    0    0    0    0    92792    0    0    0     0    0
  854.     eth0: 621737   13   13    0   23   501621    0    0    0  1309    0
  855.   ______________________________________________________________________
  856.  
  857.   Once you have one (or more) ppp services started, you will see entries
  858.   such as this (from a ppp server):-
  859.   ______________________________________________________________________
  860.   [root@kepler /root]# cat /proc/net/dev
  861.   Inter-|   Receive                  |  Transmit
  862.    face |packets errs drop fifo frame|packets errs drop fifo colls carrier
  863.       lo: 428021    0    0    0    0   428021    0    0    0     0    0
  864.     eth0:4788257  648  648  319  650  1423836    0    0    0  4623    5
  865.     ppp0:   2103    3    3    0    0     2017    0    0    0     0    0
  866.     ppp1:  10008    0    0    0    0     8782    0    0    0     0    0
  867.     ppp2:    305    0    0    0    0      297    0    0    0     0    0
  868.     ppp3:   6720    7    7    0    0     7498    0    0    0     0    0
  869.     ppp4: 118231  725  725    0    0   117791    0    0    0     0    0
  870.     ppp5:  38915    5    5    0    0    28309    0    0    0     0    0
  871.   ______________________________________________________________________
  872.  
  873.   7.6.  General kernel config considerations for PPP
  874.  
  875.   If you are setting up your Linux PC as a PPP server, you must compile
  876.   in IP forwarding support. This is also necessary if you want to use
  877.   Linux to link to LANs together or your LAN to the Internet.
  878.  
  879.   If you are linking a LAN to the Internet (or linking together two
  880.   LANs), you should be concerned about security. Adding support for IP
  881.   fire walls to the kernel is probably a MUST!
  882.  
  883.   You will also need this if you want to use IP masquerade to connect a
  884.   LAN that uses any of the above mentioned 'unconnected' IP network
  885.   numbers.
  886.  
  887.   To enable IP Masquerade and IP fire walling, you MUST answer yes to
  888.   the first question in the make config process:-
  889.  
  890.   ______________________________________________________________________
  891.   Prompt for development and/or incomplete code/drivers (CONFIG_EXPERIMENTAL)?
  892.   ______________________________________________________________________
  893.  
  894.   Whilst this may sound a bit off-putting to new users, many users are
  895.   actively using the IP Masquerade and IP fire walling features of the
  896.   Linux 2.0.XX kernel with no problems.
  897.  
  898.   Once you have installed and rebooted your new kernel, you can start
  899.   configuring and testing your PPP link(s).
  900.  
  901.   8.  Getting the Information you need about the PPP server
  902.  
  903.   Before you can establish a PPP connection with a server, you need to
  904.   obtain the following information (from the sysadmin/user support
  905.   people of the PPP server):-
  906.  
  907.   ╖  The telephone number(s) to dial for the service
  908.      If you are behind a PABX, you also need the PABX number that gives
  909.      you an outside dial tone - this is frequently digit zero (0) or
  910.      nine (9).
  911.  
  912.   ╖  Does the server use DYNAMIC or STATIC IP numbers?
  913.      If the server uses STATIC IP numbers, then you may need to know
  914.      what IP number to use for your end of the PPP connection. If your
  915.      ISP is providing you with a subnet of valid IP numbers, you will
  916.      need to know the IP numbers you can use and the network mask
  917.      (netmask).
  918.  
  919.      Most Internet Service Providers use DYNAMIC IP numbers. As
  920.      mentioned above, this has some implications in terms of the
  921.      services you can use.
  922.  
  923.      However, even if you are using STATIC IP numbers, most PPP servers
  924.      will never (for security reasons) allow the client to specify an IP
  925.      number as this is a security risk. You do still need to know this
  926.      information!
  927.  
  928.   ╖  What are the IP numbers of the ISPs Domain Name Servers?
  929.      There should be at least two although only one is needed.
  930.  
  931.      There could be a problem here. The MS Windows 95 PPP setup allows
  932.      the DNS address to be passed to the client as part of its
  933.      connection process. So your ISP (or corporate help desk) may well
  934.      tell you you don't need the IP address of the DNS server(s).
  935.  
  936.      For Linux, you DO need the address of at least one DNS. The linux
  937.      implementation of PPP does not allow the setting of the DNS IP
  938.      number dynamically at connection time - and quite possibly will
  939.      never do so.
  940.  
  941.      Note: whilst Linux (as a PPP client) cannot accept the DNS address
  942.      from a server, it can, when acting as a server, pass this
  943.      information to clients using the dns-addr pppd option.
  944.  
  945.   ╖  Does the server require the use of PAP/CHAP?
  946.      If this is the case you need to know the "id" and "secret" you are
  947.      to use in connecting. (These are probably your user name and
  948.      password at your ISP).
  949.  
  950.   ╖  Does the server automatically start PPP or do you need to issue any
  951.      commands to start PPP on the server once you are logged in?
  952.      If you must issue a command to start PPP, what is it?
  953.  
  954.   ╖  Is the server a Microsoft Windows NT system and, if so, is it using
  955.      the MS PAP/CHAP system?
  956.      Many corporate LANs seem to use MS Windows NT this way for
  957.      increased security.
  958.  
  959.   Carefully note down this information - you are going to use it!
  960.  
  961.   9.  Configuring your modem and serial port
  962.  
  963.   You should make sure that your modem is correctly set up and that you
  964.   know which serial port it is connected to.
  965.  
  966.   Remember:-
  967.  
  968.   ╖  DOS com1: = Linux /dev/cua0 (and /dev/ttyS0)
  969.  
  970.   ╖  DOS com2: = Linux /dev/cua1 (and /dev/ttyS1)
  971.      et cetera
  972.  
  973.   It is also worth remembering that if you have 4 serial ports, the
  974.   standard PC set up is to have com1 and com3 share IRQ4 and com2 and
  975.   com4 share IRQ3.
  976.   If you have devices on standard serial ports that share an IRQ with
  977.   your modem you are going to have problems. You need to make sure that
  978.   your modem serial port is on its own, unique IRQ. Many modern serial
  979.   cards (and better quality motherboard serial ports) allow you to move
  980.   the IRQ of the serial ports around.
  981.  
  982.   If you are running Linux kernel 2, you can check the in-use IRQs using
  983.   cat /proc/interrupts, which will produce output like
  984.  
  985.   ______________________________________________________________________
  986.    0:    6766283   timer
  987.    1:      91545   keyboard
  988.    2:          0   cascade
  989.    4:     156944 + serial
  990.    7:     101764   WD8013
  991.   10:     134365 + BusLogic BT-958
  992.   13:          1   math error
  993.   15:    3671702 + serial
  994.   ______________________________________________________________________
  995.  
  996.   This shows a serial port on IRQ4 (a mouse) and a serial port on IRQ15
  997.   (the permanent modem based PPP link to the Internet. (There is also a
  998.   serial port on com2, IRQ3 and com4 is on IRQ14, but as they are not in
  999.   use, they do not show up).
  1000.  
  1001.   Be warned - you need to know what you are doing if you are going to
  1002.   play with your IRQs! Not only do you have to open up you computer,
  1003.   pull out cards and play with jumpers, but you need to know what is on
  1004.   which IRQ.  In my case, this is a totally SCSI based PC, and so I can
  1005.   disable the on motherboard IDE interfaces that normally use IRQ14 and
  1006.   15!
  1007.  
  1008.   You should also remember that if your PC boots other operating
  1009.   systems, moving IRQs around may well mean that OS cannot boot properly
  1010.   - or at all!
  1011.  
  1012.   If you do move your serial ports to non-standard IRQs, then you need
  1013.   to tell Linux which IRQ each port is using. This is done using
  1014.   setserial and is best done as part of the boot process in rc.local or
  1015.   rc.serial which is called from rc.local or as part of the SysV
  1016.   initialisation. For the machine illustrated above, the commands used
  1017.   are
  1018.  
  1019.   ______________________________________________________________________
  1020.   /bin/setserial -b /dev/ttyS2 IRQ 11
  1021.   /bin/setserial -b /dev/ttyS3 IRQ 15
  1022.   ______________________________________________________________________
  1023.  
  1024.   However, if you are using serial modules dynamically loaded when
  1025.   required by the kerneld process, you cannot set and forget the IRQ etc
  1026.   once at boot time. This is because if the serial module is unloaded,
  1027.   Linux forgets the special settings.
  1028.  
  1029.   So, if you are loading the serial module on demand, you will need to
  1030.   reconfigure the IRQs etc each time the module is loaded.
  1031.   9.1.  A note about serial ports and speed capabilities
  1032.  
  1033.   If you are using a high speed (external) modem (14,400 Baud or above),
  1034.   your serial port needs to be capable of handling the throughput that
  1035.   such a modem is capable of producing, particularly when the modems are
  1036.   compressing the data.
  1037.  
  1038.   This requires your serial port to use a modern UART (Universal
  1039.   Asynchronous Receiver Transmitter) such as a 16550(A). If you are
  1040.   using an old machine (or old serial card), it is quite possible that
  1041.   your serial port has only an 8250 UART, which will cause you
  1042.   considerable problems when used with a high speed modem.
  1043.  
  1044.   Use the command
  1045.  
  1046.        setserial -a /dev/ttySx
  1047.  
  1048.   to get Linux to report to you the type of UART you have. If you do not
  1049.   have a 16550A type UART, invest in a new serial card (available for
  1050.   under $50). When you purchase a new card, make sure you can move the
  1051.   IRQs around on it!
  1052.  
  1053.   Note: the first versions of the 16550 UART chip had an error. This was
  1054.   rapidly discovered and a revision of the chip was released - the
  1055.   16550A UART. A relatively small number of the faulty chips did however
  1056.   get into circulation. It is unlikely that you will encounter one of
  1057.   these but you should look for a response that says 16550A,
  1058.   particularly on serial cards of some vintage.
  1059.  
  1060.   9.2.  Serial Port Names
  1061.  
  1062.   Historically, Linux used cuaX devices for dial out and ttySx devices
  1063.   for dial in.
  1064.  
  1065.   The kernel code that required this was changed in kernel version 2.0.x
  1066.   and you should now use ttySx for both dial in and dial out. I
  1067.   understand that the cuaX device names may well disappear in future
  1068.   kernel versions.
  1069.  
  1070.   9.3.  Configuring your modem
  1071.  
  1072.   You will need to configure your modem correctly for PPP - to do this
  1073.   READ YOUR MODEM MANUAL! Most modems come with a factory default
  1074.   setting that selects the options required for PPP. The minimum
  1075.   configuration specifies:-
  1076.  
  1077.   ╖  Hardware flow control (RTS/CTS) (&K3 on many Hayes modems)
  1078.  
  1079.   Other settings (in standard Hayes commands) you should investigate
  1080.   are:-
  1081.  
  1082.   ╖  E1 Command/usr/src/linux-2.0.27/include/linux/serial.h Echo ON
  1083.      (required for chat to operate)
  1084.  
  1085.   ╖  Q0 Report result codes (required for chat to operate)
  1086.  
  1087.   ╖  S0=0 Auto Answer OFF (unless you want your modem to answer the
  1088.      phone)
  1089.  
  1090.   ╖  &C1 Carrier Detect ON only after connect
  1091.  
  1092.   ╖  &S0 Data Set Ready (DSR) always ON
  1093.  
  1094.   ╖  (depends)   Data Terminal Ready
  1095.  
  1096.   There is a site offering modem setups for a growing variety of modem
  1097.   makes and models at Modem setup information
  1098.   <http://www.in.net/info/modems/index.html> which may assist you in
  1099.   this.
  1100.  
  1101.   It is also worth while investigating how the modem's serial interface
  1102.   between your computer and modem operates. Most modern modems allow you
  1103.   to run the serial interface at a FIXED speed whilst allowing the
  1104.   telephone line interface to change its speed to the highest speed it
  1105.   and the remote modem can both handle.
  1106.  
  1107.   This is known as split speed operation. If your modem supports this,
  1108.   lock the modem's serial interface to its highest available speed
  1109.   (usually 115,200 baud but maybe 38,400 baud for 14,400 baud modems).
  1110.  
  1111.   Use your communications software (e.g. minicom or seyon) to find out
  1112.   about your modem configuration and set it to what is required for PPP.
  1113.   Many modems report their current settings in response to AT&V, but you
  1114.   should consult your modem manual.
  1115.  
  1116.   If you completely mess up the settings, you can return to sanity
  1117.   (usually) by issuing an AT&F - return to factory settings.  (For most
  1118.   modem modems I have encountered, the factory settings include all you
  1119.   need for PPP - but you should check).
  1120.  
  1121.   Once you have worked out the modem setup string required write it
  1122.   down.  You now have a decision: you can store these settings in your
  1123.   modem non-volatile memory so they can be recalled by issuing the
  1124.   appropriate AT command. Alternatively you can pass the correct
  1125.   settings to your modem as part of the PPP dialing process.
  1126.  
  1127.   If you only use your modem from Linux to call into your ISP or
  1128.   corporate server, the simplest set up will have you save your modem
  1129.   configuration in non-volatile RAM.
  1130.  
  1131.   If on the other hand, you modem is used by other applications and
  1132.   operating systems, it is safest to pass this information to the modem
  1133.   as each call is made so that the modem is guaranteed to be in the
  1134.   correct state for the call. (This has the added advantage also of
  1135.   recording the modem setup string in case the modem looses  the
  1136.   contents of its NV-RAM, which can indeed happen).
  1137.  
  1138.   9.4.  Note on Serial Flow Control
  1139.  
  1140.   When data is traveling on serial communication lines, it can happen
  1141.   that data arrives faster than a computer can handle it (the computer
  1142.   may be busy doing something else - remember, Linux is a multi-user,
  1143.   multi- tasking operating system). In order to ensure that data is not
  1144.   lost (data does not over run in the input buffer and hence get lost),
  1145.   some method of controlling the flow of data is necessary.
  1146.  
  1147.   There are two ways of doing this on serial lines:-
  1148.  
  1149.   ╖  Using hardware signals (Clear To Send/Request to Send - CTS/RTS)
  1150.  
  1151.   ╖  Using software signals (control S and control Q, also known as
  1152.      XON/XOFF).
  1153.  
  1154.   Whilst the latter may be fine for a terminal (text) link, data on a
  1155.   PPP link uses all 8 bits - and it is quite probable that somewhere in
  1156.   the data there will be data bytes that translate as control S and
  1157.   control Q. So, if a modem is set up to use software flow control,
  1158.   things can rapidly go berserk!
  1159.  
  1160.   For high speed links using PPP (which uses 8 bits of data) hardware
  1161.   flow control is vital and it is for this reason that you must use
  1162.   hardware flow control.
  1163.  
  1164.   9.5.  Testing your modem for dial out
  1165.  
  1166.   Now that you have sorted out the serial port and modem settings it is
  1167.   a good idea to make sure that these setting do indeed work by dialing
  1168.   you ISP and seeing if you can connect.
  1169.  
  1170.   Using you terminal communications package (such as minicom), set up
  1171.   the modem initialisation required for PPP and dial into the PPP server
  1172.   you want to connect to with a PPP session.
  1173.  
  1174.   (Note: at this stage we are NOT trying to make a PPP connection - just
  1175.   establishing that we have the right phone number and also to find out
  1176.   exactly what the server sends to us in order to get logged in and
  1177.   start PPP).
  1178.  
  1179.   During this process, either capture (log to a file) the entire login
  1180.   process or carefully (very carefully) write down exactly what prompts
  1181.   the server gives to let you know it is time to enter your user name
  1182.   and password (and any other commands needed to establish the PPP
  1183.   connection).
  1184.  
  1185.   If your server uses PAP, you should not see a login prompt, but should
  1186.   instead see the (text representation) of the link control protocol
  1187.   (which looks like garbage) starting on your screen.
  1188.  
  1189.   A few words of warning:-
  1190.  
  1191.   ╖  some servers are quite intelligent: you can log in using text based
  1192.      user name/passwords OR using PAP. So if your ISP or corporate site
  1193.      uses PAP but you do not see the garbage start up immediately, this
  1194.      may not mean you have done something wrong.
  1195.  
  1196.   ╖  some servers require you to enter some text initially and then
  1197.      start a standard PAP sequence.
  1198.   ╖  Some PPP servers are passive - that is they simply sit there
  1199.      sending nothing until the client that is dialing in sends them a
  1200.      valid lcp packet. If the ppp server you are connecting to operates
  1201.      in passive mode, you will never see the garbage!
  1202.  
  1203.   ╖  Some servers do not start PPP until you press ENTER - so it is
  1204.      worth trying this if you correctly log in and do not see the
  1205.      garbage!
  1206.  
  1207.   It is worth dialing in at least twice - some servers change their
  1208.   prompts (e.g. with the time!) every time you log in. The two critical
  1209.   prompts your Linux box needs to be able to identify every time you
  1210.   dial in are:-
  1211.  
  1212.   ╖  the prompt that requests you to enter your user name;
  1213.  
  1214.   ╖  the prompt that requests you to enter your password;
  1215.  
  1216.   If you have to issue a command to start PPP on the server, you will
  1217.   also need to find out the prompt the server gives you once you are
  1218.   logged in to tell you that you can now enter the command to start ppp.
  1219.  
  1220.   If your server automatically starts PPP, once you have logged in, you
  1221.   will start to see garbage on your screen - this is the PPP server
  1222.   sending your machine information to start up and configure the PPP
  1223.   connection.
  1224.  
  1225.   This should look something like this :-
  1226.  
  1227.   ______________________________________________________________________
  1228.   ~y}#.!}!}!} }8}!}$}%U}"}&} } } } }%}& ...}'}"}(}"} .~~y}
  1229.   ______________________________________________________________________
  1230.  
  1231.   (and it just keeps on coming!)
  1232.  
  1233.   On some systems PPP must be explicitly started on the server. This is
  1234.   usually because the server has been set up to allow PPP logins and
  1235.   shell logins using the same user name/password pair. If this is the
  1236.   case, issue this command once you have logged in. Again, you will see
  1237.   the garbage as the server end of the PPP connection starts up.
  1238.  
  1239.   If you do not see this immediately after connecting (and logging in
  1240.   and starting the PPP server if required), press Enter to see if this
  1241.   starts the PPP server...
  1242.  
  1243.   At this point, you can hang up your modem (usually, type +++ quickly
  1244.   and then issue the ATHO command once your modem responds with OK).
  1245.  
  1246.   If you can't get your modem to work, read your modem manual, the man
  1247.   pages for your communications software and the Serial HOWTO! Once you
  1248.   have this sorted out, carry on as above.
  1249.  
  1250.   10.  Setting up Name to Address Resolution (DNS)
  1251.  
  1252.   Whilst we humans like to give names to things, computers really like
  1253.   numbers. On a TCP/IP network (which is what the Internet is), we call
  1254.   machines by a particular name - and every machine lives in a
  1255.   particular "domain". For example, my Linux workstation is called
  1256.   archenland and it resides in the interweft.com.au domain. Its human
  1257.   readable address is thus archenland.interweft.com.au (which is known
  1258.   as the FQDN - fully qualified domain name).
  1259.  
  1260.   However, for this machine to be found by other computers on the
  1261.   Internet, it is actually known by its IP number when computers are
  1262.   communicating across the Internet.
  1263.  
  1264.   Translating (resolving) machine (and domain) names into the numbers
  1265.   actually used on the Internet is the business of machines that offer
  1266.   the Domain Name Service.
  1267.  
  1268.   What happens is this:-
  1269.  
  1270.   ╖  your machine needs to know the IP address of a particular computer.
  1271.      The application requiring this information asks the 'resolver' on
  1272.      your Linux PC to provide this information;
  1273.  
  1274.   ╖  the resolver queries the local host file (/etc/hosts and/or the
  1275.      domain name servers it knows about (the exact behaviour of the
  1276.      resolver is determined by /etc/host.conf);
  1277.  
  1278.   ╖  if the answer is found in the host file, this answer is returned;
  1279.  
  1280.   ╖  if a domain name server is specified, your PC queries this machine;
  1281.  
  1282.   ╖  if the DNS machine already knows the IP number for the required
  1283.      name, it returns it. If it does not, it queries other name servers
  1284.      across the Internet to find the information. The name server than
  1285.      passes this information back to the requesting resolver - which
  1286.      gives the information to the requesting application.
  1287.  
  1288.   When you make a PPP connection, you need to tell your Linux machine
  1289.   where it can get host name to IP number (address resolution)
  1290.   information so that you can use the machine names but your computer
  1291.   can translate these to the IP numbers it needs to do its work.
  1292.  
  1293.   One way is to enter every host that you want to talk to into the
  1294.   /etc/hosts file (which is in reality totally impossible if you are
  1295.   connecting to the Internet); another is to use the machine IP numbers
  1296.   as opposed to the names (an impossible memory task for all but the
  1297.   smallest LANs).
  1298.  
  1299.   The best way is to set up Linux so that it knows where to go to get
  1300.   this name to number information - automatically. This service is
  1301.   provided by the Domain Name Server (DNS) system. All that is necessary
  1302.   is to enter the IP number(s) for the domain name servers into your
  1303.   /etc/resolv.conf file.
  1304.  
  1305.   10.1.  The /etc/resolv.conf file
  1306.  
  1307.   Your PPP server sysadmin/user support people should provide you with
  1308.   two DNS IP numbers (only one is necessary - but two gives some
  1309.   redundancy in the event of failure).
  1310.  
  1311.   As previously mentioned, Linux cannot set its name server IP number in
  1312.   the way that MS Windows 95 does. So you must insist (politely) that
  1313.   your ISP provide you with this information!
  1314.  
  1315.   Your /etc/resolv.conf should look something like :-
  1316.  
  1317.   ______________________________________________________________________
  1318.   domain your.isp.domain.name
  1319.   nameserver 10.25.0.1
  1320.   nameserver 10.25.1.2
  1321.   ______________________________________________________________________
  1322.  
  1323.   Edit this file (creating it if necessary) to represent the information
  1324.   that your ISP has provided. It should have ownership and permissions
  1325.   as follows :-
  1326.  
  1327.        -rw-r--r--   1 root     root           73 Feb 19 01:46 /etc/resolv.conf
  1328.  
  1329.   If you have already set up a /etc/resolv.conf because you are on a
  1330.   LAN, simply add the IP numbers of the PPP DNS servers to your existing
  1331.   file.
  1332.  
  1333.   10.2.  The /etc/host.conf file
  1334.  
  1335.   You should also check that your /etc/host.conf file is correctly set
  1336.   up. This should look like
  1337.  
  1338.   ______________________________________________________________________
  1339.   order hosts,bind
  1340.   multi on
  1341.   ______________________________________________________________________
  1342.  
  1343.   This tells the resolver to use information in the host file before it
  1344.   sends queries to the DNS for resolution.
  1345.  
  1346.   11.  Using PPP and root privileges
  1347.  
  1348.   Because PPP needs to set up networking devices, change the kernel
  1349.   routing table and so forth, it requires root privileges to do this.
  1350.  
  1351.   If users other than root are to set up PPP connections, the pppd
  1352.   program should be setuid root :-
  1353.        -rwsr-xr-x   1 root     root        95225 Jul 11 00:27 /usr/sbin/pppd
  1354.  
  1355.   If /usr/sbin/pppd is not set up this way, then as root issue the
  1356.   command:-
  1357.  
  1358.        chmod u+s /usr/sbin/pppd
  1359.  
  1360.   What this does is make pppd run with root privileges even if the
  1361.   binary is run by an ordinary user. This allows a normal user to run
  1362.   pppd with the necessary privileges to set up the network interfaces
  1363.   and the kernel routing table.
  1364.  
  1365.   Programs that run 'set uid root' are potential security holes and you
  1366.   should be extremely cautious about making programs 'suid root'. A
  1367.   number of programs (including pppd) have been carefully written to
  1368.   minimise the danger of running suid root, so you should be safe with
  1369.   this one (but no guarantees).
  1370.  
  1371.   Depending on how you want your system to operate - specifically if you
  1372.   want ANY user on your system to be able to initiate a PPP link, you
  1373.   should make your ppp-on/off scripts world read/execute. (This is
  1374.   probably fine if your PC is used ONLY by you).
  1375.  
  1376.   However, if you do NOT want just anyone to be able to start up a PPP
  1377.   connection (for example, your children have accounts on your Linux PC
  1378.   and you do not want them hooking into the Internet without your
  1379.   supervision), you will need to establish a PPP group (as root, edit
  1380.   /etc/group) and :-
  1381.  
  1382.   ╖  Make pppd suid root, owned by user root and group PPP, with the
  1383.      'other' permissions on this file empty. It should then look like
  1384.  
  1385.        -rwsr-x---   1 root     PPP        95225 Jul 11 00:27 /usr/sbin/pppd
  1386.  
  1387.   ╖  Make the ppp-on/off scripts owned by user root and group PPP
  1388.  
  1389.   ╖  Make the ppp-on/off scripts read/executable by group PPP
  1390.  
  1391.          -rwxr-x---   1 root     PPP           587 Mar 14  1995 /usr/sbin/ppp-on
  1392.          -rwxr-x---   1 root     PPP           631 Mar 14  1995 /usr/sbin/ppp-off
  1393.  
  1394.   ╖  Make the other access rights for ppp-on/off nill.
  1395.  
  1396.   ╖  add the users who will be firing up PPP to the PPP group in
  1397.      /etc/group
  1398.  
  1399.   Even if you do this, ordinary users will STILL not be able to shut
  1400.   down the link under software control! Running the ppp-off script
  1401.   requires root privileges. However, any user can just turn off the
  1402.   modem (or disconnect the telephone line from an internal modem).
  1403.  
  1404.   An alternative (and better method) to this set up is to use the sudo
  1405.   program. This offers superior security and will allow you to set
  1406.   things up so that any (authorised) user can activate/deactivate the
  1407.   link using the scripts. Using sudo will allow an authorised user to
  1408.   activate/deactivate the PPP link cleanly and securely.
  1409.  
  1410.   12.  Setting up the PPP connection files
  1411.  
  1412.   You now need to be logged in as root to create the directories and
  1413.   edit the files needed to set up PPP, even if you want PPP to be
  1414.   accessible to all users.
  1415.  
  1416.   PPP uses a number of files to connect and set up a PPP connection.
  1417.   These differ in name and location between PPP 2.1.2 and 2.2.
  1418.  
  1419.   For PPP 2.1.2 the files are:-
  1420.  
  1421.   ______________________________________________________________________
  1422.   /usr/sbin/pppd          # the PPP binary
  1423.   /usr/sbin/ppp-on        # the dialer/connection script
  1424.   /usr/sbin/ppp-off       # the disconnection script
  1425.   /etc/ppp/options        # the options pppd uses for all connections
  1426.   /etc/ppp/options.ttyXX  # the options specific to a connection on this port
  1427.   ______________________________________________________________________
  1428.  
  1429.   For PPP 2.2 the files are:-
  1430.  
  1431.   ______________________________________________________________________
  1432.   /usr/sbin/pppd                  # the PPP binary
  1433.   /etc/ppp/scripts/ppp-on         # the dialer/connection script
  1434.   /etc/ppp/scripts/ppp-on-dialer  # part 1 of the dialer script
  1435.   /etc/ppp/scripts/ppp-off        # the actual chat script itself
  1436.   /etc/ppp/options                # the options pppd uses for all connections
  1437.   /etc/ppp/options.ttyXX          # the options specific to a connection on this port
  1438.   ______________________________________________________________________
  1439.  
  1440.   Red Hat Linux users should note that the standard Red Hat 4.X
  1441.   installation places these scripts in /usr/doc/ppp-2.2.0f-2/scripts.
  1442.  
  1443.   In your /etc directory there should be a ppp directory:-
  1444.  
  1445.        drwxrwxr-x   2 root     root         1024 Oct  9 11:01 ppp
  1446.  
  1447.   If it does not exist - create it with these ownerships and
  1448.   permissions.
  1449.  
  1450.   If the directory already existed, it should contain a template options
  1451.   file called options.tpl. This file is included below in case it does
  1452.   not.
  1453.  
  1454.   Print it out as it contains an explanation of nearly all the PPP
  1455.   options (these are useful to read in conjunction with the pppd man
  1456.   pages).  Whilst you can use this file as the basis of your
  1457.   /etc/ppp/options file, it is probably better to create your own
  1458.   options file that does not include all the comments in the template -
  1459.   it will be much shorter and easier to read/maintain.
  1460.  
  1461.   If you have multiple serial lines/modems (typically the case for PPP
  1462.   servers), create a general /etc/ppp/options file containing the
  1463.   options that are common for all the serial ports on which you are
  1464.   supporting dial in/out  and set up individual option files for each
  1465.   serial line on which you will be establishing a PPP connection with
  1466.   the individual settings required for each port.
  1467.  
  1468.   These port specific option files are named options.ttyx1,
  1469.   options.ttyx2 and so forth (where x is the appropriate letter for your
  1470.   serial ports).
  1471.  
  1472.   However, for a single PPP connection, you can happily use the
  1473.   /etc/ppp/options file. Alternatively, you can put all the options as
  1474.   arguments in the pppd command itself.
  1475.  
  1476.   It is easier to maintain a setup that uses /etc/ppp/options.ttySx
  1477.   files. If you use PPP to connect to a number of different sites, you
  1478.   can create option files for each site in /etc/ppp/options.site and
  1479.   then specify the option file as a parameter to the PPP command as you
  1480.   connect (using the file option-file pppd option to pppd on the command
  1481.   line).
  1482.  
  1483.   12.1.  The supplied options.tpl file
  1484.  
  1485.   Some distributions of PPP seem to have lost the options.tpl file, so
  1486.   here is the complete file. I suggest that you do NOT edit this file to
  1487.   create your /etc/ppp/options file(s). Rather, copy this to a new file
  1488.   and then edit that. If you mess up your edits, you can then go back to
  1489.   the original and start again.
  1490.  
  1491.   ______________________________________________________________________
  1492.   # /etc/ppp/options -*- sh -*- general options for pppd
  1493.   # created 13-Jul-1995 jmk
  1494.   # autodate: 01-Aug-1995
  1495.   # autotime: 19:45
  1496.  
  1497.   # Use the executable or shell command specified to set up the serial
  1498.   # line.  This script would typically use the "chat" program to dial the
  1499.   # modem and start the remote ppp session.
  1500.   #connect "echo You need to install a connect command."
  1501.  
  1502.   # Run the executable or shell command specified after pppd has
  1503.   # terminated the link.  This script could, for example, issue commands
  1504.   # to the modem to cause it to hang up if hardware modem control signals
  1505.   # were not available.
  1506.   #disconnect "chat -- \d+++\d\c OK ath0 OK"
  1507.  
  1508.   # async character map -- 32-bit hex; each bit is a character
  1509.   # that needs to be escaped for pppd to receive it.  0x00000001
  1510.   # represents '\x01', and 0x80000000 represents '\x1f'.
  1511.   #asyncmap 0
  1512.  
  1513.   # Require the peer to authenticate itself before allowing network
  1514.   # packets to be sent or received.
  1515.   #auth
  1516.  
  1517.   # Use hardware flow control (i.e. RTS/CTS) to control the flow of data
  1518.   # on the serial port.
  1519.   #crtscts
  1520.  
  1521.   # Use software flow control (i.e. XON/XOFF) to control the flow of data
  1522.   # on the serial port.
  1523.   #xonxoff
  1524.  
  1525.   # Add a default route to the system routing tables, using the peer as
  1526.   # the gateway, when IPCP negotiation is successfully completed.  This
  1527.   # entry is removed when the PPP connection is broken.
  1528.   #defaultroute
  1529.  
  1530.   # Specifies that certain characters should be escaped on transmission
  1531.   # (regardless of whether the peer requests them to be escaped with its
  1532.   # async control character map).  The characters to be escaped are
  1533.   # specified as a list of hex numbers separated by commas.  Note that
  1534.   # almost any character can be specified for the escape option, unlike
  1535.   # the asyncmap option which only allows control characters to be
  1536.   # specified.  The characters which may not be escaped are those with hex
  1537.   # values 0x20 - 0x3f or 0x5e.
  1538.   #escape 11,13,ff
  1539.  
  1540.   # Don't use the modem control lines.
  1541.   #local
  1542.  
  1543.   # Specifies that pppd should use a UUCP-style lock on the serial device
  1544.   # to ensure exclusive access to the device.
  1545.   #lock
  1546.  
  1547.   # Use the modem control lines.  On Ultrix, this option implies hardware
  1548.   # flow control, as for the crtscts option.  (This option is not fully
  1549.   # implemented.)
  1550.   #modem
  1551.  
  1552.   # Set the MRU [Maximum Receive Unit] value to <n> for negotiation.  pppd
  1553.   # will ask the peer to send packets of no more than <n> bytes. The
  1554.   # minimum MRU value is 128.  The default MRU value is 1500.  A value of
  1555.   # 296 is recommended for slow links (40 bytes for TCP/IP header + 256
  1556.   # bytes of data).
  1557.   #mru 542
  1558.  
  1559.   # Set the interface netmask to <n>, a 32 bit netmask in "decimal dot"
  1560.   # notation (e.g. 255.255.255.0).
  1561.   #netmask 255.255.255.0
  1562.  
  1563.   # Disables the default behaviour when no local IP address is specified,
  1564.   # which is to determine (if possible) the local IP address from the
  1565.   # hostname. With this option, the peer will have to supply the local IP
  1566.   # address during IPCP negotiation (unless it specified explicitly on the
  1567.   # command line or in an options file).
  1568.   #noipdefault
  1569.  
  1570.   # Enables the "passive" option in the LCP.  With this option, pppd will
  1571.   # attempt to initiate a connection; if no reply is received from the
  1572.   # peer, pppd will then just wait passively for a valid LCP packet from
  1573.   # the peer (instead of exiting, as it does without this option).
  1574.   #passive
  1575.  
  1576.   # With this option, pppd will not transmit LCP packets to initiate a
  1577.   # connection until a valid LCP packet is received from the peer (as for
  1578.   # the "passive" option with old versions of pppd).
  1579.   #silent
  1580.  
  1581.   # Don't request or allow negotiation of any options for LCP and IPCP
  1582.   # (use default values).
  1583.   #-all
  1584.  
  1585.   # Disable Address/Control compression negotiation (use default, i.e.
  1586.   # address/control field disabled).
  1587.   #-ac
  1588.  
  1589.   # Disable asyncmap negotiation (use the default asyncmap, i.e. escape
  1590.   # all control characters).
  1591.   #-am
  1592.  
  1593.   # Don't fork to become a background process (otherwise pppd will do so
  1594.   # if a serial device is specified).
  1595.   #-detach
  1596.  
  1597.   # Disable IP address negotiation (with this option, the remote IP
  1598.   # address must be specified with an option on the command line or in an
  1599.   # options file).
  1600.   #-ip
  1601.  
  1602.   # Disable magic number negotiation.  With this option, pppd cannot
  1603.   # detect a looped-back line.
  1604.   #-mn
  1605.  
  1606.   # Disable MRU [Maximum Receive Unit] negotiation (use default, i.e.
  1607.   # 1500).
  1608.   #-mru
  1609.  
  1610.   # Disable protocol field compression negotiation (use default, i.e.
  1611.   # protocol field compression disabled).
  1612.   #-pc
  1613.  
  1614.   # Require the peer to authenticate itself using PAP.
  1615.   # This requires TWO WAY authentication - do NOT use this for a standard
  1616.   # PAP authenticated link to an ISP as this will require the ISP machine
  1617.   # to authenticate itself to your machine (and it will not be able to).
  1618.   #+pap
  1619.  
  1620.   # Don't agree to authenticate using PAP.
  1621.   #-pap
  1622.  
  1623.   # Require the peer to authenticate itself using CHAP [Cryptographic
  1624.   # Handshake Authentication Protocol] authentication.
  1625.   # This requires TWO WAY authentication - do NOT use this for a standard
  1626.   # CHAP authenticated link to an ISP as this will require the ISP machine
  1627.   # to authenticate itself to your machine (and it will not be able to).
  1628.   #+chap
  1629.  
  1630.   # Don't agree to authenticate using CHAP.
  1631.   #-chap
  1632.  
  1633.   # Disable negotiation of Van Jacobson style IP header compression (use
  1634.   # default, i.e. no compression).
  1635.   #-vj
  1636.  
  1637.   # Increase debugging level (same as -d).  If this option is given, pppd
  1638.   # will log the contents of all control packets sent or received in a
  1639.   # readable form.  The packets are logged through syslog with facility
  1640.   # daemon and level debug. This information can be directed to a file by
  1641.   # setting up /etc/syslog.conf appropriately (see syslog.conf(5)).  (If
  1642.   # pppd is compiled with extra debugging enabled, it will log messages
  1643.   # using facility local2 instead of daemon).
  1644.   #debug
  1645.  
  1646.   # Append the domain name <d> to the local host name for authentication
  1647.   # purposes.  For example, if gethostname() returns the name porsche,
  1648.   # but the fully qualified domain name is porsche.Quotron.COM, you would
  1649.   # use the domain option to set the domain name to Quotron.COM.
  1650.   #domain <d>
  1651.  
  1652.   # Enable debugging code in the kernel-level PPP driver.  The argument n
  1653.   # is a number which is the sum of the following values: 1 to enable
  1654.   # general debug messages, 2 to request that the contents of received
  1655.   # packets be printed, and 4 to request that the contents of transmitted
  1656.   # packets be printed.
  1657.   #kdebug n
  1658.  
  1659.   # Set the MTU [Maximum Transmit Unit] value to <n>. Unless the peer
  1660.   # requests a smaller value via MRU negotiation, pppd will request that
  1661.   # the kernel networking code send data packets of no more than n bytes
  1662.   # through the PPP network interface.
  1663.   #mtu <n>
  1664.  
  1665.   # Set the name of the local system for authentication purposes to <n>.
  1666.   # This will probably have to be set to your ISP user name if you are
  1667.   # using PAP/CHAP.
  1668.   #name <n>
  1669.  
  1670.   # Set the user name to use for authenticating this machine with the peer
  1671.   # using PAP to <u>.
  1672.   # Do NOT use this if you are using 'name' above!
  1673.   #user <u>
  1674.  
  1675.   # Enforce the use of the host name as the name of the local system for
  1676.   # authentication purposes (overrides the name option).
  1677.   #usehostname
  1678.  
  1679.   # Set the assumed name of the remote system for authentication purposes
  1680.   # to <n>.
  1681.   #remotename <n>
  1682.  
  1683.   # Add an entry to this system's ARP [Address Resolution Protocol]
  1684.   # table with the IP address of the peer and the Ethernet address of this
  1685.   # system.
  1686.   #proxyarp
  1687.  
  1688.   # Use the system password database for authenticating the peer using
  1689.   # PAP.
  1690.   #login
  1691.  
  1692.   # If this option is given, pppd will send an LCP echo-request frame to
  1693.   # the peer every n seconds. Under Linux, the echo-request is sent when
  1694.   # no packets have been received from the peer for n seconds. Normally
  1695.   # the peer should respond to the echo-request by sending an echo-reply.
  1696.   # This option can be used with the lcp-echo-failure option to detect
  1697.   # that the peer is no longer connected.
  1698.   #lcp-echo-interval <n>
  1699.  
  1700.   # If this option is given, pppd will presume the peer to be dead if n
  1701.   # LCP echo-requests are sent without receiving a valid LCP echo-reply.
  1702.   # If this happens, pppd will terminate the connection.  Use of this
  1703.   # option requires a non-zero value for the lcp-echo-interval parameter.
  1704.   # This option can be used to enable pppd to terminate after the physical
  1705.   # connection has been broken (e.g., the modem has hung up) in
  1706.   # situations where no hardware modem control lines are available.
  1707.   #lcp-echo-failure <n>
  1708.  
  1709.   # Set the LCP restart interval (retransmission timeout) to <n> seconds
  1710.   # (default 3).
  1711.   #lcp-restart <n>
  1712.  
  1713.   # Set the maximum number of LCP terminate-request transmissions to <n>
  1714.   # (default 3).
  1715.   #lcp-max-terminate <n>
  1716.  
  1717.   # Set the maximum number of LCP configure-request transmissions to <n>
  1718.   # (default 10).
  1719.   # Some PPP servers are slow to start up. You may need to increase this
  1720.   # if you keep getting 'serial line looped back' errors and your are SURE
  1721.   # that you have logged in correctly and PPP should be starting on the server.
  1722.   #lcp-max-configure <n>
  1723.  
  1724.   # Set the maximum number of LCP configure-NAKs returned before starting
  1725.   # to send configure-Rejects instead to <n> (default 10).
  1726.   #lcp-max-failure <n>
  1727.  
  1728.   # Set the IPCP restart interval (retransmission timeout) to <n>
  1729.   # seconds (default 3).
  1730.   #ipcp-restart <n>
  1731.  
  1732.   # Set the maximum number of IPCP terminate-request transmissions to <n>
  1733.   # (default 3).
  1734.   #ipcp-max-terminate <n>
  1735.  
  1736.   # Set the maximum number of IPCP configure-request transmissions to <n>
  1737.   # (default 10).
  1738.   #ipcp-max-configure <n>
  1739.  
  1740.   # Set the maximum number of IPCP configure-NAKs returned before starting
  1741.   # to send configure-Rejects instead to <n> (default 10).
  1742.   #ipcp-max-failure <n>
  1743.  
  1744.   # Set the PAP restart interval (retransmission timeout) to <n> seconds
  1745.   # (default 3).
  1746.   #pap-restart <n>
  1747.  
  1748.   # Set the maximum number of PAP authenticate-request transmissions to
  1749.   # <n> (default 10).
  1750.   #pap-max-authreq <n>
  1751.  
  1752.   # Set the CHAP restart interval (retransmission timeout for
  1753.   # challenges) to <n> seconds (default 3).
  1754.   #chap-restart <n>
  1755.   # Set the maximum number of CHAP challenge transmissions to <n>
  1756.   # (default 10).
  1757.   #chap-max-challenge
  1758.  
  1759.   # If this option is given, pppd will re-challenge the peer every <n>
  1760.   # seconds.
  1761.   #chap-interval <n>
  1762.  
  1763.   # With this option, pppd will accept the peer's idea of our local IP
  1764.   # address, even if the local IP address was specified in an option.
  1765.   #ipcp-accept-local
  1766.  
  1767.   # With this option, pppd will accept the peer's idea of its (remote) IP
  1768.   # address, even if the remote IP address was specified in an option.
  1769.   #ipcp-accept-remote
  1770.   ______________________________________________________________________
  1771.  
  1772.   12.2.  What options should I use? (No PAP/CHAP)
  1773.  
  1774.   Well, as in all things that depends (sigh). The options specified here
  1775.   should work with most servers.
  1776.  
  1777.   However, if it does NOT work, READ THE TEMPLATE FILE
  1778.   (/etc/ppp/options.tpl) and the pppd man pages and speak to the
  1779.   sysadmin/user support people who run the server to which you are
  1780.   connecting.
  1781.  
  1782.   You should also note that the connect scripts presented here also use
  1783.   some command line options to pppd to make things a bit easier to
  1784.   change.
  1785.  
  1786.   ______________________________________________________________________
  1787.   # /etc/ppp/options (NO PAP/CHAP)
  1788.   #
  1789.   # Prevent pppd from forking into the background
  1790.   -detach
  1791.   #
  1792.   # use the modem control lines
  1793.   modem
  1794.   # use uucp style locks to ensure exclusive access to the serial device
  1795.   lock
  1796.   # use hardware flow control
  1797.   crtscts
  1798.   # create a default route for this connection in the routing table
  1799.   defaultroute
  1800.   # do NOT set up any "escaped" control sequences
  1801.   asyncmap 0
  1802.   # use a maximum transmission packet size of 552 bytes
  1803.   mtu 552
  1804.   # use a maximum receive packet size of 552 bytes
  1805.   mru 552
  1806.   #
  1807.   #-------END OF SAMPLE /etc/ppp/options (no PAP/CHAP)
  1808.   ______________________________________________________________________
  1809.  
  1810.   13.  Protocol) If your PPP server uses PAP (Password Authentication
  1811.  
  1812.   If the server to which you are connecting requires PAP or CHAP
  1813.   authentication, you have a little bit more work.
  1814.  
  1815.   To the above options file, add the following lines
  1816.  
  1817.   ______________________________________________________________________
  1818.   #
  1819.   # force pppd to use your ISP user name as your 'host name' during the
  1820.   # authentication process
  1821.   name <your ISP user name>       # you need to edit this line
  1822.   #
  1823.   # If you are running a PPP *server* and need to force PAP or CHAP
  1824.   # uncomment the appropriate one of the following lines. Do NOT use
  1825.   # these is you are a client connecting to a PPP server (even if it uses PAP
  1826.   # or CHAP) as this tells the SERVER to authenticate itself to your
  1827.   # machine (which almost certainly can't do - and the link will fail).
  1828.   #+chap
  1829.   #+pap
  1830.   #
  1831.   # If you are using ENCRYPTED secrets in the /etc/ppp/pap-secrets
  1832.   # file, then uncomment the following line.
  1833.   # Note: this is NOT the same as using MS encrypted passwords as can be
  1834.   # set up in MS RAS on Windows NT.
  1835.   #+papcrypt
  1836.   ______________________________________________________________________
  1837.  
  1838.   13.1.  Using MSCHAP
  1839.  
  1840.   Microsoft Windows NT RAS can be set up to use a variation on CHAP
  1841.   (Challenge/Handshake Authentication Protocol). In your PPP sources tar
  1842.   ball, you will find a file called README.MSCHAP80 that discusses this.
  1843.  
  1844.   You can determine if the server is requesting authentication using
  1845.   this protocol by enabling debugging for pppd. If the server is
  1846.   requesting MS CHAP authentication, you will see lines like
  1847.  
  1848.   ______________________________________________________________________
  1849.   rcvd [LCP ConfReq id=0x2 <asyncmap 0x0> <auth chap 80> <magic 0x46a3>]
  1850.   ______________________________________________________________________
  1851.  
  1852.   The critical information here is auth chap 80.
  1853.  
  1854.   In order to use MS CHAP, you will need to recompile pppd to support
  1855.   this. Please see the instructions in the README.MSCHAP80 file in the
  1856.   PPP source file for instructions on how to compile and use this
  1857.   variation.
  1858.  
  1859.   You should note that at present this code supports only Linux PPP
  1860.   clients connecting to an MS Windows NT server. It does NOT support
  1861.   setting up a Linux PPP server to use MSCHAP80 authentication from
  1862.   clients.
  1863.  
  1864.   13.2.  The PAP/CHAP secrets file
  1865.  
  1866.   If you are using pap or chap authentication, then you also need to
  1867.   create the secrets file. These are:
  1868.  
  1869.   ______________________________________________________________________
  1870.   /etc/ppp/pap-secrets
  1871.   /etc/ppp/chap-secrets
  1872.   ______________________________________________________________________
  1873.  
  1874.   They must be owned by user root, group root and have file permissions
  1875.   740 for security.
  1876.  
  1877.   The first point to note about PAP and CHAP is that they are designed
  1878.   to authenticate computer systems not users.
  1879.  
  1880.   "Huh? What's the difference?" I hear you ask.
  1881.  
  1882.   Well now, once your computer has made its PPP connection to the
  1883.   server, ANY user on your system can use that connection - not just
  1884.   you.  This is why you can set up a WAN (wide area network) link that
  1885.   joins two LANs (local area networks) using PPP.
  1886.  
  1887.   PAP can (and for CHAP DOES) require bidirectional authentication -
  1888.   that is a valid name and secret is required on each computer for the
  1889.   other computer involved. However, this is NOT the way most PPP servers
  1890.   offering dial up PPP PAP-authenticated connections operate.
  1891.  
  1892.   That being said, your ISP will probably have given you a user name and
  1893.   password to allow you to connect to their system and thence the
  1894.   Internet. Your ISP is not interested in your computer's name at all,
  1895.   so you will probably need to use the user name at your ISP as the name
  1896.   for your computer.
  1897.  
  1898.   This is done using the name user name option to pppd. So, if you are
  1899.   to use the user name given you by your ISP, add the line
  1900.  
  1901.   ______________________________________________________________________
  1902.   name your_user name_at_your_ISP
  1903.   ______________________________________________________________________
  1904.  
  1905.   to your /etc/ppp/options file.
  1906.  
  1907.   Technically, you should really use user our_user name_at_your_ISP for
  1908.   PAP, but pppd is sufficiently intelligent to interpret name as user if
  1909.   it is required to use PAP. The advantage of using the name option is
  1910.   that this is also valid for CHAP.
  1911.  
  1912.   As PAP is for authenticating computers, technically you need also to
  1913.   specify a remote computer name. However, as most people only have one
  1914.   ISP, you can use a wild card (*) for the remote host name in the
  1915.   secrets file.
  1916.  
  1917.   It is also worth noting that many ISPs operate multiple modem banks
  1918.   connected to different terminal servers - each with a different name,
  1919.   but ACCESSED from a single (rotary) dial in number. It can therefore
  1920.   be quite difficult in some circumstances to know ahead of time what
  1921.   the name of the remote computer is, as this depends on which terminal
  1922.   server you connect to!
  1923.  
  1924.   13.3.  The PAP secrets file
  1925.  
  1926.   The /etc/ppp/pap-secrets file looks like
  1927.  
  1928.   ______________________________________________________________________
  1929.   # Secrets for authentication using PAP
  1930.   # client        server       secret     acceptable_local_IP_addresses
  1931.   ______________________________________________________________________
  1932.  
  1933.   The four fields are white space delimited and the last one can be
  1934.   blank (which is what you want for a dynamic and probably static IP
  1935.   allocation from your ISP).
  1936.  
  1937.   Suppose your ISP gave you a user name of fred and a password of
  1938.   flintstone you would set the name fred option in
  1939.   /etc/ppp/options[.ttySx] and set up your /etc/ppp/pap-secrets file as
  1940.   follows
  1941.  
  1942.   ______________________________________________________________________
  1943.   # Secrets for authentication using PAP
  1944.   # client        server  secret          acceptable local IP addresses
  1945.   fred            *       flintstone
  1946.   ______________________________________________________________________
  1947.  
  1948.   This says for the local machine name fred (which we have told pppd to
  1949.   use even though it is not our local machine name) and for ANY server,
  1950.   use the password (secret) of flintstone.
  1951.  
  1952.   Note that we do not need to specify a local IP address, unless we are
  1953.   required to FORCE a particular local, static IP address. Even if you
  1954.   try this, it is unlikely to work as most PPP servers (for security
  1955.   reasons) do not allow the remote system to set the IP number they are
  1956.   to be given.
  1957.  
  1958.   13.4.  The CHAP secrets file
  1959.  
  1960.   This requires that you have mutual authentication methods - that is
  1961.   you must allow for both your machine to authenticate the remote server
  1962.   AND the remote server to authenticate your machine.
  1963.  
  1964.   So, if your machine is fred and the remote is barney, your machine
  1965.   would set name fred remotename barney and the remote machine would set
  1966.   name barney remotename fred in their respective /etc/ppp/options.ttySx
  1967.   files.
  1968.  
  1969.   The /etc/chap-secrets file for fred would look like
  1970.  
  1971.   ______________________________________________________________________
  1972.   # Secrets for authentication using CHAP
  1973.   # client        server  secret            acceptable local IP addresses
  1974.   fred            barney  flintstone
  1975.   barney          fred    wilma
  1976.   ______________________________________________________________________
  1977.  
  1978.   and for barney
  1979.  
  1980.   ______________________________________________________________________
  1981.   # Secrets for authentication using CHAP
  1982.   # client        server  secret            acceptable local IP addresses
  1983.   barney          fred    flintstone
  1984.   fred            barney  wilma
  1985.   ______________________________________________________________________
  1986.  
  1987.   Note in particular that both machines must have entries for
  1988.   bidirectional authentication. This allows the local machine to
  1989.   authenticate itself to the remote AND the remote machine to
  1990.   authenticate itself to the local machine.
  1991.  
  1992.   13.5.  Handling multiple PAP-authenticated connections
  1993.  
  1994.   Some users have more than one server to which they connect that use
  1995.   PAP.  Provided that your user name is different on each machine to
  1996.   which you want to connect, this is not a problem.
  1997.  
  1998.   However, many users have the same user name on two (or more - even
  1999.   all) systems to which they connect. This then presents a problem in
  2000.   correctly selecting the appropriate line from /etc/ppp/pap-secrets.
  2001.  
  2002.   As you might expect, PPP provides a mechanism for overcoming this. PPP
  2003.   allows you to set an 'assumed name' for the remote (server) end of the
  2004.   connection using the remotename option to pppd.
  2005.  
  2006.   Let us suppose that you connect to two PPP servers using the username
  2007.   fred. You set up your /etc/ppp/pap-secrets something like
  2008.  
  2009.   ______________________________________________________________________
  2010.   fred    pppserver1      barney
  2011.   fred    pppserver2      wilma
  2012.   ______________________________________________________________________
  2013.  
  2014.   Now, to set connect to pppserver1 you would use name fred remotename
  2015.   pppserver1 in your ppp-options and for pppserver2 name fred remotename
  2016.   pppserver2.
  2017.  
  2018.   As you can select the ppp options file to use with pppd using the file
  2019.   filename option, you can set up a script to connect to each of your
  2020.   PPP servers, correctly picking the options file to use and hence
  2021.   selecting the right remotename option.
  2022.  
  2023.   14.  Setting up the PPP connection manually
  2024.  
  2025.   Now that you have created your /etc/ppp/options and /etc/resolv.conf
  2026.   files (and, if necessary, the /etc/ppp/pap|chap-secrets file), you can
  2027.   test the settings by manually establishing a PPP connection. (Once we
  2028.   have the manual connection working, we will automate the process).
  2029.  
  2030.   To do this, your communications software must be capable of quitting
  2031.   WITHOUT resetting the modem. Minicom can do this - ALT Q (or in older
  2032.   version of minicom CTRL A Q)
  2033.  
  2034.   Make sure you are logged in as root.
  2035.  
  2036.   Fire up you communications software (such as minicom), dial into the
  2037.   PPP server and log in as normal. If you need to issue a command to
  2038.   start up PPP on the server, do so. You will now see the garbage you
  2039.   saw before.
  2040.  
  2041.   If you are using pap or chap, then merely connecting to the remote
  2042.   system should start ppp on the remote and you will see the garbage
  2043.   without logging in (although this may not happen for some servers -
  2044.   try pressing Enter and see if the garbage starts up).
  2045.  
  2046.   Now quit the communications software without resetting the modem (ALT
  2047.   Q or CTL A Q in minicom) and at the Linux prompt (as root) type
  2048.  
  2049.   ______________________________________________________________________
  2050.   pppd -d -detach /dev/ttySx 38400 &
  2051.   ______________________________________________________________________
  2052.  
  2053.   The -d option turns on debugging - the ppp connection start up
  2054.   conversation will be logged to your system log - which is useful if
  2055.   you are having trouble.
  2056.  
  2057.   Your modem lights should now flash as the PPP connection is
  2058.   established.  It will take a short while for the PPP connection to be
  2059.   made.
  2060.  
  2061.   At this point you can look at the PPP interface, by issuing the
  2062.   command
  2063.  
  2064.   ______________________________________________________________________
  2065.   ifconfig
  2066.   ______________________________________________________________________
  2067.  
  2068.   In addition to any Ethernet and loop back devices you have, you should
  2069.   see something like :-
  2070.  
  2071.   ______________________________________________________________________
  2072.   ppp0     Link encap:Point-Point Protocol
  2073.            inet addr:10.144.153.104  P-t-P:10.144.153.51 Mask:255.255.255.0
  2074.            UP POINTOPOINT RUNNING  MTU:552  Metric:1
  2075.            RX packets:0 errors:0 dropped:0 overruns:0
  2076.            TX packets:0 errors:0 dropped:0 overruns:0
  2077.   ______________________________________________________________________
  2078.  
  2079.   Where
  2080.  
  2081.   ╖  inet addr:10.144.153.10 is the IP number of your end of the link.
  2082.  
  2083.   ╖  P-t-P:10.144.153.5 is the SERVER's IP number.
  2084.  
  2085.   (Naturally, ifconfig will not report these IP numbers, but the ones
  2086.   used by your PPP server.)
  2087.  
  2088.   Note: ifconfig also tells you that the link is UP and RUNNING!
  2089.  
  2090.   If you get no ppp device listed or something like
  2091.  
  2092.   ______________________________________________________________________
  2093.   ppp0     Link encap:Point-Point Protocol
  2094.            inet addr:0.0.0.0  P-t-P:0.0.0.0  Mask:0.0.0.0
  2095.            POINTOPOINT  MTU:1500  Metric:1
  2096.            RX packets:0 errors:0 dropped:0 overruns:0
  2097.            TX packets:0 errors:0 dropped:0 overruns:0
  2098.   ______________________________________________________________________
  2099.  
  2100.   Your PPP connection has not been made...see the later section on
  2101.   debugging!
  2102.  
  2103.   You should also be able to see a route to the the remote host (and
  2104.   beyond). To do this, issue the command
  2105.  
  2106.   ______________________________________________________________________
  2107.   route -n
  2108.   ______________________________________________________________________
  2109.  
  2110.   You should se something like:-
  2111.  
  2112.   ______________________________________________________________________
  2113.   Kernel routing table
  2114.   Destination     Gateway         Genmask         Flags MSS    Window Use Iface
  2115.   10.144.153.3    *               255.255.255.255 UH    1500   0        1 ppp0
  2116.   127.0.0.0       *               255.0.0.0       U     3584   0       11 lo
  2117.   10.0.0.0        *               255.0.0.0       U     1500   0       35 eth0
  2118.   default         10.144.153.3    *               UG    1500   0        5 ppp0
  2119.   ______________________________________________________________________
  2120.  
  2121.   Of particular importance here, notice we have TWO entries pointing to
  2122.   our ppp interface.
  2123.  
  2124.   The first is a HOST route (indicated by the H flag) and that allows us
  2125.   to see the host to which we are connected to - but no further.
  2126.  
  2127.   The second is the default route (established by giving pppd the option
  2128.   defaultroute. This is the route that tells our Linux PC to send any
  2129.   packets NOT destined for the local Ethernet(s) - to which we have
  2130.   specific network routes - to the PPP server itself. The PPP server
  2131.   then is responsible for routing our packets out onto the Internet and
  2132.   routing the return packets back to us.
  2133.  
  2134.   If you do not see a routing table with two entries, something is
  2135.   wrong.  In particular if your syslog shows a message telling you pppd
  2136.   is not replacing an existing default route, then you have a default
  2137.   route pointing at your Ethernet interface - which MUST be replaced by
  2138.   a specific network route: YOU CAN ONLY HAVE ONE DEFAULT ROUTE!!!
  2139.  
  2140.   You will need to explore your system initialisation files to find out
  2141.   where this default route is being set up (it will use a route add
  2142.   default... command). Change this command to something like route add
  2143.   net....
  2144.  
  2145.   Now test the link by 'pinging' the server at its IP number as reported
  2146.   by the ifconfig output, i.e.
  2147.  
  2148.   ______________________________________________________________________
  2149.   ping 10.144.153.51
  2150.   ______________________________________________________________________
  2151.  
  2152.   You should receive output like
  2153.  
  2154.   ______________________________________________________________________
  2155.   PING 10.144.153.51 (10.144.153.51): 56 data bytes
  2156.   64 bytes from 10.144.153.51: icmp_seq=0 ttl=255 time=328.3 ms
  2157.   64 bytes from 10.144.153.51: icmp_seq=1 ttl=255 time=190.5 ms
  2158.   64 bytes from 10.144.153.51: icmp_seq=2 ttl=255 time=187.5 ms
  2159.   64 bytes from 10.144.153.51: icmp_seq=3 ttl=255 time=170.7 ms
  2160.   ______________________________________________________________________
  2161.  
  2162.   This listing will go on for ever - to stop it press CTRL C, at which
  2163.   point you will receive some more information :-
  2164.  
  2165.   ______________________________________________________________________
  2166.   --- 10.144.153.51 ping statistics ---
  2167.   4 packets transmitted, 4 packets received, 0% packet loss
  2168.   round-trip min/avg/max = 170.7/219.2/328.3 ms
  2169.   ______________________________________________________________________
  2170.  
  2171.   So far so good.
  2172.  
  2173.   Now try pinging a host by name (not the name of the PPP server itself)
  2174.   but a host at another site that you KNOW is probably going to be up
  2175.   and running...). For example
  2176.  
  2177.   ______________________________________________________________________
  2178.   ping sunsite.unc.edu
  2179.   ______________________________________________________________________
  2180.  
  2181.   This time there will be a bit of a pause as Linux obtains the IP
  2182.   number for the fully qualified host name you have 'ping'ed from the
  2183.   DNS you specified in /etc/resolv.conf - so don't worry (but you will
  2184.   see your modem lights flash). Shortly you will receive output like
  2185.  
  2186.   ______________________________________________________________________
  2187.    PING sunsite.unc.edu (152.2.254.81): 56 data bytes
  2188.   64 bytes from 152.2.254.81: icmp_seq=0 ttl=254 time=190.1 ms
  2189.   64 bytes from 152.2.254.81: icmp_seq=1 ttl=254 time=180.6 ms
  2190.   64 bytes from 152.2.254.81: icmp_seq=2 ttl=254 time=169.8 ms
  2191.   64 bytes from 152.2.254.81: icmp_seq=3 ttl=254 time=170.6 ms
  2192.   64 bytes from 152.2.254.81: icmp_seq=4 ttl=254 time=170.6 ms
  2193.   ______________________________________________________________________
  2194.  
  2195.   Again, stop the output by pressing CTRL C and get the statistics...
  2196.  
  2197.   ______________________________________________________________________
  2198.   --- sunsite.unc.edu ping statistics ---
  2199.   5 packets transmitted, 5 packets received, 0% packet loss
  2200.   round-trip min/avg/max = 169.8/176.3/190.1 ms
  2201.   ______________________________________________________________________
  2202.  
  2203.   If you don't get any response, try pinging the IP address of the DNS
  2204.   server at your ISP's site. If you get a result from this, then it
  2205.   looks like you have a problem with /etc/resolv.conf.
  2206.  
  2207.   If this doesn't work, you have a routing problem, or your ISP has a
  2208.   problem routing packets back to you. Check your routing table as shown
  2209.   above and if that is OK, contact your ISP. A good test of the ISP is
  2210.   to use another operating system to connect. If you can get beyond your
  2211.   ISP with that, then the problem is at your end.
  2212.  
  2213.   If everything works, shut down the connection by typing
  2214.  
  2215.   ______________________________________________________________________
  2216.   ppp-off
  2217.   ______________________________________________________________________
  2218.  
  2219.   After a short pause, the modem should hang itself up.
  2220.  
  2221.   If that does not work, either turn off your modem or fire up your
  2222.   communications software and interrupt the modem with +++ and then hang
  2223.   up with ATH0 when you receive the modem's OK prompt.
  2224.  
  2225.   You may also need to clean up the lock file created by pppd
  2226.  
  2227.   ______________________________________________________________________
  2228.   rm -f /var/lock/LCK..ttySx
  2229.   ______________________________________________________________________
  2230.  
  2231.   15.  Automating your connections - Creating the connection scripts
  2232.  
  2233.   Whilst you can continue to log in by hand as shown above, it is much
  2234.   neater to set up some scripts to do this automatically for you.
  2235.  
  2236.   A set of scripts automates the log in and PPP start up so all you have
  2237.   to do (as root or as a member of the PPP group) is issue a single
  2238.   command to fire up your connection.
  2239.  
  2240.   15.1.  Connection scripts for User name/Password Authentication
  2241.  
  2242.   If your ISP does NOT require the use of PAP/CHAP, these are the
  2243.   scripts for you!
  2244.  
  2245.   If the ppp package installed correctly, you should have two example
  2246.   files.  For PPP 2.1.2 they are in /usr/sbin and for PPP 2.2 they are
  2247.   in /etc/ppp/scripts. They are called
  2248.  
  2249.   for PPP-2.1.2
  2250.  
  2251.        ppp-on
  2252.        ppp-off
  2253.  
  2254.   and for PPP-2.2
  2255.  
  2256.        ppp-off
  2257.        ppp-on
  2258.        ppp-on-dialer
  2259.  
  2260.   Now, if you are using PPP 2.1.2, I strongly urge you to delete the
  2261.   sample files. There are potential problems with these - and don't tell
  2262.   me they work fine - I used them for ages too (and recommended them in
  2263.   the first version of this HOWTO)!
  2264.  
  2265.   For the benefit of PPP 2.1.2 users, here are BETTER template versions,
  2266.   taken from the PPP 2.2 distribution. I suggest you copy and use these
  2267.   scripts instead of the old PPP-2.1.2 scripts.
  2268.  
  2269.   15.2.  The ppp-on script
  2270.  
  2271.   This is the first of a PAIR of scripts that actually fire up the
  2272.   connection.
  2273.  
  2274.   ______________________________________________________________________
  2275.   #!/bin/sh
  2276.   #
  2277.   # Script to initiate a PPP connection. This is the first part of the
  2278.   # pair of scripts. This is not a secure pair of scripts as the codes
  2279.   # are visible with the 'ps' command.  However, it is simple.
  2280.   #
  2281.   # These are the parameters. Change as needed.
  2282.   TELEPHONE=555-1212      # The telephone number for the connection
  2283.   ACCOUNT=george          # The account name for logon (as in 'George Burns')
  2284.   PASSWORD=gracie         # The password for this account (and 'Gracie Allen')
  2285.   LOCAL_IP=0.0.0.0        # Local IP address if known. Dynamic = 0.0.0.0
  2286.   REMOTE_IP=0.0.0.0       # Remote IP address if desired. Normally 0.0.0.0
  2287.   NETMASK=255.255.255.0   # The proper netmask if needed
  2288.   #
  2289.   # Export them so that they will be available to 'ppp-on-dialer'
  2290.   export TELEPHONE ACCOUNT PASSWORD
  2291.   #
  2292.   # This is the location of the script which dials the phone and logs
  2293.   # in.  Please use the absolute file name as the $PATH variable is not
  2294.   # used on the connect option.  (To do so on a 'root' account would be
  2295.   # a security hole so don't ask.)
  2296.   #
  2297.   DIALER_SCRIPT=/etc/ppp/ppp-on-dialer
  2298.   #
  2299.   # Initiate the connection
  2300.   #
  2301.   #
  2302.   exec /usr/sbin/pppd debug /dev/ttySx 38400 \
  2303.           $LOCAL_IP:$REMOTE_IP \
  2304.           connect $DIALER_SCRIPT
  2305.   ______________________________________________________________________
  2306.  
  2307.   Here is the ppp-on-dialer script:-
  2308.  
  2309.   ______________________________________________________________________
  2310.   #!/bin/sh
  2311.   #
  2312.   # This is part 2 of the ppp-on script. It will perform the connection
  2313.   # protocol for the desired connection.
  2314.   #
  2315.   /usr/sbin/chat -v                                                 \
  2316.           TIMEOUT         3                               \
  2317.           ABORT           '\nBUSY\r'                      \
  2318.           ABORT           '\nNO ANSWER\r'                 \
  2319.           ABORT           '\nRINGING\r\n\r\nRINGING\r'    \
  2320.           ''              \rAT                            \
  2321.           'OK-+++\c-OK'   ATH0                            \
  2322.           TIMEOUT         30                              \
  2323.           OK              ATDT$TELEPHONE                  \
  2324.           CONNECT         ''                              \
  2325.           ogin:--ogin:    $ACCOUNT                        \
  2326.           assword:        $PASSWORD
  2327.   ______________________________________________________________________
  2328.  
  2329.   For PPP-2.2, the ppp-off script looks like:-
  2330.  
  2331.   ______________________________________________________________________
  2332.   #!/bin/sh
  2333.   ######################################################################
  2334.   #
  2335.   # Determine the device to be terminated.
  2336.   #
  2337.   if [ "$1" = "" ]; then
  2338.           DEVICE=ppp0
  2339.   else
  2340.           DEVICE=$1
  2341.   fi
  2342.  
  2343.   ######################################################################
  2344.   #
  2345.   # If the ppp0 pid file is present then the program is running. Stop it.
  2346.   if [ -r /var/run/$DEVICE.pid ]; then
  2347.           kill -INT `cat /var/run/$DEVICE.pid`
  2348.   #
  2349.   # If the kill did not work then there is no process running for this
  2350.   # pid. It may also mean that the lock file will be left. You may wish
  2351.   # to delete the lock file at the same time.
  2352.           if [ ! "$?" = "0" ]; then
  2353.                   rm -f /var/run/$DEVICE.pid
  2354.                   echo "ERROR: Removed stale pid file"
  2355.                   exit 1
  2356.           fi
  2357.   #
  2358.   # Success. Let pppd clean up its own junk.
  2359.           echo "PPP link to $DEVICE terminated."
  2360.           exit 0
  2361.   fi
  2362.   #
  2363.   # The ppp process is not running for ppp0
  2364.   echo "ERROR: PPP link is not active on $DEVICE"
  2365.   exit 1
  2366.   ______________________________________________________________________
  2367.  
  2368.   15.3.  Editing the supplied PPP startup scripts
  2369.  
  2370.   As the new scripts come in two parts, we will edit them in turn.
  2371.  
  2372.   15.3.1.  The ppp-on script
  2373.  
  2374.   You will need to edit the script to reflect YOUR user name at your
  2375.   ISP, YOUR password at your ISP, the telephone number of your ISP.
  2376.  
  2377.   Each of the lines like TELEPHONE= actually set up shell variables that
  2378.   contain the information to the right of the '=' (excluding the
  2379.   comments of course). So edit each of these lines so it is correct for
  2380.   your ISP and connection.
  2381.  
  2382.   Also, as you are setting the IP number (if you need to) in the
  2383.   /etc/ppp/options file, DELETE the line that says
  2384.  
  2385.   ______________________________________________________________________
  2386.   $LOCAL_IP:$REMOTE_IP \
  2387.   ______________________________________________________________________
  2388.  
  2389.   Also, make sure that the shell variable DIALER_SCRIPT points at the
  2390.   full path and name of the dialer script that you are actually going to
  2391.   use. So, if you have moved this or renamed the script, make sure you
  2392.   edit this line correctly in the ppp-on script!
  2393.  
  2394.   15.3.2.  The ppp-on-dialer script
  2395.  
  2396.   This is the second of the scripts that actually brings up our ppp
  2397.   link.
  2398.  
  2399.   Note: a chat script is normally all on one line. the backslashes are
  2400.   used to allow line continuations across several physical lines (for
  2401.   human readability) and do not form part of the script itself.
  2402.  
  2403.   However, it is very useful to look at it in detail so that we
  2404.   understand what it is actually (supposed) to be doing!
  2405.  
  2406.   15.4.  What a Chat script means...
  2407.  
  2408.   A chat script is a sequence of "expect string" "send string" pairs. In
  2409.   particular, note that we ALWAYS expect something before we send
  2410.   something.
  2411.  
  2412.   If we are to send something WITHOUT receiving anything first, we must
  2413.   use an empty expect string (indicated by "") and similarly for
  2414.   expecting something without sending anything! Also, if a string
  2415.   consists of several words, (e.g. NO CARRIER), you must quote the
  2416.   string so that it is seen as a single entity by chat.
  2417.  
  2418.   The chat line in our template is:-
  2419.  
  2420.   ______________________________________________________________________
  2421.   exec /usr/sbin/chat -v
  2422.   ______________________________________________________________________
  2423.  
  2424.   Invoke chat, the -v tells chat to copy ALL its I/O into the system log
  2425.   (usually /var/log/messages). Once you are happy that the chat script
  2426.   is working reliably, edit this line to remove the -v to save
  2427.   unnecessary clutter in your syslog.
  2428.  
  2429.   ______________________________________________________________________
  2430.   TIMEOUT         3
  2431.   ______________________________________________________________________
  2432.  
  2433.   This sets the timeout for the receipt of expected input to three sec¡
  2434.   onds. You may need to increase this to say 5 or 10 seconds if you are
  2435.   using a really slow modem!
  2436.  
  2437.   ______________________________________________________________________
  2438.   ABORT           '\nBUSY\r'
  2439.   ______________________________________________________________________
  2440.  
  2441.   If the string BUSY is received, abort the operation.
  2442.  
  2443.   ______________________________________________________________________
  2444.   ABORT           '\nNO ANSWER\r'
  2445.   ______________________________________________________________________
  2446.  
  2447.   If the string NO ANSWER is received, abort the operation
  2448.  
  2449.   ______________________________________________________________________
  2450.   ABORT           '\nRINGING\r\n\r\nRINGING\r'
  2451.   ______________________________________________________________________
  2452.  
  2453.   If the (repeated) string RINGING is received, abort the operation.
  2454.   This is because someone is ringing your phone line!
  2455.  
  2456.   ______________________________________________________________________
  2457.   "              \rAT
  2458.   ______________________________________________________________________
  2459.  
  2460.   Expect nothing from the modem and send the string AT.
  2461.  
  2462.   ______________________________________________________________________
  2463.   OK-+++\c-OK   ATH0
  2464.   ______________________________________________________________________
  2465.  
  2466.   This one is a bit more complicated as it uses some of chat's error
  2467.   recovery capabilities.
  2468.  
  2469.   What is says is...Expect OK, if it is NOT received (because the modem
  2470.   is not in command mode) then send +++ (the standard Hayes-compatible
  2471.   modem string that returns the modem to command mode) and expect OK.
  2472.   Then send ATH0 (the modem hang up string). This allows your script to
  2473.   cope with the situation of your modem being stuck on-line!
  2474.  
  2475.   ______________________________________________________________________
  2476.   TIMEOUT         30
  2477.   ______________________________________________________________________
  2478.  
  2479.   Set the timeout to 30 seconds for the remainder of the script. If you
  2480.   experience trouble with the chat script aborting due to timeouts,
  2481.   increase this to 45 seconds or more.
  2482.  
  2483.   ______________________________________________________________________
  2484.   OK              ATDT$TELEPHONE
  2485.   ______________________________________________________________________
  2486.  
  2487.   Expect OK (the modem's response to the ATH0 command) and dial the
  2488.   number we want to call.
  2489.  
  2490.   ______________________________________________________________________
  2491.   CONNECT         ''
  2492.   ______________________________________________________________________
  2493.  
  2494.   Expect CONNECT (which our modem sends when the remote modem answers)
  2495.   and send nothing in reply.
  2496.  
  2497.   ______________________________________________________________________
  2498.   ogin:--ogin:    $ACCOUNT
  2499.   ______________________________________________________________________
  2500.  
  2501.   Again, we have some error recovery built in here. Expect the login
  2502.   prompt (...ogin:) but if we don't receive it by the timeout, send a
  2503.   return and then look for the login prompt again. When the prompt is
  2504.   received, send the username (stored in the shell variable $ACCOUNT).
  2505.  
  2506.   ______________________________________________________________________
  2507.   assword:        $PASSWORD
  2508.   ______________________________________________________________________
  2509.  
  2510.   Expect the password prompt and send our password (again, stored in a
  2511.   shell variable).
  2512.  
  2513.   This chat script has reasonable error recovery capability. Chat has
  2514.   considerably more features than demonstrated here. For more
  2515.   information consult the chat manual page (man 8 chat).
  2516.  
  2517.   15.4.1.  Starting PPP at the server end
  2518.  
  2519.   Whilst the ppp-on-dialer script is fine for servers that automatically
  2520.   start pppd at the server end once you have logged in, some servers
  2521.   require that you explicitly start PPP on the server.
  2522.  
  2523.   If you need to issue a command to start up PPP on the server, you DO
  2524.   need to edit the ppp-on-dialer script.
  2525.  
  2526.   At the END of the script (after the password line) add an additional
  2527.   expect send pair - this one would look for your login prompt (beware
  2528.   of characters that have a special meaning in the Bourne shell - such
  2529.   as $ and  or  (open and close square brackets).
  2530.  
  2531.   Once chat has found the shell prompt, chat must issue the ppp start up
  2532.   command required for your ISPs PPP server.
  2533.  
  2534.   In my case, my PPP server uses the standard Linux Bash prompt
  2535.  
  2536.   ______________________________________________________________________
  2537.   [hartr@kepler hartr]$
  2538.   ______________________________________________________________________
  2539.  
  2540.   and requires that I type
  2541.  
  2542.   ______________________________________________________________________
  2543.   ppp
  2544.   ______________________________________________________________________
  2545.  
  2546.   to start up PPP on the server.
  2547.  
  2548.   It is a good idea to allow for a bit of error recovery here, so in my
  2549.   case I use
  2550.  
  2551.   ______________________________________________________________________
  2552.           hartr--hartr    ppp
  2553.   ______________________________________________________________________
  2554.  
  2555.   This says,  if we don't receive the prompt within the timeout, send a
  2556.   carriage return and looks for the prompt again.
  2557.  
  2558.   Once the prompt is received, then send the string ppp.
  2559.  
  2560.   Note: don't forget to add a \ to the end of the previous line so chat
  2561.   still thinks the entire chat script is on one line!
  2562.  
  2563.   Unfortunately, some servers produce a very variable set of prompts!
  2564.   You may need to log in several times using minicom to understand what
  2565.   is going on and pick the stable "expect" strings.
  2566.  
  2567.   15.5.  A chat script for PAP/CHAP authenticated connections
  2568.  
  2569.   If your ISP is using PAP/CHAP, then your chat script is much simpler.
  2570.   All your chat script needs to do is dial the telephone, wait for a
  2571.   connect and then let pppd handle the logging in!
  2572.  
  2573.   ______________________________________________________________________
  2574.   #!/bin/sh
  2575.   #
  2576.   # This is part 2 of the ppp-on script. It will perform the connection
  2577.   # protocol for the desired connection.
  2578.   #
  2579.   exec /usr/sbin/chat -v                                  \
  2580.           TIMEOUT         3                               \
  2581.           ABORT           '\nBUSY\r'                      \
  2582.           ABORT           '\nNO ANSWER\r'                 \
  2583.           ABORT           '\nRINGING\r\n\r\nRINGING\r'    \
  2584.           ''              \rAT                            \
  2585.           'OK-+++\c-OK'   ATH0                            \
  2586.           TIMEOUT         30                              \
  2587.           OK              ATDT$TELEPHONE                  \
  2588.           CONNECT         ''                              \
  2589.   ______________________________________________________________________
  2590.  
  2591.   15.6.  The pppd debug and file option_file options
  2592.  
  2593.   As we have already seen, you can turn on debug information logging
  2594.   with the -d option to pppd. The 'debug' option is equivalent to this.
  2595.  
  2596.   As we are establishing a new connection with a new script, leave in
  2597.   the debug option for now. (Warning: if your disk space is tight,
  2598.   logging pppd exchanges can rapidly extend your syslog file and run you
  2599.   into trouble - but to do this you must fail to connect and keep on
  2600.   trying for quite a few minutes).
  2601.  
  2602.   Once you are happy that all is working properly, then you can remove
  2603.   this option.
  2604.  
  2605.   If you have called your ppp options file anything other than
  2606.   /etc/ppp/options or /etc/ppp/options.ttySx, specify the file name with
  2607.   the file option to pppd - e.g.
  2608.  
  2609.   ______________________________________________________________________
  2610.   exec /usr/sbin/pppd debug file options.myserver /dev/ttyS0 38400 \
  2611.   ______________________________________________________________________
  2612.  
  2613.   16.  Testing your connection script
  2614.  
  2615.   Open a new root Xterm (if you are in X) or open a new virtual console
  2616.   and log in as root.
  2617.  
  2618.   In this new session, issue the command
  2619.  
  2620.        tail -f /var/log/messages
  2621.  
  2622.   (or whatever your system log file is).
  2623.  
  2624.   In the first window (or virtual console) issue the command
  2625.  
  2626.        ppp-on &
  2627.  
  2628.   (or whatever name you have called your edited version of
  2629.   /usr/sbin/ppp- on). If you do not put the script into the background
  2630.   by specifying & at the end of the command, you will not get your
  2631.   terminal prompt back until ppp exits (when the link terminates).
  2632.  
  2633.   Now switch back to the window that is tracking your system log.
  2634.  
  2635.   You will see something like the following (provided you specified -v
  2636.   to chat and -d to pppd)....this is the chat script and responses being
  2637.   logged to the system log file followed by the start up information for
  2638.   pppd :-
  2639.  
  2640.   ______________________________________________________________________
  2641.   Oct 21 16:09:58 hwin chat[19868]: abort on (NO CARRIER)
  2642.   Oct 21 16:09:59 hwin chat[19868]: abort on (BUSY)
  2643.   Oct 21 16:09:59 hwin chat[19868]: send (ATZ^M)
  2644.   Oct 21 16:09:59 hwin chat[19868]: expect (OK)
  2645.   Oct 21 16:10:00 hwin chat[19868]: ATZ^M^M
  2646.   Oct 21 16:10:00 hwin chat[19868]: OK -- got it
  2647.   Oct 21 16:10:00 hwin chat[19868]: send (ATDT722298^M)
  2648.   Oct 21 16:10:00 hwin chat[19868]: expect (CONNECT)
  2649.   Oct 21 16:10:00 hwin chat[19868]: ^M
  2650.   Oct 21 16:10:22 hwin chat[19868]: ATDT722298^M^M
  2651.   Oct 21 16:10:22 hwin chat[19868]: CONNECT -- got it
  2652.   Oct 21 16:10:22 hwin chat[19868]: send (^M)
  2653.   Oct 21 16:10:22 hwin chat[19868]: expect (ogin:)
  2654.   Oct 21 16:10:23 hwin chat[19868]: kepler login: -- got it
  2655.   Oct 21 16:10:23 hwin chat[19868]: send (hartr^M)
  2656.   Oct 21 16:10:23 hwin chat[19868]: expect (ssword:)
  2657.   Oct 21 16:10:23 hwin chat[19868]:  hartr^M
  2658.   Oct 21 16:10:23 hwin chat[19868]: Password: -- got it
  2659.   Oct 21 16:10:23 hwin chat[19868]: send (??????^M)
  2660.   Oct 21 16:10:23 hwin chat[19868]: expect (hartr)
  2661.   Oct 21 16:10:24 hwin chat[19868]: [hartr -- got it
  2662.   Oct 21 16:10:24 hwin chat[19868]: send (ppp^M)
  2663.   Oct 21 16:10:27 hwin pppd[19872]: pppd 2.1.2 started by root, uid 0
  2664.   Oct 21 16:10:27 hwin pppd[19873]: Using interface ppp0
  2665.   Oct 21 16:10:27 hwin pppd[19873]: Connect: ppp0 <--> /dev/cua1
  2666.   Oct 21 16:10:27 hwin pppd[19873]: fsm_sdata(LCP): Sent code 1, id 1.
  2667.   Oct 21 16:10:27 hwin pppd[19873]: LCP: sending Configure-Request, id 1
  2668.   Oct 21 16:10:27 hwin pppd[19873]: fsm_rconfreq(LCP): Rcvd id 1.
  2669.   Oct 21 16:10:27 hwin pppd[19873]: lcp_reqci: rcvd MRU
  2670.   Oct 21 16:10:27 hwin pppd[19873]: (1500)
  2671.   Oct 21 16:10:27 hwin pppd[19873]:  (ACK)
  2672.   Oct 21 16:10:27 hwin pppd[19873]: lcp_reqci: rcvd ASYNCMAP
  2673.   Oct 21 16:10:27 hwin pppd[19873]: (0)
  2674.   Oct 21 16:10:27 hwin pppd[19873]:  (ACK)
  2675.   Oct 21 16:10:27 hwin pppd[19873]: lcp_reqci: rcvd MAGICNUMBER
  2676.   Oct 21 16:10:27 hwin pppd[19873]: (a098b898)
  2677.   Oct 21 16:10:27 hwin pppd[19873]:  (ACK)
  2678.   Oct 21 16:10:27 hwin pppd[19873]: lcp_reqci: rcvd PCOMPRESSION
  2679.   Oct 21 16:10:27 hwin pppd[19873]:  (ACK)
  2680.   Oct 21 16:10:27 hwin pppd[19873]: lcp_reqci: rcvd ACCOMPRESSION
  2681.   Oct 21 16:10:27 hwin pppd[19873]:  (ACK)
  2682.   Oct 21 16:10:27 hwin pppd[19873]: lcp_reqci: returning CONFACK.
  2683.   Oct 21 16:10:27 hwin pppd[19873]: fsm_sdata(LCP): Sent code 2, id 1.
  2684.   Oct 21 16:10:27 hwin pppd[19873]: fsm_rconfack(LCP): Rcvd id 1.
  2685.   Oct 21 16:10:27 hwin pppd[19873]: fsm_sdata(IPCP): Sent code 1, id 1.
  2686.   Oct 21 16:10:27 hwin pppd[19873]: IPCP: sending Configure-Request, id 1
  2687.   Oct 21 16:10:27 hwin pppd[19873]: fsm_rconfreq(IPCP): Rcvd id 1.
  2688.   Oct 21 16:10:27 hwin pppd[19873]: ipcp: received ADDR
  2689.   Oct 21 16:10:27 hwin pppd[19873]: (10.144.153.51)
  2690.   Oct 21 16:10:27 hwin pppd[19873]:  (ACK)
  2691.   Oct 21 16:10:27 hwin pppd[19873]: ipcp: received COMPRESSTYPE
  2692.   Oct 21 16:10:27 hwin pppd[19873]: (45)
  2693.   Oct 21 16:10:27 hwin pppd[19873]:  (ACK)
  2694.   Oct 21 16:10:27 hwin pppd[19873]: ipcp: returning Configure-ACK
  2695.   Oct 21 16:10:28 hwin pppd[19873]: fsm_sdata(IPCP): Sent code 2, id 1.
  2696.   Oct 21 16:10:30 hwin pppd[19873]: fsm_sdata(IPCP): Sent code 1, id 1.
  2697.   Oct 21 16:10:30 hwin pppd[19873]: IPCP: sending Configure-Request, id 1
  2698.   Oct 21 16:10:30 hwin pppd[19873]: fsm_rconfreq(IPCP): Rcvd id 255.
  2699.   Oct 21 16:10:31 hwin pppd[19873]: ipcp: received ADDR
  2700.   Oct 21 16:10:31 hwin pppd[19873]: (10.144.153.51)
  2701.   Oct 21 16:10:31 hwin pppd[19873]:  (ACK)
  2702.   Oct 21 16:10:31 hwin pppd[19873]: ipcp: received COMPRESSTYPE
  2703.   Oct 21 16:10:31 hwin pppd[19873]: (45)
  2704.   Oct 21 16:10:31 hwin pppd[19873]:  (ACK)
  2705.   Oct 21 16:10:31 hwin pppd[19873]: ipcp: returning Configure-ACK
  2706.   Oct 21 16:10:31 hwin pppd[19873]: fsm_sdata(IPCP): Sent code 2, id 255.
  2707.   Oct 21 16:10:31 hwin pppd[19873]: fsm_rconfack(IPCP): Rcvd id 1.
  2708.   Oct 21 16:10:31 hwin pppd[19873]: ipcp: up
  2709.   Oct 21 16:10:31 hwin pppd[19873]: local  IP address 10.144.153.104
  2710.   Oct 21 16:10:31 hwin pppd[19873]: remote IP address 10.144.153.51
  2711.   ______________________________________________________________________
  2712.  
  2713.   (Note - I am using STATIC IP numbers - hence my machine sent that to
  2714.   the PPP server - you won't see this if you are using DYNAMIC IP
  2715.   numbers.)  Also, this server requires a specific command to start ppp
  2716.   at its end.
  2717.  
  2718.   This looks OK - so test it out as before with pings to IP numbers and
  2719.   host names.
  2720.  
  2721.   Fire up you web browser or whatever and go surfing - you are
  2722.   connected!
  2723.  
  2724.   17.  Shutting down the PPP link
  2725.  
  2726.   When you have finished with the PPP link, use the standard ppp-off
  2727.   command to shut it down (remember - you need to be root or a member of
  2728.   the PPP group!).
  2729.  
  2730.   In your system log you will see something like:-
  2731.  
  2732.   ______________________________________________________________________
  2733.   Oct 21 16:10:45 hwin pppd[19873]: Interrupt received: terminating link
  2734.   Oct 21 16:10:45 hwin pppd[19873]: ipcp: down
  2735.   Oct 21 16:10:45 hwin pppd[19873]: default route ioctl(SIOCDELRT): Bad address
  2736.   Oct 21 16:10:45 hwin pppd[19873]: fsm_sdata(LCP): Sent code 5, id 2.
  2737.   Oct 21 16:10:46 hwin pppd[19873]: fsm_rtermack(LCP).
  2738.   Oct 21 16:10:46 hwin pppd[19873]: Connection terminated.
  2739.   Oct 21 16:10:46 hwin pppd[19873]: Exit.
  2740.   ______________________________________________________________________
  2741.  
  2742.   Don't worry about the SIOCDELRT - this is just pppd noting that it is
  2743.   terminating and is nothing to worry about.
  2744.  
  2745.   18.  Debugging
  2746.  
  2747.   There are any number of reasons that your connection does not work -
  2748.   chat has failed to complete correctly, you have a dirty line, etc. So
  2749.   check your syslog for indications.
  2750.  
  2751.   18.1.  I have compiled PPP support into the kernel, but...
  2752.  
  2753.   A very common problem is that people compile PPP support into the
  2754.   kernel and yet when they try to run pppd, the kernel complains that it
  2755.   does not support ppp! There are a variety of reasons this can occur.
  2756.  
  2757.   18.1.1.  Whilst you have recompiled your kernel to support ppp, you
  2758.   are not booting the new kernel. This can happen if you do not update
  2759.   /etc/lilo.conf and rerun lilo.  Are you booting the right kernel?
  2760.  
  2761.   A good check on the kernel can be obtained by issuing the command
  2762.   uname -a, which should produce a line like
  2763.  
  2764.   ______________________________________________________________________
  2765.   Linux archenland 2.0.28 #2 Thu Feb 13 12:31:37 EST 1997 i586
  2766.   ______________________________________________________________________
  2767.  
  2768.   This gives the kernel version and the date on which this kernel was
  2769.   compiled - which should give you a pretty good idea of what is going
  2770.   on.
  2771.  
  2772.   18.1.2.  Did you compile ppp kernel support as a module?
  2773.  
  2774.   If you compiled your kernel ppp support as a module, but did not make
  2775.   and install the modules, then you can get this error. Check the
  2776.   kernel-HOWTO and the README file in /usr/src/linux!
  2777.  
  2778.   Another module connected possibility is that you are expecting
  2779.   required modules to be automatically loaded, but are not running the
  2780.   kerneld daemon (which auto-loads and unloads modules on the fly).
  2781.   Check the kerneld mini-HOWTO for information on setting up kerneld.
  2782.  
  2783.   18.1.3.  Are you using the correct version of PPP for your kernel?
  2784.  
  2785.   You must use ppp-2.2 with kernel version 2.0.x. You can use ppp-2.2
  2786.   with kernel version 1.2.x (if you patch the kernel) otherwise you must
  2787.   use ppp-2.1.2.
  2788.  
  2789.   18.1.4.  Are you running pppd as root?
  2790.  
  2791.   If you are not running pppd as the root user (and pppd is not suid to
  2792.   root), you can receive this message.
  2793.  
  2794.   18.2.  My modem connects but ppp never starts up
  2795.  
  2796.   There are innumerable variations on this (take a look in
  2797.   comp.os.linux...).
  2798.  
  2799.   A VERY common mistake is that you have mistyped something in your
  2800.   scripts. The only thing to do here is to make sure you are logging the
  2801.   chat conversation between you Linux PC and the server into your syslog
  2802.   (/var/log/messages) and then go through this line by line to make.
  2803.   You may need to dial into the ppp server manually to check things out
  2804.   again.
  2805.  
  2806.   You need to check the log against the actual prompts very carefully -
  2807.   and bear in mind that we humans have a tendency to read what we THINK
  2808.   we have typed - not what is actually there!
  2809.  
  2810.   18.3.  The syslog says "serial line is not 8 bit clean..."
  2811.  
  2812.   There are variations on this too - such as serial line looped back
  2813.   etc., and the cause can be one (or a sequence) of a number of things.
  2814.  
  2815.   To understand what is going on here, it is necessary to grasp a bit of
  2816.   what is going on behind the scenes in pppd itself.
  2817.  
  2818.   When pppd starts up, it sends LCP (link control protocol) packets to
  2819.   the remote machine. If it receives a valid response it then goes on to
  2820.   the next stage (using IPCP - IP control protocol packets) and only
  2821.   when this negotiation completes is the actual IP layer started so that
  2822.   you can use the PPP link.
  2823.  
  2824.   If there is no ppp server operating at the remote end when your PC
  2825.   sends lcp packets, these get reflected by the login process at the far
  2826.   end. As these packets use 8 bits, reflecting them strips the 8th bit
  2827.   (remember, ASCII is a 7 bit code). PPP sees this and complains
  2828.   accordingly.
  2829.  
  2830.   There are several reasons this reflection can occur.
  2831.  
  2832.   18.3.1.  You are not correctly logging into the server
  2833.  
  2834.   When your chat script completes, pppd starts on your PC. However, if
  2835.   you have not completed the log in process to the server (including
  2836.   sending any command required to start PPP  on the server), PPP will
  2837.   not start.
  2838.  
  2839.   So, the lcp packets are reflected and you receive this error.
  2840.  
  2841.   You need to carefully check and correct (if necessary) your chat
  2842.   script (see above).
  2843.  
  2844.   18.3.2.  You are not starting PPP on the server
  2845.  
  2846.   Some PPP servers require you to enter a command and/or a RETURN after
  2847.   completing the log in process before the remote end starts ppp.
  2848.  
  2849.   Check your chat script (see above).
  2850.  
  2851.   If you log in manually and find you need to send a RETURN after this
  2852.   to start PPP, simply add a blank expect/send pair to the end of your
  2853.   chat script (an empty send string actually sends a RETURN).
  2854.  
  2855.   18.3.3.  The remote PPP process is slow to start
  2856.  
  2857.   This one is a bit tricksy!
  2858.  
  2859.   By default, your Linux pppd is compiled to send a maximum of 10 lcp
  2860.   configuration requests. If the server is a bit slow to start up, all
  2861.   10 such requests can be sent before the remote PPP is ready to receive
  2862.   them.
  2863.  
  2864.   On your machine, pppd sees all 10 requests reflected back (with the
  2865.   8th bit stripped) and exits.
  2866.  
  2867.   There are two ways round this:-
  2868.  
  2869.   Add lcp-max-configure 30 to your ppp options. This increases the
  2870.   maximum number of lcp configure packets pppd sends before giving up.
  2871.   For really slow server, you may need even more than this.
  2872.  
  2873.   Alternatively, you can get a bit tricksy in return. You may have
  2874.   noticed that when you logged in by hand to the PPP server and PPP
  2875.   started there, the first character of the ppp garbage that appears was
  2876.   always the tilde character (~).
  2877.  
  2878.   Using this knowledge we can add a new expect/send pair to the end of
  2879.   the chat script which expects a tilde and sends nothing. This would
  2880.   look like:-
  2881.  
  2882.   ______________________________________________________________________
  2883.   \~      ''
  2884.   ______________________________________________________________________
  2885.  
  2886.   Note: as the tilde character has a special meaning in the shell, it
  2887.   must be escaped (and hence the leading backslash).
  2888.  
  2889.   18.4.  Default route not set
  2890.  
  2891.   If pppd refuses to set up a default route, it is because (quite
  2892.   correctly) it refuses remove/replace an existing default route.
  2893.  
  2894.   The usual reason that this error occurs is that some distributions set
  2895.   up a default route via your Ethernet card as opposed to setting up a
  2896.   specific network route.
  2897.  
  2898.   See the Linux NAG and the Net2/3 HOWTOs for information on correctly
  2899.   setting up your Ethernet card and associated routes.
  2900.  
  2901.   An alternative to this is that your LAN uses a gateway/router already
  2902.   and your routing table has been set up to point the default route at
  2903.   this.
  2904.  
  2905.   Fixing up this last situation can require a fair bit of IP networking
  2906.   knowledge and is beyond the scope of this HOWTO. It is suggested you
  2907.   obtain some expert advice (via the news groups of from someone locally
  2908.   you can ask).
  2909.  
  2910.   18.5.  Other Problems
  2911.  
  2912.   There are many reasons apart from these that ppp fails to connect
  2913.   and/or operate properly.
  2914.  
  2915.   Look in the PPP FAQ (which is really a series of questions and
  2916.   answers). This is a very comprehensive document and the answers ARE
  2917.   there! From my own (sad) experience, if the answer to your problems is
  2918.   not there, the problem is NOT ppp's fault! In my case I was using an
  2919.   ELF kernel that I had not upgraded to  the appropriate kernel modules.
  2920.   I only wasted about 2 days (and most of one night) cursing what had
  2921.   been a perfect PPP server before the light dawned!
  2922.  
  2923.   19.  Getting Help when totally stuck
  2924.  
  2925.   If you can't get your PPP link to work, go back through this document
  2926.   and check everything - in conjunction with the output created by
  2927.   "chat-v..."  and "pppd -d" in you system log.
  2928.  
  2929.   Also consult the PPP documentation and FAQ plus the other documents
  2930.   mention herein!
  2931.  
  2932.   If you are still stuck, try the comp.os.linux.misc and
  2933.   comp.os.linux.networking newsgroups are reasonably regularly scanned
  2934.   by people that can help you with PPP as is comp.protocols.ppp
  2935.  
  2936.   You can try sending me personal email, but I do have a day job (and a
  2937.   life) and I do not guarantee to respond quickly (if at all) as this
  2938.   depends on my current work load and the state of my private life!
  2939.  
  2940.   In particular - DO NOT POST REAMS OF DEBUGGING OUTPUT TO THE NEWS
  2941.   GROUPS NOR SEND IT TO ME BY EMAIL - the former wastes huge amounts of
  2942.   network bandwidth and the latter will be consigned to /dev/null
  2943.   (unless I have specifically requested it).
  2944.  
  2945.   20.  Common Problems once the link is working
  2946.  
  2947.   One problem you will find is that many service providers will only
  2948.   support the connection software package that they distribute to new
  2949.   accounts. This is (typically) for Microsoft Windows :-( - and many
  2950.   service provider help desks seem to know nothing about Unix (or
  2951.   Linux). So, be prepared for limited assistance from them!
  2952.  
  2953.   You could of course do the individual a favour and educate then about
  2954.   Linux (any ISP help desk person should be reasonably 'with it' in
  2955.   Internet terms and that means they should have a home Linux box - of
  2956.   course it does)!
  2957.  
  2958.   20.1.  I can't see beyond the PPP server I connect to
  2959.  
  2960.   OK - your PPP connection is up and running and you can ping the PPP
  2961.   server by IP number (the second or "remote" IP number shown by
  2962.   ifconfig ppp0), but you can't reach anything beyond this.
  2963.  
  2964.   First of all, try pinging the IP numbers you have specified in
  2965.   /etc/resolv.conf as name servers. If this works, you can see beyond
  2966.   your PPP server (unless this has the same IP number as the "remote" IP
  2967.   number of your connection). So now try pinging the full Internet name
  2968.   of your service provider - eg
  2969.  
  2970.   ping my.provider.net.au
  2971.  
  2972.   If this does NOT work, you have a problem with the name resolution.
  2973.   This is probably because of a typo in your /etc/resolv.conf file.
  2974.   Check this carefully against the information you acquired by ringing
  2975.   your service provider. If all looks OK, ring your service provider and
  2976.   check that you wrote down the IP numbers correctly.
  2977.  
  2978.   If it STILL doesn't work (and your service provider confirms that his
  2979.   name servers are up and running), you have a problem somewhere else -
  2980.   and I suggest you check carefully through your Linux installation
  2981.   (looking particularly for file permissions).
  2982.  
  2983.   If you STILL can't ping your service provider's IP name servers by IP
  2984.   number, either they are down (give them a voice call and check) or
  2985.   there is a routing problem at your service provider's end. Again, ring
  2986.   them and check this out.
  2987.  
  2988.   One possibility is that the "remote end" is a Linux PPP server where
  2989.   the IP forwarding option has not been specified in the kernel!
  2990.  
  2991.   A good general test is to try connecting to your service provider
  2992.   using the software that most supply for (gulp) Microsoft Windows. If
  2993.   everything works from another operating system to exactly the same
  2994.   account, then the problem is with your Linux system and NOT your
  2995.   service provider.
  2996.  
  2997.   20.2.  I can send email, but not receive it
  2998.  
  2999.   If you are using dynamic IP numbers, this is perfectly normal. See
  3000.   "Setting up Services" below.
  3001.  
  3002.   20.3.  Why can't people finger, WWW, gopher, talk etc to my machine?
  3003.  
  3004.   Again, if you are using dynamic IP numbers, this is perfectly normal.
  3005.   See "Setting up Services" below.
  3006.  
  3007.   21.  Using Internet services with Dynamic IP numbers
  3008.  
  3009.   If you are using dynamic IP numbers (and many service providers will
  3010.   only give you a dynamic IP number unless you pay significantly more
  3011.   for your connection), then you have to recognise the limitations this
  3012.   imposes.
  3013.  
  3014.   First of all, outbound service requests will work just fine. That is,
  3015.   you can send email using sendmail (provided you have correctly set up
  3016.   sendmail), ftp files from remote sites, finger users on other
  3017.   machines, browse the web etc.
  3018.  
  3019.   In particular, you can answer email that you have brought down to your
  3020.   machine whilst you are off line. Mail will simply sit in your mail
  3021.   queue until you dial back into your ISP.
  3022.   However, your machine is NOT connected to the Internet 24 hours a day,
  3023.   nor does it have the same IP number every time it is connected. So it
  3024.   is impossible for you to receive email directed to your machine, and
  3025.   very difficult to set up a web or ftp server that your friends can
  3026.   access! As far as the Internet is concerned your machine does not
  3027.   exist as a unique, permanently contactable machine as it does not have
  3028.   a unique IP number (remember - other machines will be using the IP
  3029.   number when they are allocated it on dial in).
  3030.  
  3031.   If you set up a WWW (or any other server), it is totally unknown by
  3032.   any user on the Internet UNLESS they know that your machine is
  3033.   connected AND its actual (current) IP number. There are a number of
  3034.   ways they can get this info, ranging from you ringing them, sending
  3035.   them email to tell them or cunning use of ".plan" files on a shell
  3036.   account at your service provider (assuming that your provider allows
  3037.   shell and finger access).
  3038.  
  3039.   Now, for most users, this is not a problem - all that most people want
  3040.   is to send and receive email (using your account on your service
  3041.   provider) and make outbound connections to WWW, ftp and other servers
  3042.   on the Internet. If you MUST have inbound connections to your server,
  3043.   you should really get a static IP number. Alternatively you can
  3044.   explore the methods hinted at above...
  3045.  
  3046.   21.1.  Setting up email
  3047.  
  3048.   Even for dynamic IP numbers, you can certainly configure sendmail on
  3049.   your machine to send out any email that you compose locally.
  3050.   Configuration of sendmail can be obscure and difficult - so this
  3051.   document does not attempt to tell you how to do this. However, you
  3052.   should probably configure sendmail so that your Internet service
  3053.   provider is designated as your "smart relay" host (the sendmail.cf DS
  3054.   option). (For more sendmail configuration info, see the sendmail
  3055.   documents - and look at the m4 configurations that come with sendmail.
  3056.   There is almost certain to be one there that will meet your needs).
  3057.  
  3058.   There are also excellent books on Sendmail (notably the 'bible' from
  3059.   O'Reilly and Associates), but these are almost certainly overkill for
  3060.   most users!
  3061.  
  3062.   Once you have sendmail configured, you will probably want to have
  3063.   sendmail dispatch any messages that have been sitting in the outbound
  3064.   mail queue as soon as the PPP connection comes up. To do this, add the
  3065.   command
  3066.  
  3067.        sendmail -q &
  3068.  
  3069.   to your /etc/ppp/ip-up script (see below).
  3070.  
  3071.   Inbound email is a problem for dynamic IP numbers. The way to handle
  3072.   this is to:-
  3073.  
  3074.   ╖  configure your mail user agent so that all mail is sent out with a
  3075.      "reply to" header giving your email address at your Internet
  3076.      Service provider.
  3077.      If you can, you should also set your FROM address to be your email
  3078.      address at your ISP as well.
  3079.  
  3080.   ╖  use the popclient, fetchmail programs to retrieve your email from
  3081.      your service provider. Alternatively, if your ISP is using IMAP,
  3082.      use an IMAP enabled mail user agent (such as pine).
  3083.  
  3084.   You can automate this process at dial up time by putting the necessary
  3085.   commands in the /etc/ppp/ip-up script (see below).
  3086.  
  3087.   21.2.  Setting Up a local Name server
  3088.  
  3089.   Whilst you can quite happily use the domain name servers located at
  3090.   your ISP, you can also set up a local caching only (secondary) name
  3091.   server that is brought up by the ip-up script. The advantage of
  3092.   running a local (caching only) name server is that it will save you
  3093.   time (and bandwidth) if you frequently contact the same sites during a
  3094.   long on-line session.
  3095.  
  3096.   DNS configuration for a caching only nameserver (that uses a
  3097.   "forwarders' line in the named.boot file pointing at your ISPs DNS) is
  3098.   relatively simple. The O'Reilly book (DNS and Bind) explains all you
  3099.   want to know about this.
  3100.  
  3101.   There is also a DNS-HOWTO available.
  3102.  
  3103.   If you are running a small LAN that can access the Internet through
  3104.   you Linux PC (using IP Masquerade for example), it is probably a good
  3105.   idea to run a local name server (with a forwarders directive) whilst
  3106.   the link is up as this will minimise the bandwidth and delays
  3107.   associated with name resolution.
  3108.  
  3109.   One point of Nettiquette: ask permission from your ISP before you
  3110.   start using a secondary, caching only name server in your ISP's
  3111.   domain.  Properly configured, your DNS will not cause any problems to
  3112.   your ISP at all, but if you get things wrong, it can cause problems.
  3113.  
  3114.   22.  Linking two networks using PPP
  3115.  
  3116.   There is basically no difference between linking a single Linux PC to
  3117.   a PPP server and linking two LANs using PPP on a machine on each LAN.
  3118.   Remember, PPP is a peer to peer protocol.
  3119.  
  3120.   However, you DEFINITELY need to understand about how routing is
  3121.   established. Read the NET-2 howto and the Linux Network Administrator
  3122.   Guide (NAG). You will also find " TCP/IP Network Administration"
  3123.   (published by O'Reilly and Assoc - ISBN 0-937175-82-X) to be of
  3124.   invaluable assistance.
  3125.  
  3126.   If you are going to be sub networking an IP network number on either
  3127.   side of the link, you will also find the Linux (draft) sub networking
  3128.   mini-howto) to be of use. This is available at Linux Sub networking
  3129.   mini-HOWTO <http://www.interweft.com.au/other/>.
  3130.  
  3131.   In order to link two LANs, you must be using different IP network
  3132.   numbers (or subnets of the same network number) and you will need to
  3133.   use static IP numbers - or use IP masquerade. If you want to use IP
  3134.   masquerade, see the IP masquerade mini-howto for instructions on
  3135.   setting that up.
  3136.  
  3137.   22.1.  Setting up the IP numbers
  3138.  
  3139.   Arrange with the network administrator of the other LAN the IP numbers
  3140.   that will be used for each end of the PPP interface. If you are using
  3141.   static IP numbers, this will also probably require you to dial into a
  3142.   specific telephone number.
  3143.  
  3144.   Now edit the appropriate /etc/ppp/options[.ttyXX] file - it's a good
  3145.   idea to have a specific modem and port at your end for this
  3146.   connection. This may well require you to change your /etc/ppp/options
  3147.   file - and create appropriate options.ttyXX files for any other
  3148.   connections!
  3149.  
  3150.   Specify the IP numbers for your end of the PPP link in the appropriate
  3151.   options file exactly as shown above for static IP numbers.
  3152.  
  3153.   22.2.  Setting up the routing
  3154.  
  3155.   You must arrange that packets on your local LAN are routed across the
  3156.   interface that the PPP link establishes. This is a two stage process.
  3157.  
  3158.   First of all, you need to establish a route from the machine running
  3159.   the PPP link to the network(s) at the far end of the link. If the link
  3160.   is to the Internet, this can be handled by a default route established
  3161.   by pppd itself at your end of the connection using the 'defaultroute'
  3162.   option to pppd.
  3163.  
  3164.   If however, the link is only linking two LANs, then a specific network
  3165.   route must be added for each network that is accessible across the
  3166.   link.  This is done using a 'route' command for each network in the
  3167.   /etc/ppp/ip-up script (see After the link comes up...) for
  3168.   instructions on doing this.
  3169.  
  3170.   The second thing you need to do is to tell the other computers on your
  3171.   LAN that your Linux computer is actually the 'gateway' for the
  3172.   network(s) at the far end of the ppp link.
  3173.  
  3174.   Of course, the network administrator at the other end of the link has
  3175.   to do all this too! However, as s/he will be routing packets to your
  3176.   specific networks, a specific network route will be required, not a
  3177.   default route (unless the LANs at the far and of the link are linking
  3178.   into you to access the Internet across your connection).
  3179.  
  3180.   22.3.  Network security
  3181.  
  3182.   If you are linking you LAN to the Internet using PPP - or even just to
  3183.   a "foreign" LAN, you need to think about security issues. I strongly
  3184.   urge you to think about setting up a firewall!
  3185.  
  3186.   You should also speak to the LAN administrator at your site BEFORE you
  3187.   start linking to foreign LANs or the Internet this way. Failure to do
  3188.   so could earn you anything from no reaction to really serious trouble!
  3189.  
  3190.   23.  After the link comes up - the /etc/ppp/ip-up script
  3191.  
  3192.   Once the PPP link is established, pppd looks for /etc/ppp/ip-up. If
  3193.   this script exists and is executable, the PPP daemon executes the
  3194.   script. This allows you to automate any special routing commands that
  3195.   may be necessary and any other actions that you want to occur every
  3196.   time the PPP link is activated.
  3197.  
  3198.   This is just a shell script and can do anything that a shell script
  3199.   can do (i.e. virtually anything you want).
  3200.  
  3201.   For example, you can get sendmail to dispatch any waiting outbound
  3202.   messages in the mail queue.
  3203.  
  3204.   Similarly, you can insert the commands into ip-up to collect (using
  3205.   pop) any email waiting for you at your ISP.
  3206.  
  3207.   There are restrictions on /etc/ppp/ip-up:-
  3208.  
  3209.   ╖  It runs in a deliberately restricted environment to enhance
  3210.      security. This means you must give a full path to binaries etc.
  3211.  
  3212.   ╖  Technically, /etc/ppp/ip-up is a program not a script. This means
  3213.      it can be directly executed - and hence it requires the standard
  3214.      file magic (#!/bin/bash) at the start of the first line and must be
  3215.      readable and executable by root.
  3216.  
  3217.   23.1.  Special routing
  3218.  
  3219.   If you are linking two LANs, you will need to set up specific routes
  3220.   to the 'foreign' LANs. This is easily done using the /etc/ppp/ip-up
  3221.   script. The only difficulty arises if your machine handles multiple
  3222.   PPP links.
  3223.  
  3224.   This is because the /etc/ppp/ip-up is executed for EVERY ppp
  3225.   connection that comes up, so you need to carefully execute the correct
  3226.   routing commands for the particular link that comes up - and not when
  3227.   any other link comes up!
  3228.  
  3229.   23.2.  Handling email queues
  3230.  
  3231.   When the link between two LANs comes up, you may well want to make
  3232.   sure that email that is queued at either end is flushed - sent out to
  3233.   its destination. This is done by adding the appropriate sendmail
  3234.   invocation.
  3235.  
  3236.   Using the bash 'case' statement on an appropriate parameter that pppd
  3237.   passes into the script accomplishes this. For example, this is the
  3238.   /etc/ppp/ip-up script I use to handle our WAN links and the link to my
  3239.   home Ethernet (also handled on the same ppp server).
  3240.  
  3241.   23.3.  A sample /etc/ppp/ip-up script
  3242.  
  3243.   The example below provides a variety of example uses.
  3244.  
  3245.   ______________________________________________________________________
  3246.   #!/bin/bash
  3247.   #
  3248.   # Script which handles the routing issues as necessary for pppd
  3249.   # Only the link to Newman requires this handling.
  3250.   #
  3251.   # When the ppp link comes up, this script is called with the following
  3252.   # parameters
  3253.   #       $1      the interface name used by pppd (e.g. ppp3)
  3254.   #       $2      the tty device name
  3255.   #       $3      the tty device speed
  3256.   #       $4      the local IP address for the interface
  3257.   #       $5      the remote IP address
  3258.   #       $6      the parameter specified by the 'ipparam' option to pppd
  3259.   #
  3260.   case "$5" in
  3261.   # Handle the routing to the Newman Campus server
  3262.           202.12.126.1)
  3263.                   /sbin/route add -net 202.12.126.0 gw 202.12.126.1
  3264.   # and flush the mail queue to get their email there asap!
  3265.                   /usr/sbin/sendmail -q &
  3266.                   ;;
  3267.           139.130.177.2)
  3268.   # Our Internet link
  3269.   # When the link comes up, start the time server and synchronise to the world
  3270.   # provided it is not already running
  3271.                   if [ ! -f /var/lock/subsys/xntpd ]; then
  3272.                           /etc/rc.d/init.d/xntpd.init start &
  3273.                   fi
  3274.   # Start the news server (if not already running)
  3275.                   if [ ! -f /var/lock/subsys/news ]; then
  3276.                           /etc/rc.d/init.d/news start &
  3277.                   fi
  3278.                   ;;
  3279.           203.18.8.104)
  3280.   # Get the email down to my home machine as soon as the link comes up
  3281.   # No routing is required as my home Ethernet is handled by IP
  3282.   # masquerade and proxyarp routing.
  3283.                   /usr/sbin/sendmail -q &
  3284.                   ;;
  3285.           *)
  3286.   esac
  3287.   exit 0
  3288.   ______________________________________________________________________
  3289.  
  3290.   As a result of bringing up the ppp link to our Newman campus and this
  3291.   script, we end up with the following routing table entries (this
  3292.   machine also is our general dial up PPP server AND handles our
  3293.   Internet link). I have interspersed comments in the output to help
  3294.   explain what each entry is) :-
  3295.  
  3296.   ______________________________________________________________________
  3297.   [root@kepler /root]# route -n
  3298.   Kernel routing table
  3299.   Destination     Gateway         Genmask         Flags MSS    Window Use Iface
  3300.   # the HOST route to our remote internet gateway
  3301.   139.130.177.2   *               255.255.255.255 UH    1500   0      134 ppp4
  3302.   # the HOST route to our Newman campus server
  3303.   202.12.126.1    *               255.255.255.255 UH    1500   0       82 ppp5
  3304.   # the HOST route to my home ethernet
  3305.   203.18.8.104    *               255.255.255.255 UH    1500   0       74 ppp3
  3306.   # two of our general dial up PPP lines
  3307.   203.18.8.64     *               255.255.255.255 UH    552    0        0 ppp2
  3308.   203.18.8.62     *               255.255.255.255 UH    552    0        1 ppp1
  3309.   # the specific network route to the Newman campus LAN
  3310.   202.12.126.0    202.12.126.1    255.255.255.0   UG    1500   0        0 ppp5
  3311.   # the route to our local Ethernet (super-netting two adjacent C classes)
  3312.   203.18.8.0      *               255.255.254.0   U     1500   0     1683 eth0
  3313.   # the route to the loop back device
  3314.   127.0.0.0       *               255.0.0.0       U     3584   0      483 lo
  3315.   # the default route to the Internet
  3316.   default         139.130.177.2   *               UG    1500   0     3633 ppp4
  3317.   ______________________________________________________________________
  3318.  
  3319.   23.4.  Handling email
  3320.  
  3321.   The previous section shows how to handle the outgoing mail - simply by
  3322.   flushing the mail queue once the link is up.
  3323.  
  3324.   If you are running a WAN link, you can arrange with the network
  3325.   administrator of the remote LAN to do exactly the same thing. For
  3326.   example, at the Newman Campus end of our WAN link, the /etc/ppp/ip-up
  3327.   script looks like :-
  3328.  
  3329.   ______________________________________________________________________
  3330.   #!/bin/bash
  3331.   #
  3332.   # Script which handles the routing issues as necessary for pppd
  3333.   # Only the link to Hedland requires this handling.
  3334.   #
  3335.   # When the ppp link comes up, this script is called with the following
  3336.   # parameters
  3337.   #       $1      the interface name used by pppd (e.g. ppp3)
  3338.   #       $2      the tty device name
  3339.   #       $3      the tty device speed
  3340.   #       $4      the local IP address for the interface
  3341.   #       $5      the remote IP address
  3342.   #       $6      the parameter specified by the 'ipparam' option to pppd
  3343.   #
  3344.   case "$5" in
  3345.           203.18.8.4)
  3346.                   /usr/sbin/sendmail -q
  3347.                   ;;
  3348.           *)
  3349.   esac
  3350.   exit 0
  3351.   ______________________________________________________________________
  3352.  
  3353.   If however you have only a dynamic IP PPP link to your ISP, you need
  3354.   to get your email from the account on your ISPs machine. This is
  3355.   usually done using the POP (Post Office Protocol). This process can be
  3356.   handled using the 'popclient' program - and the ip-up script can
  3357.   automate this process for you too!
  3358.  
  3359.   Simply create a /etc/ppp/ip-up script that contains the appropriate
  3360.   invocation of popclient. For my laptop that runs Red Hat Linux (which
  3361.   I take on any travels), this is
  3362.  
  3363.   ______________________________________________________________________
  3364.   popclient -3 -c -u hartr -p <password> kepler.hedland.edu.au |formail -s procmail
  3365.   ______________________________________________________________________
  3366.  
  3367.   You could use slurp or whatever to do the same for news, and so forth.
  3368.   Remember, the ip-up script is just a standard bash script and so can
  3369.   be used to automate ANY function that needs to be accomplished every
  3370.   time the appropriate PPP link comes up.
  3371.  
  3372.   24.  Using /etc/ppp/ip-down
  3373.  
  3374.   You can create a script  that will be executed once the link has been
  3375.   terminated. This is stored in /etc/ppp/ip-down. It can be used to undo
  3376.   anything special that you did in the corresponding /etc/ppp/ip-up
  3377.   script.
  3378.  
  3379.   25.  Routing issues on a LAN
  3380.  
  3381.   If you are connected to a LAN but still want to use PPP on your
  3382.   personal Linux machine , you need to address some issues of the routes
  3383.   packets need to take from your machine to reach your LAN (through your
  3384.   Ethernet interface) and also to the remote PPP server and beyond.
  3385.  
  3386.   This section does NOT attempt to teach you about routing - it deals
  3387.   only with a simple, special case of (static) routing!
  3388.  
  3389.   I strongly urge you to read the Linux Network Administrator Guide
  3390.   (NAG) if you are NOT familiar with routing. Also the O'Reilly book
  3391.   "TCP/IP Network Administration" covers this topic in a very
  3392.   understandable form.
  3393.  
  3394.   The basic rule of static routing is that the DEFAULT route should be
  3395.   the one that points to the MOST number of network addresses. For other
  3396.   networks, enter specific routes to the routing table.
  3397.  
  3398.   The ONLY situation I am going to cover here is where your Linux box is
  3399.   on a LAN that is not connected to the Internet - and you want to dial
  3400.   out to the Internet for personal use whilst still connected to the
  3401.   LAN.
  3402.  
  3403.   First of all, make sure that your Ethernet route is set up to the
  3404.   specific network addresses available across your LAN - NOT set to the
  3405.   default route!
  3406.  
  3407.   Check this by issuing a route command, you should see something like
  3408.   the following:-
  3409.  
  3410.        [root@hwin /root]# route -n
  3411.        Kernel routing table
  3412.        Destination     Gateway         Genmask         Flags MSS    Window Use Iface
  3413.        loopback        *               255.255.255.0   U     1936   0       50 lo
  3414.        10.0.0.0        *               255.255.255.0   U     1436   0      565 eth0
  3415.  
  3416.   If your Ethernet interface (eth0) is pointing at the default route,
  3417.   (the first column will show "default" in the eth0 line) you need to
  3418.   change your Ethernet initialisation scripts to make it point at the
  3419.   specific network numbers rather than the default route (consult the
  3420.   Net2 HOWTO and NAG).
  3421.  
  3422.   This will allow pppd to set up your default route as shown below:-
  3423.  
  3424.        [root@hwin /root]# route -n
  3425.        Kernel routing table
  3426.  
  3427.        Destination     Gateway         Genmask         Flags MSS    Window Use Iface
  3428.        10.144.153.51   *               255.255.255.255 UH    488    0        0 ppp0
  3429.        127.0.0.0       *               255.255.255.0   U     1936   0       50 lo
  3430.        10.1.0.0        *               255.255.255.0   U     1436   0      569 eth0
  3431.        default         10.144.153.51   *               UG    488    0        3 ppp0
  3432.  
  3433.   As you can see, we have a host route to the PPP server (
  3434.   10.144.153.51) via ppp0 and also a default network route that uses the
  3435.   PPP server as its gateway.
  3436.  
  3437.   If your set up needs to be more complex than this - read the routing
  3438.   documents already mentioned and consult an expert at your site!
  3439.  
  3440.   If your LAN already has routers on it, you will already have gateways
  3441.   established to the wider networks available at your site. You should
  3442.   STILL point your default route at the PPP interface - and make the
  3443.   other routes specific to the networks they serve.
  3444.  
  3445.   25.1.  Note on Security
  3446.  
  3447.   When you set up a Linux box on an existing LAN to link into the
  3448.   Internet, you are potentially opening your entire LAN to the Internet
  3449.   - and the hackers that reside there. Before you do this, I strongly
  3450.   urge you to consult your network administrator and site security
  3451.   policy. If your PPP connection to the Internet is used to successfully
  3452.   attack your site, you will at the very least earn the intense anger of
  3453.   your fellow users, network and system administrators. You may also
  3454.   find yourself in very much more serious trouble!
  3455.  
  3456.   Before you connect a LAN to the Internet, you should consider the
  3457.   security implications of even a DYNAMIC connection - hence the earlier
  3458.   reference to the O'Reilly "Building Internet Firewalls"!
  3459.  
  3460.   26.  Setting up a PPP server
  3461.  
  3462.   As already mentioned, there are many ways to do this. What I present
  3463.   here is the way I do it (using a Cyclades multi-port serial card) and
  3464.   a rotary dial in set of telephone lines.
  3465.  
  3466.   If you don't like the method I present here, please feel free to go
  3467.   your own way. I would however, be pleased to include additional
  3468.   methods in future versions of the HOWTO. So, please send me your
  3469.   comments and methods!
  3470.  
  3471.   Please note, this section only concerns setting up Linux as a PPP
  3472.   server. I do not (ever) intend to include information on setting up
  3473.   special terminal servers and such.
  3474.  
  3475.   Also, I have yet to experiment with shadow passwords (but will be
  3476.   doing so sometime). Information currently presented does NOT therefore
  3477.   include any bells and whistles that are required by the shadow suite.
  3478.  
  3479.   26.1.  Kernel compilation
  3480.  
  3481.   All the earlier comments regarding kernel compilation and kernel
  3482.   versions versus pppd versions apply. This section assumes that you
  3483.   have read the earlier sections of this document!
  3484.  
  3485.   For a PPP server, you MUST include IP forwarding in your kernel.  You
  3486.   may also wish to include other capabilities (such as IP fire walls,
  3487.   accounting etc etc).
  3488.  
  3489.   If you are using a multi-port serial card, then you must obviously
  3490.   include the necessary drivers in your kernel too!
  3491.  
  3492.   26.2.  Overview of the server system
  3493.  
  3494.   We offer dial up PPP (and SLIP) accounts and shell accounts using the
  3495.   same user name/password pair. This has the advantages (for us) that a
  3496.   user requires only one account and can use it for all types of
  3497.   connectivity.
  3498.  
  3499.   As we are an educational organisation, we do not charge our staff and
  3500.   students for access, and so do not have to worry about accounting and
  3501.   charging issues.
  3502.  
  3503.   We operate a firewall between our site and the Internet, and this
  3504.   restricts some user access as the dial up lines are inside our
  3505.   (Internet) firewall (for fairly obvious reasons, details of our other
  3506.   internal fire walls are not presented here and are irrelevant in any
  3507.   case).
  3508.  
  3509.   The process a user goes through to establish a PPP link to our site
  3510.   (once they have a valid account of course) is :-
  3511.   ╖  Dial into our rotary dialer (this is a single phone number that
  3512.      connects to a bank of modems - the first free modem is then used).
  3513.  
  3514.   ╖  Log in using a valid user name and password pair.
  3515.  
  3516.   ╖  At the shell prompt, issue the command ppp to start PPP on the
  3517.      server.
  3518.  
  3519.   ╖  Start PPP on their PC (be it running Windows, DOS, Linux MAC OS or
  3520.      whatever - that is their problem).
  3521.  
  3522.   The server uses individual /etc/ppp/options.ttyXX files for each dial
  3523.   in port that set the remote IP number for dynamic IP allocation.  The
  3524.   server users proxyarp routing for the remote clients (set via the
  3525.   appropriate option to pppd). This obviates the need for routed or
  3526.   gated.
  3527.  
  3528.   When the user hangs up at their end, pppd detects this and tells the
  3529.   modem to hang up, bringing down the PPP link at the same time.
  3530.  
  3531.   26.3.  Getting the software together
  3532.  
  3533.   You will need the following software:-
  3534.  
  3535.   ╖  Linux, properly compiled to include the necessary options.
  3536.  
  3537.   ╖  The appropriate version of pppd for your kernel.
  3538.  
  3539.   ╖  A 'getty' program that intelligently handles modem communications.
  3540.      We use getty_ps2.0.7h, but mgetty is highly thought of. I
  3541.      understand that mgetty can detect a call that is using pap/chap
  3542.      (pap is the standard for Windows95) and invoke pppd automatically,
  3543.      but I have yet to explore this.
  3544.  
  3545.   ╖  An operational domain name server (DNS) that is accessible to your
  3546.      dial up users.
  3547.      You should really be running your own DNS if possible...
  3548.  
  3549.   26.4.  Setting up standard (shell access) dialup.
  3550.  
  3551.   Before you can set up your PPP server, your Linux box must be capable
  3552.   of handling standard dial up access.
  3553.  
  3554.   This howto does NOT cover setting this up. Please see the
  3555.   documentation of the getty of your choice and serial HOWTO for
  3556.   information on this.
  3557.  
  3558.   26.5.  Setting up the PPP options files
  3559.  
  3560.   You will need to set up the overall /etc/ppp/options with the common
  3561.   options for all dial up ports. The options we use are:-
  3562.  
  3563.   ______________________________________________________________________
  3564.   asyncmap 0
  3565.   netmask 255.255.254.0
  3566.   proxyarp
  3567.   lock
  3568.   crtscts
  3569.   modem
  3570.   ______________________________________________________________________
  3571.  
  3572.   Note - we do NOT use any (obvious) routing - and in particular there
  3573.   is no defaultroute option. The reason for this is that all you (as a
  3574.   PPP server) are required to do is to route packets from the ppp client
  3575.   out across your LAN/Internet and route packets to the client from your
  3576.   LAN and beyond.
  3577.  
  3578.   All that is necessary for this is a host route to the client machine
  3579.   and the use of the 'proxyarp' option to pppd.
  3580.  
  3581.   The 'proxyarp' option sets up (surprise) a proxy ARP entry in the PPP
  3582.   server's ARP table that basically says 'send all packets destined for
  3583.   the PPP client to me'. This is the easiest way to set up routing to a
  3584.   single PPP client - but you cannot use this if you are routing between
  3585.   two LANs - you must add proper network routes which can't use proxy
  3586.   ARP.
  3587.  
  3588.   You will almost certainly wish to provide dynamic IP number allocation
  3589.   to your dial up users. You can accomplish this by allocating an IP
  3590.   number to each dial up port. Now, create a /etc/ppp/options.ttyXX for
  3591.   each dial up port.
  3592.  
  3593.   In this, simply put the local (server) IP number and the IP number
  3594.   that is to be used for that port. For example
  3595.  
  3596.   ______________________________________________________________________
  3597.   kepler:slip01
  3598.   ______________________________________________________________________
  3599.  
  3600.   In particular, note that you can use valid host names in this file (I
  3601.   find that I only remember the IP numbers of critical machines and
  3602.   devices on my networks - names are more meaningful)!
  3603.  
  3604.   26.6.  Setting pppd up to allow users to (successfully) run it
  3605.  
  3606.   As starting a ppp link implies configuring a kernel device (a network
  3607.   interface) and manipulating the kernel routing tables, special
  3608.   privileges are required - in fact full root privileges.
  3609.  
  3610.   Fortunately, pppd has been designed to be 'safe' to run set uid to
  3611.   root.  So you will need to
  3612.  
  3613.   ______________________________________________________________________
  3614.   chmod u+s /usr/sbin/pppd
  3615.   ______________________________________________________________________
  3616.  
  3617.   When you list the file, it should then appear as
  3618.  
  3619.   ______________________________________________________________________
  3620.   -rwsr-xr-x   1 root     root        74224 Apr 28 07:17 /usr/sbin/pppd
  3621.   ______________________________________________________________________
  3622.  
  3623.   If you do not do this, users will be unable to set up their ppp link.
  3624.  
  3625.   26.7.  Setting up the global alias for pppd
  3626.  
  3627.   In order to simplify things for our dial up PPP users, we create a
  3628.   global alias (in /etc/bashrc) so that one simple command will start
  3629.   ppp on the server once they are logged in.
  3630.  
  3631.   This looks like
  3632.  
  3633.   ______________________________________________________________________
  3634.   alias ppp="exec /usr/sbin/pppd -detach"
  3635.   ______________________________________________________________________
  3636.  
  3637.   What this does is
  3638.  
  3639.   ╖  exec : this means replace the running program (in this case the
  3640.      shell) with the program that is run.
  3641.  
  3642.   ╖  pppd -detach : start up pppd and do NOT fork into the background.
  3643.      This ensures that when pppd exits there is no process hanging
  3644.      around.
  3645.  
  3646.   When a user logs in like this, they will appear in the output of 'w'
  3647.   as
  3648.  
  3649.   ______________________________________________________________________
  3650.     6:24pm  up 3 days,  7:00,  4 users,  load average: 0.05, 0.03, 0.00
  3651.   User     tty       login@  idle   JCPU   PCPU  what
  3652.   hartr    ttyC0     3:05am  9:14                -
  3653.   ______________________________________________________________________
  3654.  
  3655.   And that is it...I told you this was a simple, basic PPP server
  3656.   system!
  3657.  
  3658.   27.  Using PPP across a null modem (direct serial) connection
  3659.  
  3660.   This is very simple - there is no modem in the way so things are much
  3661.   simpler.
  3662.  
  3663.   First of all, choose one of the machines as a 'server', setting up a
  3664.   getty on the serial port so you can test that you do have connectivity
  3665.   using minicom to access the serial port on the 'client'.
  3666.  
  3667.   Once you have this functioning, you can remove the getty UNLESS you
  3668.   want to make sure that the connection is validated using user
  3669.   name/password pairs as for a dial up connection. As you have 'physical
  3670.   control' of both machines, I will presume that you do NOT want to do
  3671.   this.
  3672.  
  3673.   Now, on the server, remove the getty and make sure that you have the
  3674.   serial ports on both machines configured correctly using 'setserial'.
  3675.  
  3676.   All you need to do now is to start pppd on both systems. I will assume
  3677.   that the connection uses /dev/ttyS34 on both machines. So, on both
  3678.   machines execute the command:-
  3679.  
  3680.   ______________________________________________________________________
  3681.   pppd -detach crtscts lock <local IP>:<remote IP> /dev/ttyS3 38400 &
  3682.   ______________________________________________________________________
  3683.  
  3684.   This will bring up the link - but as yet you have no routing
  3685.   specified.  You can test the link by pinging to and fro to each
  3686.   machine. If this works, bring down the link by killing one of the pppd
  3687.   processes.
  3688.  
  3689.   The routing you need will of course depend on exactly what you are
  3690.   trying to do. Generally, one of the machines will be connected to an
  3691.   Ethernet (and beyond) and so the routing required is exactly the same
  3692.   as for a PPP server and client.
  3693.  
  3694.   So on the Ethernet equipped machine, the pppd command would be
  3695.  
  3696.   ______________________________________________________________________
  3697.   pppd -detach crtscts lock proxyarp <local IP>:<remote IP> /dev/ttyS3 38400 &
  3698.   ______________________________________________________________________
  3699.  
  3700.   and on the other machine
  3701.  
  3702.   ______________________________________________________________________
  3703.   pppd -detach crtscts lock defaultroute <local IP>:<remote IP> /dev/ttyS3 38400 &
  3704.   ______________________________________________________________________
  3705.  
  3706.   If you are linking two networks (using a serial link!) or have more
  3707.   complex routing requirements, you can use /etc/ppp/ip-up in exactly
  3708.   the same way as mentioned earlier in this document.
  3709.  
  3710.   Robert Hart
  3711.   Port Hedland, Western Australia
  3712.   Melbourne, Victoria, Australia August/October 1996 January/March 1997
  3713.  
  3714.