home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 8 / CDACTUAL8.iso / docs / isp-hook < prev    next >
Encoding:
Text File  |  1996-07-11  |  29.2 KB  |  830 lines

  1.   Linux ISP Hookup HOWTO
  2.   Egil Kvaleberg, egilk@sn.no
  3.   v1.0, 9 March 1996
  4.  
  5.   This document describes how to use Linux to connect to an Internet
  6.   Service Provider via a dial-up modem connection.  As well as the basic
  7.   dial-up procedure and IP establishment, email and news handling is
  8.   covered.
  9.  
  10.   1.  Introduction
  11.  
  12.   This description has been made to answer a few questions about how
  13.   dial-up ISP (Internet Service Provider) subscribers may configure and
  14.   use Linux.
  15.  
  16.   To ease the burden for those who will connect their Linux based
  17.   machines to an ISP for the first time, an attempt has been made to
  18.   cover most issues encountered.  This quite unavoidably will create a
  19.   certain degree of overlap with other Linux Howto-documents and LDP
  20.   books.  Reference should be made to these documents to provide better
  21.   understanding and detail.
  22.  
  23.   Much of the existing documentation is targeted towards users with a
  24.   certain degree of experience, and first time users will often have
  25.   trouble sorting out the relevant information.
  26.  
  27.   To simplify, the examples given will assume the following:
  28.  
  29.   ╖  User name: dirk
  30.  
  31.   ╖  Password: PrettySecret
  32.  
  33.   ╖  Internet service provider: acme.com
  34.  
  35.   ╖  Email server: mail.acme.com
  36.  
  37.   ╖  News server: news.acme.com
  38.  
  39.   ╖  Name server: 193.212.1.0
  40.  
  41.   ╖  Phone number: 12345678
  42.  
  43.   Our "dirk" will be calling his machine "roderick".
  44.  
  45.   All references in the table above should naturally be replaced by
  46.   whatever is valid for the ISP one is using.  Often, just a minimum of
  47.   changes will otherwise be required for users with different ISPs.  I
  48.   would like to be informed about what problems you encounter on this
  49.   account.
  50.  
  51.   1.1.  New versions of this document
  52.  
  53.   New versions of this document will be periodically posted to
  54.   comp.os.linux.answers. They will also be added to the various
  55.   anonymous FTP sites who archive such information, including:
  56.  
  57.   ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO
  58.  
  59.   In addition, you should generally be able to find this document on the
  60.   Linux WorldWideWeb home page at
  61.  
  62.   http://sunsite.unc.edu/mdw/linux.html
  63.  
  64.   Finally, the very latest version of this document should also be
  65.   available in various formats from:
  66.  
  67.   ftp://ftp.sn.no/user/egilk/ISP-HOWTO.txt
  68.  
  69.   ftp://ftp.sn.no/user/egilk/ISP-HOWTO.ps.gz
  70.  
  71.   ftp://ftp.sn.no/user/egilk/ISP-HOWTO.tar.gz
  72.  
  73.   http://www.sn.no/~egilk/ISP-HOWTO.html
  74.  
  75.   1.2.  Feedback
  76.  
  77.   All comments, error reports, additional information and criticism of
  78.   all sorts should be directed to:
  79.  
  80.   egilk@sn.no
  81.  
  82.   http://www.sn.no/~egilk/
  83.  
  84.   1.3.  Disclaimer
  85.  
  86.   No liability for the contents of this documents can be accepted.  Use
  87.   the concepts, examples and other content at your own risk.
  88.   Additionally, this is an early version, with many possibilities for
  89.   inaccuracies and errors.
  90.  
  91.   One of many possible setups will be described. In the Linux world,
  92.   there is usually a number of ways in which to accomplish things.
  93.   Paragraphs containing hints to alternatives are marked by ALT. Please
  94.   also note that FTP-references often will change slightly as new
  95.   versions of programs arrive.
  96.  
  97.   As far as I know, only programs that under certain terms may be used
  98.   or evaluated for personal purposes will be described. Most of the
  99.   programs will be available complete with source under GNU-like terms.
  100.  
  101.   1.4.  Copyright information
  102.  
  103.   This document is copyrighted (c)1996 Egil Kvaleberg and distributed
  104.   under the following terms:
  105.  
  106.   ╖  Linux HOWTO documents may be reproduced and distributed in whole or
  107.      in part, in any medium physical or electronic, as long as this
  108.      copyright notice is retained on all copies. Commercial
  109.      redistribution is allowed and encouraged; however, the author would
  110.      like to be notified of any such distributions.
  111.  
  112.   ╖  All translations, derivative works, or aggregate works
  113.      incorporating any Linux HOWTO documents must be covered under this
  114.      copyright notice.  That is, you may not produce a derivative work
  115.      from a HOWTO and impose additional restrictions on its
  116.      distribution. Exceptions to these rules may be granted under
  117.      certain conditions; please contact the Linux HOWTO coordinator at
  118.      the address given below.
  119.  
  120.   ╖  If you have questions, please contact Greg Hankins, the Linux HOWTO
  121.      coordinator, at gregh@sunsite.unc.edu via email.  Finger for phone
  122.      number and snail mail address.
  123.  
  124.   2.  How do I connect to the rest of the world?
  125.  
  126.   It will be assumed that we have installed the essential networking
  127.   software modules (e.g. essential parts of the Slackware N-series), and
  128.   that you have set up which serial port that is to be used for the
  129.   /dev/modem.
  130.  
  131.   The default configuration will usually only allow direct access to
  132.   "/dev/modem" as user "root".
  133.  
  134.   To connect to ISP shell accounts directly, and to experiment with
  135.   connection sequences, you may use the "minicom" program. It is pretty
  136.   straight forward to use.
  137.  
  138.   2.1.  The basic configuration
  139.  
  140.   Configuration of the machine for use on the net should be done as user
  141.   "root".  Before proceeding any further, ensure that the file
  142.   "/etc/hosts.deny" contains the following line:
  143.  
  144.        ALL: ALL
  145.  
  146.   You would normally want to allow yourself, so add the following line
  147.   to "/etc/hosts.allow":
  148.  
  149.        ALL: 127.0.0.1
  150.  
  151.   For the following, note that it is meant for those connected via PPP
  152.   and with a dynamic IP address. If you have the benefit of a fixed con¡
  153.   nection, there will be some differences.
  154.  
  155.   It is nice to have a name connected to the machine, a name that the
  156.   dynamic IP user really can select as he or she pleases.  Put the name
  157.   in "/etc/HOSTNAME":
  158.  
  159.        roderick
  160.  
  161.   The next step is to set up the name server in "/etc/resolv.conf":
  162.  
  163.        search acme.com
  164.        nameserver 193.212.1.0
  165.  
  166.   The name server must be specified by a numeric IP address, and will be
  167.   different from ISP to ISP.  If required, you can have up to three dif¡
  168.   ferent servers.  They will be requested in the sequence in which they
  169.   are listed.  A "search" statement has been added to allow abbreviation
  170.   of names like "news.acme.com" to "news".
  171.  
  172.   A certain minimum of configuration will also be required in
  173.   "/etc/hosts".  Most users will be able to manage with:
  174.  
  175.        127.0.0.1 localhost
  176.        0.0.0.0   roderick
  177.  
  178.   Those with a fixed IP-address will obviously replace 0.0.0.0 with
  179.   this.
  180.  
  181.   Likewise, a minimum "/etc/networks" is:
  182.  
  183.        loopback  127.0.0.0
  184.        localnet  0.0.0.0
  185.  
  186.   The username and password at the ISP must be specified in
  187.   "/etc/ppp/pap-secrets"
  188.  
  189.        dirk * PrettySecret
  190.  
  191.   For those ISPs using CHAP instead of PAP, the filename is
  192.   "/etc/ppp/chap-secrets".
  193.  
  194.   Finally, the nitty gritty regarding the connection procedure itself
  195.   must be specified before PPP can be initiated. This is done in
  196.   "/etc/ppp/chatscript":
  197.  
  198.        TIMEOUT 5
  199.        \Z'\h'(u;\w'x'-\w'┤'/2)'┤'OK ATDT12345678
  200.        ABORT 'NO CARRIER'
  201.        ABORT BUSY
  202.        ABORT 'NO DIALTONE'
  203.        ABORT WAITING
  204.        TIMEOUT 45
  205.        CONNECT ""
  206.        TIMEOUT 5
  207.        "name:" ppp
  208.  
  209.   Details here may have to be tuned somewhat.  The phone number in the
  210.   third line must of course be set as required.  Some users may need to
  211.   replace the "ATZ" modem initialization string with something more tai¡
  212.   lored for the modem being used.  The last line specifies that one is
  213.   expecting the prompt "name:", and that the response should be "ppp"
  214.   when it arrives. Other systems may have other login procedures.
  215.  
  216.   To actually initiate a call, the PPP-protocol may be initiated by
  217.   issuing the following command:
  218.  
  219.   exec pppd connect \
  220.        'chat -v -f /etc/ppp/chatscript' \
  221.         -detach crtscts modem defaultroute \
  222.         user dirk \
  223.         /dev/modem 38400
  224.  
  225.   We should now be on-air, and stay up until the program is killed by
  226.   typing a Ctrl-C.  Any messages concerning the connection will be
  227.   appended to the system logs. To read them, try:
  228.  
  229.        trail /var/adm/messages
  230.  
  231.   As long as PPP is up, you will have direct access to the Internet, and
  232.   may use programs like ftp, ncftp, rlogin, telnet, finger etc.  All
  233.   these programs should be part of the network package.
  234.  
  235.   Further information concerning PPP is also available from:
  236.  
  237.   /usr/lib/ppp/README.linux
  238.  
  239.   /usr/lib/ppp/README.linux-chat
  240.  
  241.   Finally, an additional word about safety.  The file "/etc/inetd.conf"
  242.   lists all services that your machine will offer externally.  With the
  243.   "/etc/hosts.deny" file we have made, no external access will be
  244.   allowed.  For those who need it, access must be allowed explicitly in
  245.   "/etc/hosts.allow". Local traffic may be allowed by:
  246.  
  247.        ALL: LOCAL
  248.  
  249.   See also "man 5 hosts_access".
  250.  
  251.   A final little thing.  A certain confusion exists regarding the names
  252.   of the POP-protocols.  A definition in "/etc/services" compatible with
  253.   just about everything is:
  254.  
  255.        pop2      109/tcp   pop-2          # PostOffice V.2
  256.        pop3      110/tcp   pop-3 pop # PostOffice V.3
  257.  
  258.   ALT Instead of "chatscript", one might use the much more flexible
  259.   "dip". But not in connection with "diald".
  260.  
  261.   ALT Those lucky enough to have a permanent TCP/IP connection via e.g.
  262.   an Ethernet may safely ignore anything about PPP, and rather start
  263.   concentrating about setting up their network card.
  264.  
  265.   ALT Others may not have the possibility of using PPP, but may be able
  266.   to use SLIP instead, for which there is support in much the same
  267.   manner as for PPP. Another possibility is UUCP.  Others again may have
  268.   to rely on exchange of news and email be means of SOUP.  A description
  269.   for the latter case may be found in:
  270.   ftp://ftp.sn.no/user/bjorn/Linux-offline.tgz
  271.  
  272.   The TERM program is also an option. Refer to the "Term-HOWTO".
  273.  
  274.   3.  How do I "surf"?
  275.  
  276.   If you think that text is the most important, you might want to use
  277.   the Lynx Web-browser. It is available from:
  278.  
  279.   ftp://sunsite.unc.edu/pub/Linux/system/Network/info-
  280.   systems/lynx-2.3.bin2.tar.gz
  281.  
  282.   If you have installed X-windows, you can also use one of the many
  283.   graphical browsers. Chimera may be found at:
  284.  
  285.   ftp://sunsite.unc.edu/pub/Linux/system/Network/info-
  286.   systems/chimera-1.65.bin.ELF.tar.gz
  287.  
  288.   http://www.unlv.edu/chimera/
  289.  
  290.   Mosaic:
  291.  
  292.   ftp://sunsite.unc.edu/pub/Linux/system/Network/info-
  293.   systems/Mosaic-2.7b1-aout.tgz
  294.  
  295.   ftp://ftp.NCSA.uiuc.edu/Web/Mosaic/Unix/binaries/2.6
  296.  
  297.   Mozilla (Netscape):
  298.  
  299.   ftp://sunsite.unc.edu/pub/Linux/system/Network/info-systems/netscape-
  300.   v11b3.tar.gz
  301.  
  302.   ftp://ftp.cs.uit.no/pub/www/netscape
  303.  
  304.   These browsers are constantly available in new and in various ways
  305.   exciting versions.
  306.  
  307.   Use and evaluation of these programs is subject to certain terms.
  308.   Please observe them.
  309.  
  310.   4.  How do I send and receive email?
  311.  
  312.   First of all, ensure that "sendmail" is installed.  Sendmail sorts
  313.   internal and out-bound mail, and will buffer out-bound mail until such
  314.   time it is possible to forward it.
  315.  
  316.   Sendmail is based on a configuration found in "/etc/sendmail.cf".  An
  317.   example suitable for ISP users can be found in:
  318.  
  319.   ftp://ftp.sn.no/user/egilk/sendmail.cf
  320.  
  321.   It is if course required to have an official domain address for out-
  322.   bound mail, something which is specified in "/etc/sendmail.cf":
  323.  
  324.        # who I masquerade as (null for no masquerading)
  325.        DMacme.com
  326.  
  327.   Sendmail is now configured for sending directly to the recipient.  To
  328.   avoid long and repeated connections in those cases where the connec¡
  329.   tion to the receiving end is slow and irregular, is is usually nice to
  330.   use ones ISP as a buffer store.  This can be specified by the DS spec¡
  331.   ification:
  332.  
  333.        # "Smart" relay host (may be null)
  334.        DSmail.acme.com
  335.  
  336.   Beware that sendmail is somewhat sensitive to handling of tab stop
  337.   characters in "sendmail.cf". You might want to use the "vi" editor to
  338.   ensure that these tab characters are retained unchanged.
  339.  
  340.   Email reception can often be performed via the POP3 protocol, which
  341.   can be initiated every time the connection is brought up.  A script
  342.   for testing this is:
  343.  
  344.        sendmail -q
  345.        popclient -3 -v mail.acme.com -u dirk -p "PrettySecret" \
  346.               -k -o /usr/spool/mail/dirk 2> $HOME/pop.log
  347.  
  348.   This script may be started after PPP connection has been established.
  349.   Beware that this script is just for testing, so ensure that the local
  350.   mailbox is left untouched while it runs.  The "-k" option means that
  351.   the mail is kept in the ISP mailbox, and you are simply given a copy
  352.   of the mail.  You would of course want to remove this option once you
  353.   are confident that your setup is working.
  354.  
  355.   Beware that the password will show on the command line. This really
  356.   should be fixed ASAP.
  357.  
  358.   A safe and better version of this script may be found at:
  359.  
  360.   ftp://ftp.sn.no/user/egilk/pop-script.tar.gz
  361.  
  362.   This version of the script requires that "procmail" is installed, but
  363.   that is something you'll never regret anyway:
  364.  
  365.   ftp://sunsite.unc.edu/pub/Linux/system/Mail/mailhandlers/procmail-3.10-2.tar.gz
  366.  
  367.   Procmail is a simple and flexible tool that can sort incoming email
  368.   based on a large range of criteria. In addition to being able to
  369.   handle automated tasks like vacation messages and such.
  370.  
  371.   The user interface for reading and sending of email can be found in
  372.   programs like Pine or Elm.
  373.  
  374.   ALT For an ordinary dial-up ISP user it is not really necessary to
  375.   have the sendmail daemon active. To reduce the resource usage, one may
  376.   thus comment out any startup of sendmail, as is usually found in
  377.   "/etc/rc.d/rc.M".
  378.  
  379.   ALT In place of sendmail one might use the simpler "smail". You'll
  380.   find a good description of it (as well as most other things mentioned
  381.   here) in the "Linux Network Administrator's Guide".
  382.  
  383.   ALT There is also an m4 macro package for making a fresh
  384.   "sendmail.cf".  For a simple installation it might be just as well to
  385.   modify an existing configuration.
  386.  
  387.   ALT There are also simpler although less flexible alternatives. Pine
  388.   may run stand-alone as long as it is configured properly, for
  389.   instance. It might even be possible to use newer versions of some web-
  390.   browsers.
  391.  
  392.   ALT Many are very enthusiastic regarding the Emacs companion Gnus as
  393.   an email and news handler. Further information can be found at:
  394.  
  395.   http://www.ifi.uio.no/~larsi/
  396.  
  397.   ALT An alternative to popclient is "pop-perl5". It is available from:
  398.  
  399.   ftp://sunsite.unc.edu/pub/Linux/System/Mail/pop-perl5-1.1.tar.gz
  400.  
  401.   5.  News
  402.  
  403.   5.1.  How do I set up an online news-reader?
  404.  
  405.   As long as PPP is active, it will be possible to read news online.
  406.   There are several available programs. One can use the "rtin" or "trn",
  407.   one can configure "pine", or even use a WWW-browser.
  408.  
  409.   The only thing required in terms of configuration in most cases is to
  410.   do (usually once and for all in the file ".profile"):
  411.  
  412.        export NNTPSERVER=news.acme.com
  413.  
  414.   5.2.  How do I set up an offline news-reader?
  415.  
  416.   To be able to read news while offline, and thus reduce phone bills and
  417.   give greater flexibility, one must set up a local news-spool of one
  418.   sort or the other.  This requires some configuration, and there will
  419.   also be a certain amount of disk space involved.  After initial setup,
  420.   things should run more or less by themselves, with only some attention
  421.   needed from time to time.
  422.  
  423.   The solution described here is based on the news-server Cnews and the
  424.   NNTP protocol.  Cnews was originally targeted towards another sort of
  425.   configuration, but is flexible enough to handle our situation too.
  426.   One might also use the new and popular Inn news server, but it might
  427.   require a bit more in terms of resources.  Any way, be careful not to
  428.   install both; they don't live together easily.
  429.  
  430.   It is crucial that all maintenance of news is done while logged in as
  431.   user "news", and that all configuration files is placed in
  432.   "/usr/lib/news". One way of handling this is, while logged in as
  433.   "root" to write "su news; cd".
  434.  
  435.   The most important files in the configuration are:
  436.  
  437.   ╖  "active" is an overview over active newsgroups. It is updated as
  438.      required by the command addgroup, e.g. "addgroup
  439.      comp.os.linux.networking y".
  440.  
  441.   ╖  "organization" should simply contain whatever you want in the
  442.      "Organization:" header field, in our case:
  443.  
  444.   Dirk Gently's Holistic Detective Agency
  445.  
  446.   ╖  "mailname" should in our case be set to "acme.com".
  447.  
  448.   ╖  "whoami" is set to the name of your "site" in the "Path:" thread.
  449.      In a setup as described here, using "postit", this name will never
  450.      leave the machine, so you can set this to whatever you like as long
  451.      as you are pretty sure it is unique. In this case "roderick".
  452.  
  453.   ╖  "sys" controls fetching and further distribution of news.  We will
  454.      assume the ISP in our case adds "acme.com" to the Path, and that
  455.      this is the only news source we have.  The example given really
  456.      tells that we will accept everything that arrives, and that we will
  457.      only post news to "acme.com" that it hasn't seen before, and is
  458.      originally posted at our own site.  In this simplified setup we
  459.      assume that the decision about which newsgroups to really fetch is
  460.      done by "slurp" (see below).  "/all" specifies the distribution,
  461.      and must be included.  The letter "F" says that (pointers to)
  462.      outgoing news articles will be collected in a file.
  463.  
  464.        ME:all/all::
  465.        sn/acme.com:all,!junk/all:FL:
  466.  
  467.   ╖  A subdirectory for the outgoing news must be created, in our case:
  468.  
  469.        mkdir /var/spool/news/out.going/acme
  470.  
  471.   ╖  "mailpaths" controls posting in moderated groups, although this
  472.      task may usually be left to the ISP.
  473.  
  474.   Cnews needs a certain degree of daily maintenance, but this can be
  475.   specified once and for all via the command "crontab -e" issued as user
  476.   "news". A suggested setup follows; it can be tuned as required:
  477.  
  478.        # maintain incoming and outgoing batches
  479.        10,40 *  * * * /usr/lib/newsbin/input/newsrun
  480.  
  481.        # expire C-news, once a day
  482.        30 0  * * * /usr/lib/newsbin/expire/doexpire
  483.  
  484.        # monitor and report if needed
  485.        00 2  * * sat /usr/lib/newsbin/maint/addmissing
  486.        40 3  * * * /usr/lib/newsbin/maint/newswatch
  487.        50 3  * * * /usr/lib/newsbin/maint/newsdaily
  488.  
  489.   Newsrun moves articles in and out (twice every hour), doexpire will
  490.   delete articles as they get old (every night at 00:30), and the three
  491.   last commands does various supervisory and error correcting tasks.
  492.  
  493.   One should also ensure that things are cleaned up when starting the
  494.   machine. As user root, add the following line to "/etc/rc.d/rc.local":
  495.  
  496.        su news -c /usr/lib/newsbin/maint/newsboot
  497.  
  498.   News may be collected via the program "slurp", picking news from an
  499.   NNTP-server. The program can for instance be found at:
  500.  
  501.   ftp://sunsite.unc.edu/pub/Linux/apps/comm/slurp-1.10.tar.Z
  502.  
  503.   Setting up "slurp" is quite simple. The program itself may be copied
  504.   to til /usr/lib/news.  You should also create a
  505.   /usr/lib/news/slurp.sys that describes which newsgroups that you want
  506.   to read. A simple example, collecting all linux groups in addition to
  507.   rec.humor.funny:
  508.  
  509.        news.acme.com:comp.os.linux.*,rec.humor.funny
  510.  
  511.   Note that Slurp uses "*" instead of "all".
  512.  
  513.   Additionally, a file must be created for each news-server, in our case
  514.   "slurp.news.acme.com". The contents of this file reflects the latest
  515.   date/time that news have been collected, and will be updated for every
  516.   news batch.  The file must be initialized (initial date may be set as
  517.   desired):
  518.  
  519.        960101 000000
  520.  
  521.   To fetch articles, user "news" issues the following command (assuming
  522.   communication via PPP or similar is up):
  523.  
  524.        slurp news.acme.com
  525.  
  526.   The option "-d" gives continuous printout to the screen.
  527.  
  528.   Most ISPs will not allow posting of news by the NNTP IHAVE-procedure,
  529.   only POST. This requires special handling of news posting. A suitable
  530.   tool can be collected from:
  531.  
  532.   ftp://ftp.sn.no/user/egilk/postit.tar.gz
  533.  
  534.   Article transfer may then be performed by:
  535.  
  536.        postit news.acme.com acme
  537.  
  538.   To control disposal of articles as they get old, a file "explist" is
  539.   required.  The comments in this example should explain what we want to
  540.   do:
  541.  
  542.        # hold onto history lines 14 days, nobody gets >120 days
  543.        /expired/           x    14   -
  544.        /bounds/            x    0-1-120 -
  545.  
  546.        # retain these for 2 months
  547.        comp.sources,comp.os.linux.all     x    60   -
  548.  
  549.        # noise gets thrown away fast
  550.        junk,control             x    2    -
  551.  
  552.        # default:  14 days, no archive
  553.        all                 x    14   -
  554.  
  555.   ALT In a small news-spool, one will often not need the newsgroup
  556.   "control". The traffic is huge compared to the usefulness. The main
  557.   point is that articles will be canceled, and that groups may be
  558.   created automatically.  To ensure that control messages containing
  559.   "newgroup" not shall mess up things for us, a file called
  560.   "newgroupperm" specifies what we will allow:
  561.  
  562.        comp.os.linux  tale@uunet.com yv
  563.        all       any       nq
  564.  
  565.   In this example, all proper groups under comp.os.linux will be created
  566.   (y), and the user "news" will be notified (v).  Everything else will
  567.   be silently (q) ignored (n). The last line is sufficient if you want
  568.   to create all groups manually.
  569.  
  570.   ALT An alternative to slurp/postit is "suck", that is not using the
  571.   NNTP NEWNEWS command. This program is simple, although quite improved
  572.   compared to the earliest versions.  Version 2.51 will be replaced by
  573.   2.6:
  574.  
  575.   ftp://sunsite.unc.edu/pub/Linux/system/News/suck-2.5.1.tar.gz
  576.  
  577.   ALT A different solution altogether is to install the integrated
  578.   package "leafnode". This will handle all tasks required for a personal
  579.   news spool, and is easy to configure.  It is available from:
  580.  
  581.   http://www.troll.no/freebies/leafnode.html
  582.  
  583.   6.  How do I automate the connection procedure?
  584.  
  585.   Automated handling of news and email is quite easy to implement in
  586.   Linux.
  587.  
  588.   First and foremost one should make a "/usr/lib/ppp/ppp-on" that
  589.   initiates the ISP connection.  Often, this file will simply contain
  590.   the following:
  591.  
  592.        /usr/sbin/pppd
  593.  
  594.   Further specification will be performed in "/etc/ppp/options":
  595.  
  596.        connect "/usr/lib/ppp/chat -v -f /etc/ppp/chatscript"
  597.        crtscts
  598.        modem
  599.        defaultroute
  600.        asyncmap 00000000
  601.        user dirk
  602.        /dev/modem 38400
  603.  
  604.   To end a connection, use the supplied version of "/usr/lib/ppp/ppp-
  605.   off".
  606.  
  607.   Having tested the functionality of these two scripts, one must then
  608.   write scripts that perform the various tasks. The script to collect
  609.   email has been described before, and we will here assume it is located
  610.   at "/home/dirk/pop".
  611.  
  612.   A script for exchange of email can then be produced in "/root/mail":
  613.  
  614.        #! /bin/sh
  615.        #
  616.        # exchange mail
  617.        # 10 minutes timeout:
  618.        TIMEOUT=600
  619.        DT=10
  620.  
  621.        # kick sendmail:
  622.        sendmail -q &
  623.  
  624.        # retrieve mail:
  625.        su dirk -c /home/dirk/pop
  626.  
  627.        # wait for sendmail to terminate:
  628.        t=0
  629.        while ! mailq | grep -q "Mail queue is empty"; do
  630.            t=$[$t+$DT]
  631.            if [ $t -gt $TIMEOUT ] ; then
  632.             echo "sendmail -q timeout ($TIMEOUT).."
  633.             exit 1
  634.            fi
  635.            sleep $DT
  636.        done
  637.  
  638.        exit 0
  639.  
  640.   The script to exchange news may be placed in "/usr/lib/news/news":
  641.  
  642.   #!/bin/sh
  643.   #
  644.   # exchange news
  645.   # must be run as news:
  646.   cd /usr/lib/news
  647.  
  648.   #update the outgoing batch (Cnews):
  649.   /usr/lib/newsbin/input/newsrun <lt; /dev/null
  650.  
  651.   #send batched news:
  652.   /usr/lib/newsbin/postit news.acme.com acme
  653.  
  654.   #and get the new one:
  655.   slurp news.acme.com
  656.  
  657.   A script to connect the various bits and pieces remains, and can be
  658.   placed in "/root/news+mail":
  659.  
  660.        #!/bin/sh
  661.        #
  662.        # exchange news and email
  663.        # must be run as root
  664.        #
  665.        if ! /usr/lib/ppp/ppp-on; then
  666.            exit 1
  667.        fi
  668.        trap "/usr/lib/ppp/ppp-off" 1 2 3 15
  669.  
  670.        #exchange news+mail:
  671.        /root/mail &
  672.        su news -c ~news/news
  673.        wait
  674.  
  675.        #disconnect..
  676.        /usr/lib/ppp/ppp-off
  677.  
  678.        #update the incoming batch (Cnews):
  679.        su news -c /usr/lib/newsbin/input/newsrun <lt; /dev/null &
  680.  
  681.        exit 0
  682.  
  683.   It is quite easy to make an extension to the above that only will
  684.   establish a connection if outgoing email and news is present.  Lets
  685.   call it "/root/news+mail.cond", and keep in mind that the name of the
  686.   outgoing news-spool must be updated to suit:
  687.  
  688.        #!/bin/sh
  689.        #
  690.        # exchange news and email, only if outgoing news or mail
  691.        # (Cnews spool)
  692.        if [ -s /var/spool/news/out.going/acme/togo ] ||
  693.            ! ( mailq | grep -q "Mail queue is empty"); then
  694.             /root/news+mail
  695.        fi
  696.  
  697.   The only thing remaining is to specify when all this is going to
  698.   happen.  This is done using the command "crontab -e" as root. Let us
  699.   assume that we always want to exchange news and mail at 07:00 in the
  700.   morning, and after that every 4th hour assuming there are outgoing
  701.   email and news:
  702.  
  703.        00 7      * * *     /root/news+mail
  704.        00 11,15,19,23 * * *     /root/news+mail.cond
  705.  
  706.   Ensure that every component is tested well before you connect them
  707.   together. One may later add several other tasks, such as adjustment of
  708.   the time of day (using ntpdate), and automatic update (mirroring) of
  709.   locally maintained WWW and FTP files up to the ISP (using make and
  710.   ftp).
  711.  
  712.   ALT Depending on ones preferences, it is also possible to turn the
  713.   process upside down. Every time a PPP link is initiated, the script
  714.   "/etc/ppp/ip-up" will be started. One may here add whatever magic is
  715.   required to start exchange of email and news. See "man pppd" for
  716.   further detail.
  717.  
  718.   ALT It is also possible to automatically connect PPP whenever network
  719.   traffic is detected.  This is in many ways the more elegant solution,
  720.   but it is quite dependent on a good configuration to avoid frequent
  721.   (and costly) connections being made.  More information can be found
  722.   at:
  723.  
  724.   http://www.cs.toronto.edu/~schenk/diald.html
  725.  
  726.   The "diald" utility is available from:
  727.  
  728.   ftp://sunsite.unc.edu/pub/Linux/system/Network/serial/diald-0.13.tar.gz
  729.  
  730.   At the same location one will also find other variations on PPP
  731.   connections.
  732.  
  733.   7.  Final words
  734.  
  735.   7.1.  Other things I should know about?
  736.  
  737.   ╖  Various error messages in the system will normally be issued as
  738.      internal email. To ensure that these will actually be read, one
  739.      should create an "/etc/aliases". Remember the command "newaliases"
  740.      every time you change this. An example that should cover most
  741.      eventualities is:
  742.  
  743.        PostMaster: root
  744.        ftp: root
  745.        news: root
  746.        usenet: root
  747.        FaxMaster: root
  748.        fax: root
  749.        WebMaster: root
  750.        MAILER.DAEMON: root
  751.  
  752.   ╖  Many programs for Linux may be found at "Sunsite", which is usually
  753.      quite busy. But there are many mirrors, and every time there is a
  754.      reference to "ftp://sunsite.unc.edu/pub/Linux/.."  one should try
  755.      to use a mirror close to home, e.g.
  756.      "ftp://ftp.nvg.unit.no/pub/linux/sunsite/.."
  757.  
  758.   ╖  If you happen to be migrating from Yarn, it should be possible to
  759.      convert these to standard folders using the "yarn2mf" available at:
  760.  
  761.   ftp://ftp.sn.no/user/egilk/yarn2mf.zip
  762.  
  763.   7.2.  How do I learn more?
  764.  
  765.   The Linux Documentation Project book called Linux Network
  766.   Administrator's Guide by Olaf Kirch is pretty mandatory for anyone
  767.   that will set up and maintain anything involving TCP/IP and Internet:
  768.  
  769.   ftp://sunsite.unc.edu/pub/Linux/docs/linux-doc-project/network-
  770.   guide/nag-1.0.ascii.tar.gz
  771.  
  772.   The documentation that follows each software package will normally
  773.   give you all the detailed information you need, if not always the
  774.   overview. The man-pages will be the first place to look. Try for
  775.   instance:
  776.  
  777.        man pppd
  778.  
  779.   You will also find some documentation about certain programs in the
  780.   "/usr/doc" tree, although this is not always well structured.
  781.  
  782.   The following HOWTOs will be highly relevant:
  783.  
  784.   ╖  Installation-HOWTO will get the basics sorted.
  785.  
  786.   ╖  NET-2-HOWTO is a very thorough description of installation and
  787.      setup of the NET code. Much of this should already have been done
  788.      if you use a standard Linux distribution (e.g. Slackware, RedHat,
  789.      Debian). But many sections on setup and troubleshooting will be
  790.      very worthwhile.
  791.  
  792.   ╖  Mail-HOWTO explains how to configure various tools. Again, much of
  793.      this will already have been done for you when you install a
  794.      standard Linux distribution.
  795.  
  796.   ╖  News-HOWTO is for setting up a (conventional) news spool.
  797.  
  798.   ╖  Tiny-News covers yet an alternative to "slurp" of picking up news.
  799.  
  800.   ╖  PPP-HOWTO is a good description of problems you may encounter when
  801.      setting up a PPP connection.
  802.  
  803.   ╖  Serial-HOWTO contains everything you need to know about setting up
  804.      serial ports.
  805.  
  806.   7.3.  Thanks to
  807.  
  808.   Information here is collected from many sources. Thanks to the
  809.   following that either indirectly or directly have contributed:
  810.        Arne Coucheron      arneco@oslonett.no
  811.        Arne Riiber         riiber@oslonett.no
  812.        Arnt Gulbrandsen    agulbra@troll.no
  813.        Bjorn Steensrud     bjorn@oslonett.no
  814.        Gisle Hannemyr      gisle@a.sn.no
  815.        Hans Amund Rosbach  haro@sesam.dnv.no
  816.        Hans Peter Verne    hpv@ulrik.uio.no
  817.        Harald T Alvestrand Harald.T.Alvestrand@uninett.no
  818.        Haavard Engum       hobbes@interlink.no
  819.        Jorn Lokoy          jorn@oslonett.no
  820.        Kenneth Tjostheim   kenneth.tjostheim@asplanviak.no
  821.        Kjell M. Myksvoll   kjell.myksvoll@fou.telenor.no
  822.        Kjetil T. Homme     kjetilho@math.uio.no
  823.        Nicolai Langfeldt   janl@math.uio.no
  824.        Ove Ruben R Olsen   Ove.R.Olsen@ub.uib.no
  825.        Steinar Fremme      steinar@fremme.no
  826.        Sverre H. Huseby    sverrehu@ifi.uio.no
  827.        Trond Eivind Glomsrod    teg@stud.imf.unit.no
  828.        Tommy Larsen        tommy@mix.hive.no
  829.  
  830.