ISP-Hookup-HOWTO <author>Egil Kvaleberg, <tt>egil@kvaleberg.no</tt> <date>v1.26, 5 March 1998 <abstract> This document describes how to use Linux to connect to an Internet Service Provider via a dial-up modem <idx>TCP/IP</idx> connection. As well as the basic dial-up procedure and <idx>IP</idx> establishment, email and news handling is covered. </abstract> <toc> <p> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <sect> Introduction <p> This description has been made to answer a few questions about how <idx>dial-up</idx> <idx>ISP</idx> (Internet Service Provider) subscribers may configure and use Linux. <p> To aid those who will connect their Linux based machines to an ISP for the first time, an attempt has been made to cover most issues encountered. This quite unavoidably will create a certain degree of overlap with other Linux Howto-documents and <idx>LDP</idx> books. Reference should be made to these documents to provide better understanding and detail. <p> Much of the existing documentation is targeted towards users with a certain degree of experience, and first time users will often have trouble sorting out the relevant information. <p> To simplify, the examples given will assume the following: <p> <itemize> <item> User name: <tt><cdx>dirk</cdx></tt> <item> Password: <tt><cdx>PrettySecret</cdx></tt> <item> Internet service provider: <tt><cdx>acme.xz</cdx></tt> <item> Email server: <tt><cdx>mail.acme.xz</cdx></tt> <item> News server: <tt><cdx>news.acme.xz</cdx></tt> <item> Name server: <tt>193.212.1.0</tt> <item> Phone number: <tt>12345678</tt> </itemize> <p> Our <tt>dirk</tt> will be calling his machine <tt>roderick</tt>. <nidx>roderick</nidx> <p> All references in the table above should naturally be replaced by whatever is valid for the ISP one is using. Often, just a minimum of changes will otherwise be required for users with different ISPs. I would like to be informed about what problems you encounter on this account. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <sect1> Copyright <p> Copyright (c) 1996,1997,1998 by Egil Kvaleberg. This document may be distributed under the terms set forth in the LDP license at <p> <tt> <htmlurl url="http://sunsite.unc.edu/LDP/COPYRIGHT.html" name="http://sunsite.unc.edu/LDP/COPYRIGHT.html"></tt> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <sect1> Disclaimer <p> <bf></bf> No liability for the contents of this documents can be accepted. Use the concepts, examples and other content at your own risk. <p> One of many possible setups will be described. In the Linux world, there is usually a number of ways in which to accomplish things. Paragraphs containing hints to alternatives are marked by <bf><idx>ALT:</idx></bf> Please also note that FTP-references often will change slightly as new versions of programs arrive. <p> As far as I know, only programs that under certain terms may be used or evaluated for personal purposes will be described. Most of the programs will be available complete with source under GNU-like terms. <nidx>GNU</nidx> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <sect1> Translations <p> This document has been translated to the following languages: <p> German, by Cristoph Seibert: <p> <tt> <htmlurl url="http://tech.appl-opt.physik.uni-essen.de/LinuX/german-howto/DE-ISP-Verbindung-HOWTO.html" name="http://tech.appl-opt.physik.uni-essen.de/LinuX/german-howto/DE-ISP-Verbindung-HOWTO.html"></tt> <p> Korean, by Kidong Lee: <p> <tt> <htmlurl url="http://www.postech.ac.kr/~cessi/howto/ISP-Hookup/ISP-Hookup-HOWTO.html" name="http://www.postech.ac.kr/~cessi/howto/ISP-Hookup/ISP-Hookup-HOWTO.html"></tt> <p> French, by Eric Jacoboni: <p> <tt> <htmlurl url="http://www.minet.net/linux/HOWTO-fr/ISP-Hookup-HOWTO.html" name="http://www.minet.net/linux/HOWTO-fr/ISP-Hookup-HOWTO.html"></tt> <p> Polish, by Piotr Pogorzelski: <bf>URL TBA</bf> <p> Norwegian: <p> <tt> <htmlurl url="http://www.kvaleberg.com/no-linux.html" name="http://www.kvaleberg.com/no-linux.html"></tt> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <sect1> New versions of this document <p> New versions of this document will be periodically posted to <it>comp.os.linux.answers</it>. They will also be added to the various anonymous FTP sites who archive such information, including: <p> <tt> <htmlurl url="ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO" name="ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO"></tt> <nidx>sunsite</nidx> <p> In addition, you should generally be able to find this document on the Linux Documentation Project page via: <p> <tt> <htmlurl url="http://sunsite.unc.edu/LDP/" name="http://sunsite.unc.edu/LDP/"></tt> <nidx>LDP</nidx> <p> The very latest version of this document should also be available in various formats from: <p> <tt> <htmlurl url="ftp://ftp.sol.no/user/egilk/ISP-Hookup-HOWTO.txt" name="ftp://ftp.sol.no/user/egilk/ISP-Hookup-HOWTO.txt"></tt> <p> <tt> <htmlurl url="ftp://ftp.sol.no/user/egilk/ISP-Hookup-HOWTO.ps.gz" name="ftp://ftp.sol.no/user/egilk/ISP-Hookup-HOWTO.ps.gz"></tt> <p> <tt> <htmlurl url="ftp://ftp.sol.no/user/egilk/ISP-Hookup-HOWTO.tar.gz" name="ftp://ftp.sol.no/user/egilk/ISP-Hookup-HOWTO.tar.gz"></tt> <p> <tt> <htmlurl url="http://www.kvaleberg.com/ISP-Hookup-HOWTO.html" name="http://www.kvaleberg.com/ISP-Hookup-HOWTO.html"></tt> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <sect1> Feedback <p> All comments, error reports, additional information and criticism of all sorts should be directed to: <p> <tt> <htmlurl url="mailto:egil@kvaleberg.no" name="egil@kvaleberg.no"></tt> <p> <tt> <htmlurl url="http://www.kvaleberg.com/" name="http://www.kvaleberg.com/"></tt> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <sect> How do I connect to the rest of the world? <p> It will be assumed that we have installed the essential networking software modules from your Linux distribution, and that you have set up which serial port that is to be used for the <ncdx>/dev/modem</ncdx> <file>/dev/modem</file>. <p> The default configuration will usually only allow direct access to <file>/dev/modem</file> as user <tt><cdx>root</cdx></tt>. <p> To connect to ISP shell accounts directly, and to experiment with connection sequences, you may use the <ncdx>minicom</ncdx> <file>minicom</file> program. It is pretty straight forward to use. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <sect1> The basic configuration <p> Configuration of the machine for use on the net should be done as user <tt>root</tt>. Before proceeding any further, ensure that the file <ncdx>/etc/hosts.deny</ncdx> <file>/etc/hosts.deny</file> contains the following line: <tscreen><verb> ALL: ALL </verb></tscreen> You would normally want to allow yourself, so add the following line to <ncdx>/etc/hosts.allow</ncdx> <file>/etc/hosts.allow</file>: <tscreen><verb> ALL: LOCAL </verb></tscreen> Or if you insist: <tscreen><verb> ALL: 127.0.0.1 </verb></tscreen> For the following, note that it is meant for those connected via <idx>PPP</idx> and with a <idx>dynamic IP</idx> address. If you have the benefit of a fixed connection, there will be some differences. <p> It is nice to have a name connected to the machine, a name that the dynamic IP user really can select as he or she pleases. Put the name in <ncdx>/etc/HOSTNAME</ncdx> <file>/etc/HOSTNAME</file>: <tscreen><verb> roderick </verb></tscreen> <p> The next step is to set up the name server in <ncdx>/etc/resolv.conf</ncdx> <file>/etc/resolv.conf</file>: <tscreen><verb> search . nameserver 193.212.1.0 </verb></tscreen> <nidx>nameserver</nidx> The <idx>name server</idx> must be specified by a numeric IP address, and will be different from ISP to ISP. If required, you can have up to three different servers, each on a separate line. They will be requested in the sequence in which they are listed. <p> If you want to be able to use names like <tt>somemachine</tt> as an abbreviation for <tt>somemachine.acme.xz</tt>, you must replace the first line with: <tscreen><verb> search acme.xz </verb></tscreen> <nidx>search</nidx> <p> A certain minimum of configuration will also be required in <ncdx>/etc/hosts</ncdx> <file>/etc/hosts</file>. Most users will be able to manage with: <tscreen><verb> 127.0.0.1 localhost 0.0.0.0 roderick </verb></tscreen> <nidx>localhost</nidx> Those with a fixed IP-address will obviously replace 0.0.0.0 with that. <p> Likewise, a minimum <ncdx>/etc/networks</ncdx> <file>/etc/networks</file> is: <tscreen><verb> loopback 127.0.0.0 localnet 0.0.0.0 </verb></tscreen> <nidx>loopback</nidx> <nidx>localnet</nidx> <p> You should also set your external mail domain in <ncdx>/etc/mailname</ncdx> <file>/etc/mailname</file>: <tscreen><verb> acme.xz </verb></tscreen> <p> The username and password at the ISP must be specified in <ncdx>/etc/ppp/pap-secrets</ncdx> <file>/etc/ppp/pap-secrets</file> <tscreen><verb> dirk * PrettySecret </verb></tscreen> <p> For those ISPs using <idx>CHAP</idx> instead of <idx>PAP</idx> the filename is <ncdx>/etc/ppp/chap-secrets</ncdx> <file>/etc/ppp/chap-secrets</file>. <p> Finally, the nitty gritty regarding the connection procedure itself must be specified before PPP can be initiated. This is done in <ncdx>/etc/ppp/chatscript</ncdx> <file>/etc/ppp/chatscript</file>: <tscreen><verb> TIMEOUT 5 "" ATZ OK ATDT12345678 ABORT "NO CARRIER" ABORT BUSY ABORT "NO DIALTONE" ABORT WAITING TIMEOUT 45 CONNECT "" TIMEOUT 5 "name:" ppp </verb></tscreen> <nidx>OK</nidx> <nidx>ATDT</nidx> <nidx>ATZ</nidx> <nidx>TIMEOUT</nidx> <nidx>ABORT</nidx> <nidx>CONNECT</nidx> Details here may have to be tuned somewhat. The phone number in the third line must of course be set as required. Some users may need to replace the <tt>ATZ</tt> modem initialization string with something more tailored for the modem being used. The last line specifies that one is expecting a prompt that ends with <tt>name:</tt>, and that the response should be <tt><cdx>ppp</cdx></tt> when it arrives. Other systems may have other login procedures. <p> To actually initiate a call, the <idx>PPP</idx> protocol may be initiated by issuing the following command: <tscreen><verb> exec pppd connect \ 'chat -v -f /etc/ppp/chatscript' \ -detach crtscts modem defaultroute \ user dirk \ /dev/modem 38400 </verb></tscreen> <nidx>pppd</nidx> <nidx>chat</nidx> <nidx>connect</nidx> <nidx>/etc/ppp/chatscript</nidx> <nidx>detach</nidx> <nidx>crtscts</nidx> <nidx>modem</nidx> <nidx>defaultroute</nidx> <nidx>/dev/modem</nidx> We should now be on-air, and stay up until the program is killed by typing a ctrl-C. <nidx>ctrl- C</nidx> Any messages concerning the connection will be appended to the system logs. To read them, try: <tscreen><verb> tail /var/adm/messages </verb></tscreen> <nidx>tail</nidx> <nidx>/var/adm/messages</nidx> or <tscreen><verb> dmesg </verb></tscreen> <nidx>dmesg</nidx> <p> As long as PPP is up, you will have direct access to the <idx>Internet</idx> and may use programs like <file>ftp</file>, <file>ncftp</file>, <file>rlogin</file>, <file>telnet</file>, <file>finger</file> etc. All these programs should be part of the network package. <p> Further information concerning PPP is also available from: <p> <tt> <htmlurl url="file:/usr/lib/ppp/README.linux" name="/usr/lib/ppp/README.linux"></tt> <p> <tt> <htmlurl url="file:/usr/lib/ppp/README.linux-chat" name="/usr/lib/ppp/README.linux-chat"></tt> <p> Finally, an additional word about <idx>security</idx> The file <ncdx>/etc/inetd.conf</ncdx> <file>/etc/inetd.conf</file> lists all services that your machine will offer externally. With the <ncdx>/etc/hosts.deny</ncdx> <file>/etc/hosts.deny</file> file we have made, no external access will be allowed. For those who need it, access must be allowed explicitly in <ncdx>/etc/hosts.allow</ncdx> <file>/etc/hosts.allow</file>. Local traffic may be allowed by: <tscreen><verb> ALL: LOCAL </verb></tscreen> See also <tt>man 5 hosts_access</tt>. <nidx>hosts_access</nidx> <p> A final minor issue: A certain confusion exists regarding the names of the <idx>POP</idx> protocols. A definition in <ncdx>/etc/services</ncdx> <file>/etc/services</file> compatible with just about everything is: <tscreen><verb> pop2 109/tcp pop-2 # PostOffice V.2 pop3 110/tcp pop-3 pop # PostOffice V.3 </verb></tscreen> <p> <bf>ALT:</bf> Instead of <ncdx>chatscript</ncdx> <file>chatscript</file>, one might use the much more flexible <ncdx>dip</ncdx> <file>dip</file>. But not in connection with <ncdx>diald</ncdx> <file>diald</file>. <p> <bf>ALT:</bf> Those fortunate enough to have a permanent <idx>TCP/IP</idx> connection via e.g. an <idx>Ethernet</idx> may safely ignore anything about <idx>PPP</idx> and rather start concentrating about setting up their network card. <p> <bf>ALT:</bf> Others may not have the possibility of using PPP, but may be able to use <idx>SLIP</idx> instead, for which there is support in much the same manner as for PPP. Another possibility is <idx>UUCP</idx> Others again may have to rely on exchange of news and email be means of <idx>SOUP</idx> A description for the latter case may be found in: <p> <tt> <htmlurl url="ftp://ftp.sol.no/user/bjorn/Linux-offline.tgz" name="ftp://ftp.sol.no/user/bjorn/Linux-offline.tgz"></tt> <p> The <idx>TERM</idx> program is also an option. Refer to the <it>Term-HOWTO</it>. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <sect> How do I <it>surf</it>? <p> If you think that text is the most important, you might want to use the <idx>Lynx</idx> web browser. It is available from: <p> <tt> <htmlurl url="ftp://sunsite.unc.edu/pub/Linux/system/Network/info-systems/lynx-2.3.bin2.tar.gz" name="ftp://sunsite.unc.edu/pub/Linux/system/Network/info-systems/lynx-2.3.bin2.tar.gz"></tt> <p> If you have installed the <idx>X</idx> window system, you can also use one of the many graphical browsers. <idx>Chimera</idx> may be found at: <p> <tt> <htmlurl url="ftp://sunsite.unc.edu/pub/Linux/system/Network/info-systems/chimera-1.65.bin.ELF.tar.gz" name="ftp://sunsite.unc.edu/pub/Linux/system/Network/info-systems/chimera-1.65.bin.ELF.tar.gz"></tt> <p> <tt> <htmlurl url="http://www.unlv.edu/chimera/" name="http://www.unlv.edu/chimera/"></tt> <p> <idx>Mosaic</idx> <p> <tt> <htmlurl url="ftp://sunsite.unc.edu/pub/Linux/system/Network/info-systems/Mosaic-2.7b1-aout.tgz" name="ftp://sunsite.unc.edu/pub/Linux/system/Network/info-systems/Mosaic-2.7b1-aout.tgz"></tt> <p> <tt> <htmlurl url="ftp://ftp.NCSA.uiuc.edu/Web/Mosaic/Unix/binaries/2.6" name="ftp://ftp.NCSA.uiuc.edu/Web/Mosaic/Unix/binaries/2.6"></tt> <p> <idx>Netscape</idx> (aka. <idx>Mozilla</idx> <p> <tt> <htmlurl url="ftp://sunsite.unc.edu/pub/Linux/system/Network/info-systems/netscape-v11b3.tar.gz" name="ftp://sunsite.unc.edu/pub/Linux/system/Network/info-systems/netscape-v11b3.tar.gz"></tt> <p> <tt> <htmlurl url="ftp://ftp.cs.uit.no/pub/www/netscape" name="ftp://ftp.cs.uit.no/pub/www/netscape"></tt> <p> These browsers are constantly available in new and in various ways <it>exciting</it> versions. <p> Use and evaluation of these programs is subject to certain terms. Please observe them. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <sect> How do I send and receive <idx>email</idx> <p> First of all, ensure that <ncdx>sendmail</ncdx> <file>sendmail</file> is installed. Sendmail sorts internal and out-bound mail, and will buffer out-bound mail until such time it is possible to forward it. <p> Sendmail is based on a configuration found in <ncdx>/etc/sendmail.cf</ncdx> <file>/etc/sendmail.cf</file>. An example suitable for ISP users can be found in: <p> <tt> <htmlurl url="ftp://ftp.sol.no/user/egilk/sendmail.cf" name="ftp://ftp.sol.no/user/egilk/sendmail.cf"></tt> This is based on <ncdx>procmail</ncdx> <file>procmail</file> as a <idx>delivery agent</idx> but may easily be changed to use <ncdx>deliver</ncdx> <file>deliver</file>. <p> It is if course required to have an <bf>official</bf> <idx>domain address</idx> for out-bound mail, something which is specified in <ncdx>sendmail.cf</ncdx> <file>sendmail.cf</file>: <tscreen><verb> # who I masquerade as (null for no masquerading) DMacme.xz </verb></tscreen> <nidx>DM</nidx> <nidx>masquerading</nidx> This assumes that you have the same user name locally as you have at your ISP. If it is different, just specify the full name instead: <tscreen><verb> DMdick@acme.xz </verb></tscreen> Sendmail is now configured for sending <bf>directly</bf> to the recipient. To avoid long and repeated connections in those cases where the connection to the receiving end is slow and irregular, it is usually nice to use ones ISP as a buffer store. This can be specified by the <idx>DS</idx> specification: <tscreen><verb> # "Smart" relay host (may be null) DSmail.acme.xz </verb></tscreen> Beware that sendmail is somewhat sensitive to handling of tab stop characters in <ncdx>sendmail.cf</ncdx> <file>sendmail.cf</file>. You might want to use the <ncdx>vi</ncdx> <file>vi</file> editor to ensure that these tab characters are retained unchanged. <p> Email reception can often be performed via the <idx>POP3</idx> protocol, which can be initiated every time the connection is brought up. A script for testing this is: <tscreen><verb> sendmail -q popclient -3 -v mail.acme.xz -u dirk -p "PrettySecret" \ -k -o /usr/spool/mail/dirk </verb></tscreen> <nidx>popclient</nidx> This script may be started after PPP connection has been established. Beware that this script is just for testing, so ensure that the local mailbox is left untouched while it runs. The <tt>-k</tt> option means that the mail is <bf>kept</bf> in the ISP mailbox, and you are simply given a copy of the mail. You would of course want to remove this option once you are confident that your setup is working. <p> Beware that the password will show on the command line. Also note that popclient is getting old fashioned, and that you should consider using <ncdx>fetchmail</ncdx> <file>fetchmail</file> instead. <p> A more secure and better version of this script may be found at: <p> <tt> <htmlurl url="ftp://ftp.sol.no/user/egilk/pop-script.tar.gz" name="ftp://ftp.sol.no/user/egilk/pop-script.tar.gz"></tt> <p> This version of the script requires that <ncdx>procmail</ncdx> <file>procmail</file> is installed, but that is something you'll never regret anyway. Most distributions include it, otherwise you may try: <p> <tt> <htmlurl url="ftp://sunsite.unc.edu/pub/Linux/system/Mail/mailhandlers/procmail-3.10-2.tar.gz" name="ftp://sunsite.unc.edu/pub/Linux/system/Mail/mailhandlers/procmail-3.10-2.tar.gz"></tt> <p> Procmail is a simple and flexible tool that can sort incoming email based on a large range of criteria. In addition to being able to handle automated tasks like <idx>vacation</idx> messages and such. <p> Note that when we use procmail directly as in this case, the situation is somewhat different from what is described in the procmail documentation. A <file>.forward</file> is <bf>not</bf> required, and we also don't need a <file>.procmailrc</file>. The latter is only required if we want to sort the mail. <p> The user interface for reading and sending of email can be found in programs like <ncdx>pine</ncdx> <file>pine</file> or <ncdx>elm</ncdx> <file>elm</file>. <p> <bf>ALT:</bf> <idx>Fetchmail</idx> has recently become an improved alternative to popclient. The latest version is available from: <p> <tt> <htmlurl url="ftp://ftp.ccil.org/pub/esr/fetchmail/fetchmail-3.3.tar.gz" name="ftp://ftp.ccil.org/pub/esr/fetchmail/fetchmail-3.3.tar.gz"></tt> <p> <bf>ALT:</bf> For an ordinary dial-up ISP user it is not really necessary to have the <idx>sendmail</idx> <idx>daemon</idx> active. To reduce resource usage, and possibly other problems, one may thus comment out any startup of sendmail, as is usually found in <file>/etc/rc.d/rc.M</file> (this varies from distribution to distribution). <p> <bf>ALT:</bf> In place of sendmail one might use the simpler <ncdx>smail</ncdx> <file>smail</file>. You'll find a good description of it (as well as most other things mentioned here) in the <it>Linux Network Administrator's Guide</it>. <p> <bf>ALT:</bf> There is also an <file>m4</file> macro package for making a fresh <ncdx>/etc/sendmail.cf</ncdx> <file>/etc/sendmail.cf</file>. For a simple installation it might be just as well to modify an existing configuration. <p> <bf>ALT:</bf> There are also simpler although less flexible alternatives for handling email. <idx>Pine</idx> may run stand-alone as long as it is configured properly, for instance. It might even be possible to use newer versions of some web-browsers. <p> <bf>ALT:</bf> Many are very enthusiastic regarding the Emacs companion <idx>Gnus</idx> as an email and news handler. Further information can be found at: <p> <tt> <htmlurl url="http://www.ifi.uio.no/~larsi/" name="http://www.ifi.uio.no/~larsi/"></tt> <p> <bf>ALT:</bf> An alternative to <file>popclient</file> is <file>pop-perl5</file>. It is available from: <p> <tt> <htmlurl url="ftp://sunsite.unc.edu/pub/Linux/System/Mail/pop-perl5-1.1.tar.gz" name="ftp://sunsite.unc.edu/pub/Linux/System/Mail/pop-perl5-1.1.tar.gz"></tt> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <sect> News <sect1> How do I set up an online news-reader? <p> <nidx>news-reader</nidx> As long as PPP is active, it will be possible to read <idx>news</idx> <bf>online</bf>. There are lots of available programs, two simple alternatives being <ncdx>rtin</ncdx> <file>rtin</file> and <ncdx>trn</ncdx> <file>trn</file>. <p> To start reading news, the only thing required in terms of configuration in most cases is to set <idx>NNTPSERVER</idx> (usually once and for all in the file <ncdx>.profile</ncdx> <file>.profile</file>): <tscreen><verb> export NNTPSERVER=news.acme.xz </verb></tscreen> <p> To get the <it>From</it>-address correct in postings, some programs <it>may</it> require: <tscreen><verb> export NNTP_INEWS_DOMAIN=acme.xz </verb></tscreen> <nidx>NNTP_INEWS_DOMAIN</nidx> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <sect1> How do I set up an offline news-reader? <p> <nidx>news-reader</nidx> To be able to read <idx>news</idx> while <idx>offline</idx> and thus reduce phone bills and give greater flexibility, one must set up a local <idx>news-spool</idx> of one sort or the other. This requires some configuration, and there will also be a certain amount of disk space involved. After initial setup, things should run more or less by themselves, with only some attention needed from time to time. <p> Two different solutions will be described here. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <sect1> How do I set up C News? <p> The solution described here is based on the news-server <bf><idx>C News</idx></bf> and the <idx>NNTP</idx> protocol. <idx>C News</idx> was originally targeted towards another sort of configuration, but is flexible enough to handle our situation too. One might also use the more recent <bf><idx>INN</idx></bf> <idx>news server</idx> but it might require a bit more in terms of resources. Either way, be careful <bf>not</bf> to install both; they don't live together easily. <p> It is crucial that all maintenance of news is done while logged in as user <tt><cdx>news</cdx></tt>, and that all configuration files is placed in <ncdx>/usr/lib/news</ncdx> <file>/usr/lib/news</file>. One way of handling this is, while logged in as <tt><cdx>root</cdx></tt> to write <tt>su news; cd</tt>. <p> The most important files in the configuration are: <p> <itemize> <item> <ncdx>active</ncdx> <file>active</file> is an overview over active newsgroups. It is updated as required by the command <ncdx>addgroup</ncdx> <file>addgroup</file>, e.g. <tt>addgroup comp.os.linux.networking y</tt>. <item> <ncdx>organization</ncdx> <file>organization</file> should simply contain whatever you want in the <it>Organization:</it> header field, in our case: </itemize> <tscreen><verb> Dirk Gently's Holistic Detective Agency </verb></tscreen> <p> <itemize> <item> <ncdx>mailname</ncdx> <file>mailname</file> should in our case be set to <tt>acme.xz</tt>. <item> <ncdx>whoami</ncdx> <file>whoami</file> is set to the name of your <tt><cdx>site</cdx></tt> in the <idx>Path:</idx> thread. In a setup as described here, using <ncdx>newsx</ncdx> <file>newsx</file>, this name will never leave the machine, so you can set this to whatever you like as long as you are pretty sure it is unique. In this case <tt>roderick</tt>. <item> The file <ncdx>sys</ncdx> <file>sys</file> controls fetching and further distribution of news. We will assume the ISP in our case adds <tt>acme.xz</tt> to the Path, and that this is the only news source we have. The example given really tells that we will accept everything that arrives, and that we will only post news to <tt>acme.xz</tt> that it hasn't seen before, and is originally posted at our own site. In this simplified setup we assume that the all groups will come from a single source. <tt><cdx>/all</cdx></tt> specifies the distribution, and <bf>must</bf> be included. The letter <tt><cdx>F</cdx></tt> says that (pointers to) outgoing news articles will be collected in a file. </itemize> <tscreen><verb> ME:all/all:: acme/acme.xz:all,!junk/all:FL: </verb></tscreen> <p> <itemize> <item> A subdirectory for the outgoing news must be created, in our case: </itemize> <tscreen><verb> mkdir /var/spool/news/out.going/acme </verb></tscreen> <p> <itemize> <item> <ncdx>mailpaths</ncdx> <file>mailpaths</file> controls posting in moderated groups, although this task may usually be left to the ISP. </itemize> <p> C News needs a certain degree of daily maintenance, but this can be specified once and for all via the command <tt>crontab -e</tt> <nidx>crontab</nidx> issued as user <tt>news</tt>. A suggested setup follows; it can be tuned as required: <tscreen><verb> # maintain incoming and outgoing batches 10,40 * * * * /usr/lib/newsbin/input/newsrun # expire C News, once a day 30 0 * * * /usr/lib/newsbin/expire/doexpire # monitor and report if needed 00 2 * * sat /usr/lib/newsbin/maint/addmissing 40 3 * * * /usr/lib/newsbin/maint/newswatch 50 3 * * * /usr/lib/newsbin/maint/newsdaily </verb></tscreen> <ncdx>newsrun</ncdx> <file>newsrun</file> moves articles in and out (twice every hour), <ncdx>doexpire</ncdx> <file>doexpire</file> will delete articles as they get old (every night at 00:30), and the three last commands does various supervisory and error correcting tasks. <p> One should also ensure that things are cleaned up when starting the machine. As user root, add the following line to <file>/etc/rc.d/rc.local</file>: <tscreen><verb> su news -c /usr/lib/newsbin/maint/newsboot </verb></tscreen> News may be collected via the program <bf>NewsX</bf>, <nidx>NewsX</nidx> picking news from an <idx>NNTP-server</idx> The program can be found at: <p> <tt> <htmlurl url="ftp://sunsite.unc.edu/pub/Linux/system/news/transport/newsx-0.9.tar.gz" name="ftp://sunsite.unc.edu/pub/Linux/system/news/transport/newsx-0.9.tar.gz"></tt> Or: <p> <tt> <htmlurl url="ftp://ftp.sol.no/user/egilk/newsx-0.9.tar.gz" name="ftp://ftp.sol.no/user/egilk/newsx-0.9.tar.gz"></tt> <p> Setting up <tt><cdx>NewsX</cdx></tt> is quite simple. Installation is a classic case of: <tscreen><verb> make su make install exit </verb></tscreen> <p> With the setup outlined here, all you have to do is to create the groups you want to read using the <ncdx>addgroup</ncdx> <file>addgroup</file> command. <p> To fetch articles, user <tt><cdx>news</cdx></tt> issues the following commands (assuming communication via PPP or similar is up): <tscreen><verb> newsrun newsx acme news.acme.xz newsrun </verb></tscreen> <nidx>newsrun</nidx> <p> The option <tt>-d</tt> gives continuous printout to the screen. Refer to the NewsX documentation for further information. <p> NewsX will also take care of posting of outgoing news. <p> To control disposal of articles as they get old, a file <tt><cdx>explist</cdx></tt> is required. The comments in this example should explain what we want to do: <tscreen><verb> # hold onto history lines 14 days, nobody gets >120 days /expired/ x 14 - /bounds/ x 0-1-120 - # retain these for 2 months comp.sources,comp.os.linux.all x 60 - # noise gets thrown away fast junk,control x 2 - # default: 14 days, no archive all x 14 - </verb></tscreen> <p> <bf>ALT:</bf> In a small news-spool, one will usually not need the newsgroup <tt>control</tt>. The traffic is <bf>huge</bf> compared to the possible usefulness. The main point is that articles will be canceled, and that groups may be created automatically. To ensure that control messages containing <tt>newgroup</tt> not shall mess up things for us, a file called <ncdx>newgroupperm</ncdx> <file>newgroupperm</file> specifies what we will allow: <tscreen><verb> comp.os.linux tale@uunet.com yv all any nq </verb></tscreen> In this example, all proper groups under comp.os.linux will be created (y), and the user <tt>news</tt> will be notified (v). Everything else will be silently (q) ignored (n). The last line is sufficient if you want to create all groups manually. <p> <bf>ALT:</bf> An alternative to NewsX is <file>suck</file>. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <sect1> How do I set up Leafnode? <p> A different solution altogether is to install the integrated package <ncdx>leafnode</ncdx> <file>leafnode</file>. This will handle all tasks required for a personal news spool, and is easy to configure. It is available via: <p> <tt> <htmlurl url="http://www.troll.no/freebies/leafnode.html" name="http://www.troll.no/freebies/leafnode.html"></tt> <p> As for C News, all news maintenance really should be performed as user <tt>news</tt>. <p> The home directory for leafnode is in <file>/usr/lib/leafnode</file>. To install, write: <tscreen><verb> cd /usr/lib/leafnode tar -xzvf leafnode-0.8.tgz cd leafnode-0.8 make su make install </verb></tscreen> <p> Note in the following that the prefix <file>/usr/local/sbin</file> should be replaced with <file>/usr/sbin</file> if you installed leafnode from a package. <p> While still being logged in as <tt>root</tt>, change the line that controls NNTP in <ncdx>/etc/inetd.conf</ncdx> <file>/etc/inetd.conf</file>: <tscreen><verb> nntp stream tcp nowait news /usr/sbin/tcpd /usr/local/sbin/leafnode </verb></tscreen> Activate it by: <tscreen><verb> killall -HUP inetd </verb></tscreen> <p> Return to user <tt>news</tt> by writing <file>exit</file>. In <ncdx>/usr/lib/leafnode/config</ncdx> <file>/usr/lib/leafnode/config</file> change the line that defines the NNTP server. In our case: <tscreen><verb> server = news.acme.xz </verb></tscreen> <p> Leafnode will look after itself by adding the following command via <tt>crontab -e</tt> as user <tt>news</tt>: <tscreen><verb> # expire Leafnode, once a day 0 4 * * * /usr/local/sbin/texpire </verb></tscreen> <nidx>texpire</nidx> <p> News exchange is also done as user <tt>news</tt> by the following command (assuming PPP is up and running): <tscreen><verb> /usr/local/sbin/fetch </verb></tscreen> <nidx>fetch</nidx> <p> Users who wants to read news should then use the recipe in <it>How do I set up an online news-reader?</it>, except that they configure for the local machine, i.e: <tscreen><verb> export NNTPSERVER=localhost </verb></tscreen> <p> That should be all there is to it. The first <tt><cdx>fetch</cdx></tt> will transfer a list of available newsgroups. Leafnode will then monitor what groups the users are requesting, and adapt to this the <bf>next</bf> time it is activated. <p> Note that leafnode does not seems to work in cases where NNTP authorization is required. +.LP <p> <bf>ALT:</bf> An alternative to <file>leafnode</file> is <file>nntpcache</file>, available from: <p> <tt> <htmlurl url="ftp://ftp.suburbia.net/pub/nntpcache/nntpcache.tgz" name="ftp://ftp.suburbia.net/pub/nntpcache/nntpcache.tgz"></tt> <bf>ALT:</bf> Another alternative is to use the newsreader <ncdx>slrn</ncdx> <file>slrn</file> together with the <ncdx>slrn- pull</ncdx> <file>slrn-pull</file> package. The newsreader must be compiled with the <tt>spool</tt> feature set. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <sect> How do I automate the connection procedure? <p> Automated handling of news and email is quite easy to implement in Linux. <p> First and foremost one should make a <ncdx>/usr/lib/ppp/ppp-on</ncdx> <file>/usr/lib/ppp/ppp-on</file> that initiates the ISP connection. Often, this file will simply contain the following: <tscreen><verb> /usr/sbin/pppd </verb></tscreen> <nidx>pppd</nidx> Further specification will be performed in <ncdx>/etc/ppp/options</ncdx> <file>/etc/ppp/options</file>: <tscreen><verb> connect "/usr/lib/ppp/chat -v -f /etc/ppp/chatscript" crtscts modem defaultroute asyncmap 00000000 user dirk /dev/modem 38400 </verb></tscreen> <p> To end a connection, use the supplied version of <ncdx>/usr/lib/ppp/ppp-off</ncdx> <file>/usr/lib/ppp/ppp-off</file>. <p> Having tested the functionality of these two scripts, one must then write scripts that perform the various tasks. The script to collect email has been described before, and we will here assume it is located at <file>/home/dirk/pop</file>. <p> A script for exchange of email can then be produced in <file>/root/mail</file>: <tscreen><verb> #! /bin/sh # # exchange mail # 10 minutes timeout: TIMEOUT=600 DT=10 # kick sendmail: sendmail -q & # retrieve mail: su dirk -c /home/dirk/pop # wait for sendmail to terminate: t=0 while ! mailq | grep -q "Mail queue is empty"; do t=$[$t+$DT] if [ $t -gt $TIMEOUT ] ; then echo "sendmail -q timeout ($TIMEOUT).." exit 1 fi sleep $DT done exit 0 </verb></tscreen> <p> The script to exchange news may be placed in <file>/usr/lib/news/news</file>: <tscreen><verb> #!/bin/sh # # exchange news # must be run as news: cd /usr/lib/news #update the outgoing batch (C News): /usr/lib/newsbin/input/newsrun < /dev/null #exchange news: /usr/lib/newsbin/newsx acme news.acme.xz #and flush the incoming batch: /usr/lib/newsbin/input/newsrun < /dev/null </verb></tscreen> A script to connect the various bits and pieces remains, and can be placed in <file>/root/news+mail</file>: <tscreen><verb> #!/bin/sh # # exchange news and email # must be run as root # if ! /usr/lib/ppp/ppp-on; then exit 1 fi trap "/usr/lib/ppp/ppp-off" 1 2 3 15 #exchange news+mail: /root/mail & su news -c ~news/news wait #disconnect.. /usr/lib/ppp/ppp-off #update the incoming batch (C News): su news -c /usr/lib/newsbin/input/newsrun < /dev/null & exit 0 </verb></tscreen> <p> It is quite easy to make an extension to the above that only will establish a connection if outgoing email and news is present. Lets call it <ncdx>/root/news+mail.cond</ncdx> <file>/root/news+mail.cond</file>, and keep in mind that the name of the outgoing news-spool must be updated to suit: <tscreen><verb> #!/bin/sh # # exchange news and email, only if outgoing news or mail # (C News spool) if [ -s /var/spool/news/out.going/acme/togo ] || ! ( mailq | grep -q "Mail queue is empty"); then /root/news+mail fi </verb></tscreen> <p> The only thing remaining is to specify when all this is going to happen. This is done using the command <tt>crontab -e</tt> <nidx>crontab</nidx> as root. Let us assume that we always want to exchange news and mail at 07:00 in the morning, and after that every 4th hour assuming there are outgoing email and news: <tscreen><verb> 00 7 * * * /root/news+mail 00 11,15,19,23 * * * /root/news+mail.cond </verb></tscreen> Ensure that every component is tested well before you connect them together. One may later add several other tasks, such as adjustment of the time of day (using <ncdx>ntpdate</ncdx> <file>ntpdate</file>), and automatic update (mirroring) of locally maintained WWW and FTP files up to the ISP (using make and ftp). <p> <bf>ALT:</bf> Depending on ones preferences, it is also possible to turn the process upside down. Every time a PPP link is initiated, the script <ncdx>/etc/ppp/ip-up</ncdx> <file>/etc/ppp/ip-up</file> will be started. One may here add whatever magic is required to start exchange of email and news. See <tt>man pppd</tt> for further detail. <p> <bf>ALT:</bf> It is also possible to automatically connect PPP whenever network traffic is detected. This is in many ways the more elegant solution, but it is quite dependent on a good configuration to avoid frequent (and costly) connections being made. More information can be found at: <p> <tt> <htmlurl url="http://www.dna.lth.se/~erics/diald.html" name="http://www.dna.lth.se/~erics/diald.html"></tt> <p> The <tt><cdx>diald</cdx></tt> utility is available from: <p> <tt> <htmlurl url="ftp://sunsite.unc.edu/pub/Linux/system/network/serial/diald-0.16.tar.gz" name="ftp://sunsite.unc.edu/pub/Linux/system/network/serial/diald-0.16.tar.gz"></tt> <p> At the same location one will also find other variations on the theme PPP connections. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <sect> Final words <sect1> Other things I should know about? <p> <itemize> <item> Various error messages in the system will normally be issued as internal email. To ensure that these will actually be read, one should create an <ncdx>/etc/aliases</ncdx> <file>/etc/aliases</file>. Remember the command <tt><cdx>newaliases</cdx></tt> every time you change this. An example that should cover most eventualities is: </itemize> <tscreen><verb> PostMaster: root ftp: root news: root usenet: root FaxMaster: root fax: root WebMaster: root MAILER.DAEMON: root </verb></tscreen> <nidx>PostMaster</nidx> <p> <itemize> <item> Many programs for Linux may be found at <bf>Sunsite</bf>, <nidx>Sunsite</nidx> which is usually quite busy. But there are many <idx>mirrors</idx> and every time there is a reference to <file>ftp://sunsite.unc.edu/pub/Linux/..</file> one should try to use a mirror close to home, e.g. <file>ftp://ftp.nvg.unit.no/pub/linux/sunsite/..</file>. <item> If you happen to be migrating from <idx>Yarn</idx> it should be possible to convert these to standard folders using the <file>yarn2mf</file> available at: </itemize> <p> <tt> <htmlurl url="ftp://ftp.sol.no/user/egilk/yarn2mf.zip" name="ftp://ftp.sol.no/user/egilk/yarn2mf.zip"></tt> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <sect> ISP specific information <p> More specific information for certain ISPs is available from a variety of sources: <p> <bf><idx>Demon Internet</idx></bf> <p> <tt> <htmlurl url="ftp://ftp.demon.co.uk/pub/unix/linux/Demon/slack3.0.help.tgz" name="ftp://ftp.demon.co.uk/pub/unix/linux/Demon/slack3.0.help.tgz"></tt> <p> <bf><idx>Netcom</idx></bf> <p> <tt> <htmlurl url="http://www.netcom.com/bin/webtech/NetCruiser/Operating_Systems/Linux/linux.cfg.html" name="http://www.netcom.com/bin/webtech/NetCruiser/Operating_Systems/Linux/linux.cfg.html"></tt> <p> <bf>PowerTech, Telenor Online, Telia</bf> <nidx>PowerTech</nidx> <nidx>Telenor Online</nidx> <nidx>Telia</nidx> <p> <tt> <htmlurl url="http://www.kvaleberg.com/no-isp.html" name="http://www.kvaleberg.com/no-isp.html"></tt> <p> <bf><idx>Stanford</idx></bf> <p> <tt> <htmlurl url="http://www-leland.stanford.edu/~wkn/Linux/network/network.html" name="http://www-leland.stanford.edu/~wkn/Linux/network/network.html"></tt> <p> <bf><idx>MCI</idx></bf> <p> <tt> <htmlurl url="http://www.kvaleberg.com/linux-mci.html" name="http://www.kvaleberg.com/linux-mci.html"></tt> <p> <bf>SISCOM</bf> <p> <tt> <htmlurl url="http://www.siscom.net/support/linux_setup.htm" name="http://www.siscom.net/support/linux_setup.htm"></tt> <p> <bf>AOL</bf> is not possible since AOL uses a proprietary protocol. <p> If you can supply ISP specific information not listed here, please get in touch. <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <sect1> How do I learn more? <p> The <idx>Linux Documentation Project</idx> book called <idx>Linux Network Administrator's Guide</idx> by Olaf Kirch is pretty mandatory for anyone that will set up and maintain anything involving <idx>TCP/IP</idx> and <idx>Internet</idx> <p> <tt> <htmlurl url="ftp://sunsite.unc.edu/pub/Linux/docs/linux-doc-project/network-guide/nag-1.0.ascii.tar.gz" name="ftp://sunsite.unc.edu/pub/Linux/docs/linux-doc-project/network-guide/nag-1.0.ascii.tar.gz"></tt> <p> The documentation that follows each software package will normally give you all the detailed information you need, if not always the overview. The man-pages will be the first place to look. Try for instance: <tscreen><verb> man pppd </verb></tscreen> <p> You will also find some documentation about certain programs in the <ncdx>/usr/doc</ncdx> <file>/usr/doc</file> tree, although this is not always well structured. <p> The following HOWTOs will be highly relevant: <p> <itemize> <item> <bf><idx>Installation-HOWTO</idx></bf> will get the basics sorted. <item> <bf><idx>NET-2-HOWTO</idx></bf> is a very thorough description of installation and setup of the NET code. Much of this should already have been done if you use a standard Linux distribution (e.g. Slackware, Red Hat, Debian). But many sections on setup and troubleshooting will be very worthwhile. <item> <bf><idx>Mail-HOWTO</idx></bf> explains how to configure various tools. Again, much of this will already have been done for you when you install a standard Linux distribution. <item> <bf><idx>News-HOWTO</idx></bf> is for setting up a (conventional) news spool. <item> <bf><idx>Tiny-News</idx></bf> covers yet another alternative for collecting news. <item> <bf><idx>PPP-HOWTO</idx></bf> is a good description of problems you may encounter when setting up a PPP connection. <item> <bf><idx>Serial-HOWTO</idx></bf> contains everything you need to know about setting up serial ports. <item> <bf><idx>Mail-Queue</idx></bf> tells you how to send up <it>sendmail</it> to always queue remote mail but deliver local mail at once. </itemize> <p> <idx>Red Hat</idx> has a mailing list for PPP issues; to join send an email to <p> <tt> <htmlurl url="mailto:redhat-ppp-list-request" name="redhat-ppp-list-request"></tt> with the subject line <tscreen><verb> subscribe </verb></tscreen> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <sect1> Thanks to <p> Information here is collected from many sources. Thanks to the following that either indirectly or directly have contributed: <tscreen><verb> Adam Holt <holt@graphics.lcs.mit.edu> Arne Coucheron <arneco@oslonett.no> Arne Riiber <riiber@oslonett.no> Arnt Gulbrandsen <agulbra@troll.no> Bjorn Steensrud <bjornst@powertech.no> Gisle Hannemyr <gisle@a.sn.no> Hans Amund Rosbach <haro@sesam.dnv.no> Hans Peter Verne <hpv@ulrik.uio.no> Harald T Alvestrand <Harald.T.Alvestrand@uninett.no> Harald Terkelsen <Harald.Terkelsen@adm.hioslo.no> Haavard Engum <hobbes@interlink.no> James Youngman <JYoungman@vggas.com> Johan S. Seland <johanss@sn.no> John Phillips <john@linux.demon.co.uk> Jorn Lokoy <jorn@oslonett.no> Kenneth Tjostheim <kenneth.tjostheim@asplanviak.no> Kjell M. Myksvoll <kjell.myksvoll@fou.telenor.no> Kjetil T. Homme <kjetilho@math.uio.no> Michael Meissner <meissner@cygnus.com> N J Bailey <N.J.Bailey@leeds.ac.uk> Nicolai Langfeldt <janl@math.uio.no> Ove Ruben R Olsen <Ove.R.Olsen@ub.uib.no> R. Bardarson <ronb@powernet.net> Steinar Fremme <steinar@fremme.no> Sverre H. Huseby <sverrehu@ifi.uio.no> Trond Eivind Glomsrod <teg@stud.imf.unit.no> Tommy Larsen <tommy@mix.hive.no> Yves Bellefeuille <yan@storm.ca> </verb></tscreen> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - --> </article>