home *** CD-ROM | disk | FTP | other *** search
/ Hackers Toolkit v2.0 / Hackers_Toolkit_v2.0.iso / HTML / archive / Unix / HOWTOs / NET-3-HO < prev    next >
Text File  |  1999-11-04  |  205KB  |  5,875 lines

  1.   Linux NET-3-HOWTO, Linux Networking.
  2.   Terry Dawson (main author), VK2KTJ; Alessandro Rubini (main¡
  3.   tainer), alessandro.rubini@linux.it
  4.   v1.4, August 1998
  5.  
  6.   The Linux Operating System boasts kernel based networking support
  7.   written almost entirely from scratch. The performance of the tcp/ip
  8.   implementation in recent kernels makes it a worthy alternative to even
  9.   the best of its peers.  This document aims to describe how to install
  10.   and configure the Linux networking software and associated tools.
  11.   ______________________________________________________________________
  12.  
  13.   Table of Contents
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.   1. Changes from version 1.3 (April 1998)
  68.  
  69.   2. Introduction.
  70.  
  71.      2.1 Feedback
  72.  
  73.   3. How to use this HOWTO document (NET-3-HOWTO howto?).
  74.  
  75.      3.1 Conventions used in this document
  76.  
  77.   4. General Information about Linux Networking.
  78.  
  79.      4.1 A brief history of Linux Networking Kernel Development.
  80.      4.2 Where to get other information about Linux Networking.
  81.      4.3 Where to get some non-linux-specific network information.
  82.  
  83.   5. Generic Network Configuration Information.
  84.  
  85.      5.1 What do I need to start ?
  86.         5.1.1 Current Kernel source.
  87.         5.1.2 Current Network tools.
  88.         5.1.3 Network Application Programs.
  89.         5.1.4 Addresses.
  90.      5.2 Where should I put the configuration commands ?
  91.      5.3 Creating your network interfaces.
  92.      5.4 Configuring a network interface.
  93.      5.5 Configuring your Name Resolver.
  94.         5.5.1 What's in a name ?
  95.         5.5.2 What information you will need.
  96.         5.5.3 /etc/resolv.conf
  97.         5.5.4 /etc/host.conf
  98.         5.5.5 /etc/hosts
  99.         5.5.6 Running a name server
  100.      5.6 Configuring your loopback interface.
  101.      5.7 Routing.
  102.         5.7.1 So what does the
  103.      5.8 Configuring your network servers and services.
  104.         5.8.1 (TT
  105.            5.8.1.1 An example
  106.         5.8.2 (TT
  107.            5.8.2.1 An example
  108.      5.9 Other miscellaneous network related configuration files.
  109.         5.9.1 (TT
  110.         5.9.2 (TT
  111.      5.10 Network Security and access control.
  112.         5.10.1 /etc/ftpusers
  113.         5.10.2 /etc/securetty
  114.         5.10.3 The
  115.            5.10.3.1 /etc/hosts.allow
  116.            5.10.3.2 /etc/hosts.deny
  117.         5.10.4 /etc/hosts.equiv
  118.         5.10.5 Configure your
  119.         5.10.6 Network Firewalling.
  120.         5.10.7 Other suggestions.
  121.  
  122.   6. IP- and Ethernet-Related Information
  123.  
  124.      6.1 Ethernet
  125.      6.2 EQL - multiple line traffic equaliser
  126.      6.3 IP Accounting (for Linux-2.0)
  127.      6.4 IP Accounting (for Linux-2.2)
  128.      6.5 IP Aliasing
  129.      6.6 IP Firewall (for Linux-2.0)
  130.      6.7 IP Firewall (for Linux-2.2)
  131.      6.8 IPIP Encapsulation
  132.         6.8.1 A tunneled network configuration.
  133.         6.8.2 A tunneled host configuration.
  134.      6.9 IP Masquerade (for Linux-2.0)
  135.      6.10 IP Transparent Proxy
  136.      6.11 IPv6
  137.      6.12 Mobile IP
  138.      6.13 Multicast
  139.      6.14 NAT - Network Address Translation
  140.      6.15 Traffic Shaper - Changing allowed bandwidth
  141.      6.16 Routing in Linux-2.2
  142.  
  143.   7. Using common PC hardware
  144.  
  145.      7.1 ISDN
  146.      7.2 PLIP for Linux-2.0
  147.      7.3 PLIP for Linux-2.2
  148.      7.4 PPP
  149.         7.4.1 Maintaining a permanent connection to the net with
  150.      7.5 SLIP client
  151.         7.5.1 dip
  152.         7.5.2 slattach
  153.         7.5.3 When do I use which ?
  154.         7.5.4 Static SLIP server with a dialup line and DIP.
  155.         7.5.5 Dynamic SLIP server with a dialup line and DIP.
  156.         7.5.6 Using DIP.
  157.         7.5.7 Permanent SLIP connection using a leased line and slattach.
  158.      7.6 SLIP server.
  159.         7.6.1 Slip Server using
  160.            7.6.1.1 Where to get
  161.            7.6.1.2 Configuring
  162.            7.6.1.3 Configuring
  163.            7.6.1.4 Configuring the
  164.            7.6.1.5 Configuring the
  165.            7.6.1.6 Configuring the
  166.         7.6.2 Slip Server using
  167.            7.6.2.1 Configuring
  168.         7.6.3 SLIP server using the
  169.  
  170.   8. Other Network Technologies
  171.  
  172.      8.1 ARCNet
  173.      8.2 Appletalk (
  174.         8.2.1 Configuring the Appletalk software.
  175.         8.2.2 Exporting a Linux filesystems via Appletalk.
  176.         8.2.3 Sharing your Linux printer across Appletalk.
  177.         8.2.4 Starting the appletalk software.
  178.         8.2.5 Testing the appletalk software.
  179.         8.2.6 Caveats of the appletalk software.
  180.         8.2.7 More information
  181.      8.3 ATM
  182.      8.4 AX25 (
  183.      8.5 DECNet
  184.      8.6 FDDI
  185.      8.7 Frame Relay
  186.      8.8 IPX (
  187.      8.9 NetRom (
  188.      8.10 Rose protocol (
  189.      8.11 SAMBA - `NetBEUI', `NetBios' support.
  190.      8.12 STRIP support (Starmode Radio IP)
  191.      8.13 Token Ring
  192.      8.14 X.25
  193.      8.15 WaveLan Card
  194.  
  195.   9. Cables and Cabling
  196.  
  197.      9.1 Serial NULL Modem cable
  198.      9.2 Parallel port cable (PLIP cable)
  199.      9.3 10base2 (thin coax) Ethernet Cabling
  200.      9.4 Twisted Pair Ethernet Cable
  201.  
  202.   10. Glossary of Terms used in this document.
  203.  
  204.   11. Linux for an ISP ?
  205.  
  206.   12. Acknowledgements
  207.  
  208.   13. Copyright.
  209.  
  210.  
  211.  
  212.   ______________________________________________________________________
  213.  
  214.   1.  Changes from version 1.3 (April 1998)
  215.  
  216.  
  217.   Additions:
  218.           Traffic Shaper.
  219.           Plip for new kernels
  220.  
  221.   Corrections/Updates:
  222.           Maintainer address for netkit.
  223.           Descriptions of domain names revised.
  224.           General reordering of sections.
  225.           2.0 and 2.2 differences are marked, although some 2.2 info is missing.
  226.           Fixed many references to external documents.
  227.   ToDo:
  228.           Describe new routing algorithm
  229.           Add IPv6 kernel compile options
  230.           Describe /proc/sys/net/* entries.
  231.           WanRouter device
  232.           Describe the new firewalling commands for 2.2
  233.  
  234.  
  235.  
  236.   2.  Introduction.
  237.  
  238.   The original NET-FAQ was written by Matt Welsh and Terry Dawson to
  239.   answer frequently asked questions about networking for Linux at a time
  240.   before the Linux Documentation Project had formally started. It
  241.   covered the very early development versions of the Linux Networking
  242.   Kernel. The NET-2-HOWTO superceded the NET-FAQ and was one of the
  243.   original LDP HOWTO documents, it covered what was called version 2 and
  244.   later version 3 of the Linux kernel Networking software. This document
  245.   in turn supercedes it and relates only to version 3 of the Linux
  246.   Networking Kernel.
  247.  
  248.   Previous versions of this document became quite large because of the
  249.   enormous amount of material that fell within its scope. To help reduce
  250.   this problem a number of HOWTO's dealing with specific networking
  251.   topics have been produced. This document will provide pointers to them
  252.   where relevant and cover those areas not yet covered by other
  253.   documents.
  254.  
  255.   In April 1998 Terry left as NET-3 maintainer, due to his high load.
  256.   Alessandro Rubini is the new maintainer and would like to keep the
  257.   document as good as before, although he's new in this kind of stuff.
  258.  
  259.   2.1.  Feedback
  260.  
  261.   I always appreciate feedback and especially value contributions.
  262.   Please direct any feedback or contributions to me by email
  263.   (rubini@linux.it <mailto:rubini@linux.it>.
  264.  
  265.   3.  How to use this HOWTO document (NET-3-HOWTO howto?).
  266.  
  267.   This document is organized top-down. The first sections include
  268.   informative material and can be skipped if you are not interested;
  269.   what follows is a generic discussion of networking issues, and you
  270.   must ensure you understand this before proceeding to more specific
  271.   parts. The rest, ``technology specific'' information is grouped in
  272.   three main sections: Ethernet and IP-related information, technologies
  273.   pertaining to widespread PC hardware and seldom-used technologies.
  274.  
  275.   The suggested path through the document is thus the following:
  276.  
  277.  
  278.  
  279.      Read the generic sections
  280.         These sections apply to every, or nearly every, technology
  281.         described later and so are very important for you to understand.
  282.         On the other hand, I expect many of the readers to be already
  283.         confident with this material.
  284.  
  285.  
  286.      Consider your network
  287.         You should know how your network is, or will be, designed and
  288.         exactly what hardware and technology types you will be
  289.         implementing.
  290.  
  291.  
  292.      Read the ``Ethernet and IP'' section if you are directly connected
  293.         a LAN or the Internet" This section describes basic Ethernet
  294.         configuration and the various features that Linux offers for IP
  295.         networks, like firewalling, advanced routing and so on.
  296.  
  297.  
  298.      Read the next section if you are interested in low-cost local
  299.         networks or dial-up connections" The section describes PLIP,
  300.         PPP, SLIP and ISDN, the widespread technologies used on personal
  301.         workstations.
  302.  
  303.  
  304.      Read the technology specific sections related to your
  305.         requirements" If your needs differ from IP and/or common
  306.         hardware, the final section covers details specific to non-IP
  307.         protocols and peculiar communication hardware.
  308.  
  309.  
  310.      Do the configuration work
  311.         You should actually try to configure your network and take
  312.         careful note of any problems you have.
  313.  
  314.  
  315.      Look for further help if needed
  316.         If you experience problems that this document does not help you
  317.         to resolve then read the section related to where to get help or
  318.         where to report bugs.
  319.  
  320.  
  321.      Have fun!
  322.         Networking is fun, enjoy it.
  323.  
  324.  
  325.   3.1.  Conventions used in this document
  326.  
  327.   No special convention is used here, but you must be warned about the
  328.   way commands are shown. Following the classic Unix documentation, any
  329.   command you should type to your shell is prefixed by a prompt. This
  330.   howto shows "user%" as the prompt for commands that do not require
  331.   superuser privileges, and "root#" as the prompt for commands that need
  332.   to run as root. I chose to use "root#" instead of a plain "#" to
  333.   prevent confusion with snapshots from shell scripts, where the hash
  334.   mark is used to define comment lines.
  335.  
  336.   When ``Kernel Compile Options'' are shown, they are represented in the
  337.   format used by menuconfig. They should be understandable even if you
  338.   (like me) are not used to menuconfig. If you are in doubt about the
  339.   options' nesting, running the program once can't but help.
  340.  
  341.   Note that any link to other HOWTO's is local to help you browsing your
  342.   local copy of the LDP documents, in case you are using the html
  343.   version of this document. If you don't have a complete set of
  344.   documents, every HOWTO can be retrieved from sunsite.unc.edu
  345.   (directory /pub/Linux/HOWTO) and its countless mirrors.
  346.  
  347.   4.  General Information about Linux Networking.
  348.  
  349.  
  350.   4.1.  A brief history of Linux Networking Kernel Development.
  351.  
  352.   Developing a brand new kernel implementation of the tcp/ip protocol
  353.   stack that would perform as well as existing implementations was not
  354.   an easy task.  The decision not to port one of the existing
  355.   implementations was made at a time when there was some uncertainty as
  356.   to whether the existing implementations may become encumbered by
  357.   restrictive copyrights because of the court case put by U.S.L. and
  358.   when there was a lot of fresh enthusiasm for doing it differently and
  359.   perhaps even better than had already been done.
  360.  
  361.   The original volunteer to lead development of the kernel network code
  362.   was Ross Biro <biro@yggdrasil.com>. Ross produced a simple and
  363.   incomplete but mostly usable implementation set of routines that were
  364.   complemented by an ethernet driver for the WD-8003 network interface
  365.   card.  This was enough to get many people testing and experimenting
  366.   with the software and some people even managed to connect machines in
  367.   this configuration to live internet connections. The pressure within
  368.   the Linux community driving development for networking support was
  369.   building and eventually the cost of a combination of some unfair
  370.   pressure applied to Ross and his own personal commitments outweighed
  371.   the benefit he was deriving and he stepped down as lead developer.
  372.   Ross's efforts in getting the project started and accepting the
  373.   responsibility for actually producing something useful in such
  374.   controversial circumstances were what catalyzed all future work and
  375.   were therefore an essential component of the success of the current
  376.   product.
  377.  
  378.   Orest Zborowski <obz@Kodak.COM> produced the original BSD socket
  379.   programming interface for the Linux kernel. This was a big step
  380.   forward as it allowed many of the existing network applications to be
  381.   ported to linux without serious modification.
  382.  
  383.   Somewhere about this time Laurence Culhane <loz@holmes.demon.co.uk>
  384.   developed the first drivers for Linux to support the SLIP protocol.
  385.   These enabled many people who did not have access to Ethernet
  386.   networking to experiment with the new networking software. Again, some
  387.   people took this driver and pressed it into service to connect them to
  388.   the Internet. This gave many more people a taste of the possibilities
  389.   that could be realized if Linux had full networking support and grew
  390.   the number of users actively using and experimenting with the
  391.   networking software that existed.
  392.  
  393.   One of the people that had also been actively working on the task of
  394.   building networking support was Fred van Kempen
  395.   <waltje@uwalt.nl.mugnet.org>.  After a period of some uncertainty
  396.   following Ross's resignation from the lead developer position Fred
  397.   offered his time and effort and accepted the role essentially
  398.   unopposed. Fred had some ambitious plans for the direction that he
  399.   wanted to take the Linux networking software and he set about
  400.   progressing in those directions. Fred produced a series of networking
  401.   code called the `NET-2' kernel code (the `NET' code being Ross's)
  402.   which many people were able to use pretty much usefully. Fred formally
  403.   put a number of innovations on the development agenda, such as the
  404.   dynamic device interface, Amateur Radio AX.25 protocol support and a
  405.   more modularly designed networking implementation.  Fred's NET-2 code
  406.   was used by a fairly large number of enthusiasts, the number
  407.   increasing all the time as word spread that the software was working.
  408.   The networking software at this time was still a large number of
  409.   patches to the standard release of kernel code and was not included in
  410.   the normal release.  The NET-FAQ and subsequent NET-2-HOWTO's
  411.   described the then fairly complex procedure to get it all working.
  412.   Fred's focus was on developing innovations to the standard network
  413.   implementations and this was taking time. The community of users was
  414.   growing impatient for something that worked reliably and satisfied the
  415.   80% of users and, as with Ross, the pressure on Fred as lead developer
  416.   rose.
  417.  
  418.   Alan Cox <iialan@www.uk.linux.org> proposed a solution to the problem
  419.   designed to resolve the situation. He proposed that he would take
  420.   Fred's NET-2 code and debug it, making it reliable and stable so that
  421.   it would satisfy the impatient user base while relieving that pressure
  422.   from Fred allowing him to continue his work. Alan set about doing
  423.   this, with some good success and his first version of Linux networking
  424.   code was called `Net-2D(ebugged)'. The code worked reliably in many
  425.   typical configurations and the user base was happy. Alan clearly had
  426.   ideas and skills of his own to contribute to the project and many
  427.   discussions relating to the direction the NET-2 code was heading
  428.   ensued. There developed two distinct schools within the Linux
  429.   networking community, one that had the philosophy of `make it work
  430.   first, then make it better' and the other of `make it better first'.
  431.   Linus ultimately arbitrated and offered his support to Alan's
  432.   development efforts and included Alan's code in the standard kernel
  433.   source distribution.  This placed Fred in a difficult position. Any
  434.   continued development would lack the large user base actively using
  435.   and testing the code and this would mean progress would be slow and
  436.   difficult. Fred continued to work for a short time and eventually
  437.   stood down and Alan came to be the new leader of the Linux networking
  438.   kernel development effort.
  439.  
  440.   Donald Becker <becker@cesdis.gsfc.nasa.gov> soon revealed his talents
  441.   in the low level aspects of networking and produced a huge range of
  442.   ethernet drivers, nearly all of those included in the current kernels
  443.   were developed by Donald. There have been other people that have made
  444.   significant contributions, but Donald's work is prolific and so
  445.   warrants special mention.
  446.  
  447.   Alan continued refining the NET-2-Debugged code for some time while
  448.   working on progressing some of the matters that remained unaddressed
  449.   on the `TODO' list.  By the time the Linux 1.3.* kernel source had
  450.   grown its teeth the kernel networking code had migrated to the NET-3
  451.   release on which current versions are based. Alan worked on many
  452.   different aspects of the networking code and with the assistance of a
  453.   range of other talented people from the Linux networking community
  454.   grew the code in all sorts of directions. Alan produced dynamic
  455.   network devices and the first standard AX.25 and IPX implementations.
  456.   Alan has continued tinkering with the code, slowly restructuring and
  457.   enhancing it to the state it is in today.
  458.  
  459.   PPP support was added by Michael Callahan <callahan@maths.ox.ac.uk>
  460.   and Al Longyear <longyear@netcom.com> this too was critical to
  461.   increasing the number of people actively using linux for networking.
  462.  
  463.   Jonathon Naylor <jsn@cs.nott.ac.uk> has contributed by significantly
  464.   enhancing Alan's AX.25 code, adding NetRom and Rose protocol support.
  465.   The AX.25/NetRom/Rose support itself is quite significant, because no
  466.   other operating system can boast standard native support for these
  467.   protocols beside Linux.
  468.  
  469.   There have of course been hundreds of other people who have made
  470.   significant contribution to the development of the Linux networking
  471.   software. Some of these you will encounter later in the technology
  472.   specific sections, other people have contributed modules, drivers,
  473.   bug-fixes, suggestions, test reports and moral support. In all cases
  474.   each can claim to have played a part and offered what they could. The
  475.   Linux kernel networking code is an excellent example of the results
  476.   that can be obtained from the Linux style of anarchic development, if
  477.   it hasn't yet surprised you, it is bound to soon enough, the
  478.   development hasn't stopped.
  479.  
  480.   4.2.  Where to get other information about Linux Networking.
  481.  
  482.   There are a number of places where you can find good information about
  483.   Linux networking.
  484.  
  485.   Alan Cox, the current maintainer of the Linux kernel networking code
  486.   maintains a world wide web page that contains highlights of current
  487.   and new developments in linux Networking at: www.uk.linux.org
  488.   <http://www.uk.linux.org/NetNews.html>.
  489.  
  490.   Another good place is a book written by Olaf Kirch entitled the
  491.   Network Administrators Guide. It is a work of the Linux Documentation
  492.   Project <http://sunsite.unc.edu/LDP/> and you can read it
  493.   interactively at Network Administrators Guide HTML version
  494.   <http://sunsite.unc.edu/LDP/LDP/nag/nag.html> or you can obtain it in
  495.   various formats by ftp from the sunsite.unc.edu LDP ftp archive
  496.   <ftp://sunsite.unc.edu/pub/Linux/docs/LDP/network-guide/>. Olaf's book
  497.   is quite comprehensive and provides a good high level overview of
  498.   network configuration under linux.
  499.  
  500.   There is a newsgroup in the Linux news hierarchy dedicated to
  501.   networking and related matters, it is: comp.os.linux.networking
  502.   <news:comp.os.linux.networking>
  503.  
  504.   There is a mailing list to which you can subscribe where you may ask
  505.   questions relating to Linux networking. To subscribe you should send a
  506.   mail message:
  507.  
  508.  
  509.        To: majordomo@vger.rutgers.edu
  510.        Subject: anything at all
  511.        Message:
  512.  
  513.        subscribe linux-net
  514.  
  515.  
  516.  
  517.  
  518.   On the various IRC networks there are often #linux channels on which
  519.   people will be able to answer questions on linux networking.
  520.  
  521.   Please remember when reporting any problem to include as much relevant
  522.   detail about the problem as you can. Specifically you should specify
  523.   the versions of software that you are using, especially the kernel
  524.   version, the version of tools such as pppd or dip and the exact nature
  525.   of the problem you are experiencing. This means taking note of the
  526.   exact syntax of any error messages you receive and of any commands
  527.   that you are issuing.
  528.  
  529.   4.3.  Where to get some non-linux-specific network information.
  530.  
  531.   If you are after some basic tutorial information on tcp/ip networking
  532.   generally, then I recommend you take a look at the following
  533.   documents:
  534.  
  535.  
  536.  
  537.      tcp/ip introduction
  538.         this document comes as both a text version
  539.         <ftp://athos.rutgers.edu/runet/tcp-ip-intro.doc> and a
  540.         postscript version <ftp://athos.rutgers.edu/runet/tcp-ip-
  541.         intro.ps>.
  542.  
  543.  
  544.      tcp/ip administration
  545.         this document comes as both a text version
  546.         <ftp://athos.rutgers.edu/runet/tcp-ip-admin.doc> and a
  547.         postscript version <ftp://athos.rutgers.edu/runet/tcp-ip-
  548.         admin.ps>.
  549.  
  550.  
  551.   If you are after some more detailed information on tcp/ip networking
  552.   then I highly recommend:
  553.  
  554.  
  555.        Internetworking with TCP/IP, Volume 1: principles, protocols
  556.        and architecture, by Douglas E. Comer, ISBN 0-13-227836-7,
  557.        Prentice Hall publications, Third Edition, 1995.
  558.  
  559.  
  560.  
  561.   If you are wanting to learn about how to write network applications in
  562.   a Unix compatible environment then I also highly recommend:
  563.  
  564.  
  565.        Unix Network Programming, by W. Richard Stevens, ISBN
  566.        0-13-949876-1, Prentice Hall publications, 1990.
  567.  
  568.  
  569.  
  570.   A second edition of this book is appearing on the bookshelves; the new
  571.   book is made up of three volumes: check Prenice-Hall's web site
  572.   <http://www.phptr.com/> to probe further.
  573.  
  574.   You might also try the comp.protocols.tcp-ip <news:comp.protocols.tcp-
  575.   ip> newsgroup.
  576.  
  577.   An important source of specific technical information relating to the
  578.   Internet and the tcp/ip suite of protocols are RFC's. RFC is an
  579.   acronym for `Request For Comment' and is the standard means of
  580.   submitting and documenting Internet protocol standards. There are many
  581.   RFC repositories. Many of these sites are ftp sites and other provide
  582.   World Wide Web access with an associated search engine that allows you
  583.   to search the RFC database for particular keywords.
  584.  
  585.   One possible source for RFC's is at Nexor RFC database
  586.   <http://pubweb.nexor.co.uk/public/rfc/index/rfc.html>.
  587.  
  588.   5.  Generic Network Configuration Information.
  589.  
  590.   The following subsections you will pretty much need to know and
  591.   understand before you actually try to configure your network. They are
  592.   fundamental principles that apply regardless of the exact nature of
  593.   the network you wish to deploy.
  594.  
  595.   5.1.  What do I need to start ?
  596.  
  597.   Before you start building or configuring your network you will need
  598.   some things. The most important of these are:
  599.  
  600.   5.1.1.  Current Kernel source.
  601.  
  602.   Because the kernel you are running now might not yet have support for
  603.   the network types or cards that you wish to use you will probably need
  604.   the kernel source so that you can recompile the kernel with the
  605.   appropriate options.
  606.  
  607.  
  608.   You can always obtain the latest kernel source from ftp.kernel.org
  609.   <ftp://ftp.kernel.org/pub/linux/kernel>.  Please remember that
  610.   ftp.kernel.org is seriously overloaded: the preferred way to get
  611.   current sources is by downloading patches instead of whole tar files;
  612.   moreover, you should first try to reach mirrors of the main ftp site,
  613.   like ftp.funet.fi
  614.   <ftp://ftp.funet.fi//mirrors/ftp.kernel.org/pub/linux/kernel>; also
  615.   remember that every Linux site usually carries updated kernel
  616.   sources).
  617.  
  618.   Normally the kernel source will be untarred into the /usr/src/linux
  619.   directory. For information on how to apply patches and build the
  620.   kernel you should read the Kernel-HOWTO <Kernel-HOWTO.html>.  For
  621.   information on how to configure kernel modules you should read the
  622.   ``Modules mini-HOWTO''. Also, the README file found in the kernel
  623.   sources and the Documentation directory are very informative for the
  624.   brave reader.
  625.  
  626.   Unless specifically stated otherwise, I recommend you stick with the
  627.   standard kernel release (the one with the even number as the second
  628.   digit in the version number). Development release kernels (the ones
  629.   with the odd second digit) may have structural or other changes that
  630.   may cause problems working with the other software on your system. If
  631.   you are uncertain that you could resolve those sorts of problems in
  632.   addition to the potential for there being other software errors, then
  633.   don't use them.
  634.  
  635.   On the other hand, some of the features described here have been
  636.   introduced during the development of 2.1 kernels, so you must take
  637.   your choice: you can stick to 2.0 while wait for 2.2 and an updated
  638.   distribution with every new tool, or you can get 2.1 and look around
  639.   for the various support programs needed to exploit the new features.
  640.   As I write this paragraph, in August 1998, 2.1.115 is current and 2.2
  641.   is expected to appear pretty soon.
  642.  
  643.   5.1.2.  Current Network tools.
  644.  
  645.   The network tools are the programs that you use to configure linux
  646.   network devices. These tools allow you to assign addresses to devices
  647.   and configure routes for example.
  648.  
  649.   Most modern linux distributions are supplied with the network tools,
  650.   so if you have installed from a distribution and haven't yet installed
  651.   the network tools then you should do so.
  652.  
  653.   If you haven't installed from a distribution then you will need to
  654.   source and compile the tools yourself. This isn't difficult.
  655.  
  656.   The network tools are now maintained by Bernd Eckenfels and are
  657.   available at: ftp.inka.de
  658.   <ftp://ftp.inka.de/pub/comp/Linux/networking/NetTools/> and are
  659.   mirrored at: ftp.uk.linux.org
  660.   <ftp://ftp.uk.linux.org/pub/linux/Networking/base/>.
  661.   Be sure to choose the version that is most appropriate for the kernel
  662.   you wish to use and follow the instructions in the package to install.
  663.  
  664.   To install and configure the version current at the time of the
  665.   writing you need do the following:
  666.  
  667.  
  668.  
  669.                user% tar xvfz net-tools-1.33.tar.gz
  670.                user% cd net-tools-1.33
  671.                user% make config
  672.                user% make
  673.                root# make install
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.   Additionally, if you intend configuring a firewall or using the IP
  681.   masquerade feature you will require the ipfwadm command. The latest
  682.   version of it may be obtained from: ftp.xos.nl
  683.   <ftp:/ftp.xos.nl/pub/linux/ipfwadm>. Again there are a number of ver¡
  684.   sions available. Be sure to pick the version that most closely matches
  685.   your kernel. Note that the firewalling features of Linux changed dur¡
  686.   ing 2.1 development. This only applies to version 2.0 of the kernel.
  687.  
  688.   To install and configure the version current at the time of the
  689.   writing you need do the following:
  690.  
  691.  
  692.  
  693.                user% tar xvfz ipfwadm-2.3.0.tar.gz
  694.                user% cd ipfwadm-2.3.0
  695.                user% make
  696.                root# make install
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.   Note that if you run version 2.2 (or late 2.1) of the kernel, ipfwadm
  704.   is not the right tool to configure firewalling. This version of the
  705.   NET-3-HOWTO currently doesn't deal with the new firewalling setup.
  706.  
  707.   5.1.3.  Network Application Programs.
  708.  
  709.   The network application programs are programs such as telnet and ftp
  710.   and their respective server programs. David Holland has been managing
  711.   a distribution of the most common of these, which is now maintained by
  712.   netbug@ftp.uk.linux.org.  You may obtain the distribution from:
  713.   ftp.uk.linux.org <ftp://ftp.uk.linux.org/pub/linux/Networking/base>.
  714.  
  715.   In March 1997 the package has been split to several smaller packages,
  716.   but in May 1997 the most basic programs has been merged into a package
  717.   called netkit-base-0.10. You might need to get the base package and/or
  718.   additional packages.
  719.  
  720.   To install and configure the version current at the time of the
  721.   writing you need do the following:
  722.  
  723.  
  724.  
  725.  
  726.  
  727.           user% tar xvfz netkit-base-0.10
  728.           user% cd netkit-base-0.10
  729.           user% more README
  730.           user% vi MCONFIG
  731.           user% make
  732.           root# make install
  733.  
  734.  
  735.  
  736.  
  737.  
  738.  
  739.   5.1.4.  Addresses.
  740.  
  741.   Internet Protocol Addresses are composed of four bytes. The convention
  742.   is to write addresses in what is called `dotted decimal notation'. In
  743.   this form each byte is converted to a decimal number (0-255) dropping
  744.   any leading zero's unless the number is zero and written with each
  745.   byte separated by a `.' character. By convention each interface of a
  746.   host or router has an IP address. It is legal for the same IP address
  747.   to be used on each interface of a single machine in some circumstances
  748.   but usually each interface will have its own address.
  749.  
  750.   Internet Protocol Networks are contiguous sequences of IP addresses.
  751.   All addresses within a network have a number of digits within the
  752.   address in common. The portion of the address that is common amongst
  753.   all addresses within the network is called the `network portion' of
  754.   the address. The remaining digits are called the `host portion'. The
  755.   number of bits that are shared by all addresses within a network is
  756.   called the netmask and it is role of the netmask to determine which
  757.   addresses belong to the network it is applied to and which don't. For
  758.   example, consider the following:
  759.  
  760.  
  761.  
  762.                -----------------  ---------------
  763.                Host Address       192.168.110.23
  764.                Network Mask       255.255.255.0
  765.                Network Portion    192.168.110.
  766.                Host portion                  .23
  767.                -----------------  ---------------
  768.                Network Address    192.168.110.0
  769.                Broadcast Address  192.168.110.255
  770.                -----------------  ---------------
  771.  
  772.  
  773.  
  774.  
  775.  
  776.   Any address that is 'bitwise anded' with its netmask will reveal the
  777.   address of the network it belongs to. The network address is therefore
  778.   always the lowest numbered address within the range of addresses on
  779.   the network and always has the host portion of the address coded all
  780.   zeroes.
  781.  
  782.   The broadcast address is a special address that every host on the
  783.   network listens to in addition to its own unique address. This address
  784.   is the one that datagrams are sent to if every host on the network is
  785.   meant to receive it. Certain types of data like routing information
  786.   and warning messages are transmitted to the broadcast address so that
  787.   every host on the network can receive it simultaneously. There are two
  788.   commonly used standards for what the broadcast address should be. The
  789.   most widely accepted one is to use the highest possible address on the
  790.   network as the broadcast address.  In the example above this would be
  791.   192.168.110.255. For some reason other sites have adopted the
  792.   convention of using the network address as the broadcast address. In
  793.   practice it doesn't matter very much which you use but you must make
  794.   sure that every host on the network is configured with the same
  795.   broadcast address.
  796.  
  797.   For administrative reasons some time early in the development of the
  798.   IP protocol some arbitrary groups of addresses were formed into
  799.   networks and these networks were grouped into what are called classes.
  800.   These classes provide a number of standard size networks that could be
  801.   allocated. The ranges allocated are:
  802.  
  803.  
  804.  
  805.                ----------------------------------------------------------
  806.                | Network | Netmask       | Network Addresses            |
  807.                | Class   |               |                              |
  808.                ----------------------------------------------------------
  809.                |    A    | 255.0.0.0     | 0.0.0.0    - 127.255.255.255 |
  810.                |    B    | 255.255.0.0   | 128.0.0.0  - 191.255.255.255 |
  811.                |    C    | 255.255.255.0 | 192.0.0.0  - 223.255.255.255 |
  812.                |Multicast| 240.0.0.0     | 224.0.0.0  - 239.255.255.255 |
  813.                ----------------------------------------------------------
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.   What addresses you should use depends on exactly what it is that you
  821.   are doing. You may have to use a combination of the following
  822.   activities to get all the addresses you need:
  823.  
  824.  
  825.  
  826.      Installing a linux machine on an existing IP network
  827.         If you wish to install a linux machine onto an existing IP
  828.         network then you should contact whoever administers the network
  829.         and ask them for the following information:
  830.  
  831.  
  832.      ╖  Host IP Address
  833.  
  834.      ╖  IP network address
  835.  
  836.      ╖  IP broadcast address
  837.  
  838.      ╖  IP netmask
  839.  
  840.      ╖  Router address
  841.  
  842.      ╖  Domain Name Server Address
  843.  
  844.  
  845.         You should then configure your linux network device with those
  846.         details.  You can not make them up and expect your configuration
  847.         to work.
  848.  
  849.  
  850.      Building a brand new network that will never connect to the
  851.         Internet" If you are building a private network and you never
  852.         intend that network to be connected to the Internet then you can
  853.         choose whatever addresses you like.  However, for safety and
  854.         consistency reasons there have been some IP network addresses
  855.         that have been reserved specifically for this purpose. These are
  856.         specified in RFC1597 and are as follows:
  857.  
  858.  
  859.              -----------------------------------------------------------
  860.              |         RESERVED PRIVATE NETWORK ALLOCATIONS            |
  861.              -----------------------------------------------------------
  862.              | Network | Netmask       | Network Addresses             |
  863.              | Class   |               |                               |
  864.              -----------------------------------------------------------
  865.              |    A    | 255.0.0.0     | 10.0.0.0    - 10.255.255.255  |
  866.              |    B    | 255.255.0.0   | 172.16.0.0  - 172.31.255.255  |
  867.              |    C    | 255.255.255.0 | 192.168.0.0 - 192.168.255.255 |
  868.              -----------------------------------------------------------
  869.  
  870.  
  871.  
  872.  
  873.  
  874.  
  875.      You should first decide how large you want your network to be and
  876.      then choose as many of the addresses as you require.
  877.  
  878.  
  879.   5.2.  Where should I put the configuration commands ?
  880.  
  881.   There are a few different approaches to Linux system boot procedures.
  882.   After the kernel boots, it always executes a program called `init'.
  883.   The init program then reads its configuration file called /etc/inittab
  884.   and commences the boot process. There are a few different flavours of
  885.   init around, although everyone is now converging to the System V
  886.   (Five) flavour, developed by Miguel van Smoorenburg.
  887.  
  888.   Despite the fact that the init program is always the same, the setup
  889.   of system boot is organized in a different way by each distribution.
  890.  
  891.   Usually the /etc/inittab file contains an entry looking something
  892.   like:
  893.  
  894.  
  895.  
  896.                si::sysinit:/etc/init.d/boot
  897.  
  898.  
  899.  
  900.  
  901.  
  902.   This line specifies the name of the shell script file that actually
  903.   manages the boot sequence. This file is somewhat equivalent to the
  904.   AUTOEXEC.BAT file in MS-DOS.
  905.  
  906.   There are usually other scripts that are called by the boot script and
  907.   often the network is configured within one of many of these.
  908.  
  909.   The following table may be used as a guide for your system:
  910.  
  911.  
  912.  
  913.        ---------------------------------------------------------------------------
  914.        Distrib. | Interface Config/Routing          | Server Initialization
  915.        ---------------------------------------------------------------------------
  916.        Debian   | /etc/init.d/network               | /etc/rc2.d/*
  917.        ---------------------------------------------------------------------------
  918.        Slackware| /etc/rc.d/rc.inet1                | /etc/rc.d/rc.inet2
  919.        ---------------------------------------------------------------------------
  920.        RedHat   | /etc/rc.d/init.d/network          | /etc/rc.d/rc3.d/*
  921.        ---------------------------------------------------------------------------
  922.  
  923.  
  924.  
  925.   Note that Debian and Red Hat use a whole directory to host scripts
  926.   that fire up system services (and usually information does not lie
  927.   within these files, for example Red Hat systems store all of system
  928.   configuration in files under /etc/sysconfig, whence it is retrieved by
  929.   boot scripts). If you want to grasp the details of the boot process,
  930.   my suggestion is to check /etc/inittab and the documentation that
  931.   accompanies init. Linux Journal is also going to publish an article
  932.   about system initialization, and this document will point to it as
  933.   soon as it is available on the web.
  934.  
  935.   Most modern distributions include a program that will allow you to
  936.   configure many of the common sorts of network interfaces. If you have
  937.   one of these then you should see if it will do what you want before
  938.   attempting a manual configuration.
  939.  
  940.  
  941.  
  942.                -----------------------------------------
  943.                Distrib   | Network configuration program
  944.                -----------------------------------------
  945.                RedHat    | /usr/bin/netcfg
  946.                Slackware | /sbin/netconfig
  947.                -----------------------------------------
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.   5.3.  Creating your network interfaces.
  955.  
  956.   In many Unix operating systems the network devices have appearances in
  957.   the /dev directory. This is not so in Linux. In Linux the network
  958.   devices are created dynamically in software and do not require device
  959.   files to be present.
  960.  
  961.   In the majority of cases the network device is automatically created
  962.   by the device driver while it is initializing and has located your
  963.   hardware. For example, the ethernet device driver creates eth[0..n]
  964.   interfaces sequentially as it locates your ethernet hardware. The
  965.   first ethernet card found becomes eth0, the second eth1 etc.
  966.  
  967.   In some cases though, notably slip and ppp, the network devices are
  968.   created through the action of some user program. The same sequential
  969.   device numbering applies, but the devices are not created
  970.   automatically at boot time. The reason for this is that unlike
  971.   ethernet devices, the number of active slip or ppp devices may vary
  972.   during the uptime of the machine. These cases will be covered in more
  973.   detail in later sections.
  974.  
  975.   5.4.  Configuring a network interface.
  976.  
  977.   When you have all of the programs you need and your address and
  978.   network information you can configure your network interfaces. When we
  979.   talk about configuring a network interface we are talking about the
  980.   process of assigning appropriate addresses to a network device and to
  981.   setting appropriate values for other configurable parameters of a
  982.   network device. The program most commonly used to do this is the
  983.   ifconfig (interface configure) command.
  984.  
  985.   Typically you would use a command similar to the following:
  986.  
  987.  
  988.  
  989.  
  990.  
  991.           root# ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up
  992.  
  993.  
  994.  
  995.  
  996.  
  997.  
  998.   In this case I'm configuring an ethernet interface `eth0' with the IP
  999.   address `192.168.0.1' and a network mask of `255.255.255.0'.  The `up'
  1000.   that trails the command tells the interface that it should become
  1001.   active, but can usually be omitted, as it is the default. To shutdown
  1002.   an interface, you can just call ``ifconfig eth0 down''.
  1003.  
  1004.   The kernel assumes certain defaults when configuring interfaces. For
  1005.   example, you may specify the network address and broadcast address for
  1006.   an interface, but if you don't, as in my example above, then the
  1007.   kernel will make reasonable guesses as to what they should be based on
  1008.   the netmask you supply and if you don't supply a netmask then on the
  1009.   network class of the IP address configured.  In my example the kernel
  1010.   would assume that it is a class-C network being configured on the
  1011.   interface and configure a network address of `192.168.0.0' and a
  1012.   broadcast address of `192.168.0.255' for the interface.
  1013.  
  1014.   There are many other options to the ifconfig command. The most
  1015.   important of these are:
  1016.  
  1017.  
  1018.      up this option activates an interface (and is the default).
  1019.  
  1020.      down
  1021.         this option deactivates an interface.
  1022.  
  1023.      [-]arp
  1024.         this option enables or disables use of the address resolution
  1025.         protocol on this interface
  1026.  
  1027.      [-]allmulti
  1028.         this option enables or disables the reception of all hardware
  1029.         multicast packets. Hardware multicast enables groups of hosts to
  1030.         receive packets addressed to special destinations. This may be
  1031.         of importance if you are using applications like desktop
  1032.         videoconferencing but is normally not used.
  1033.  
  1034.      mtu N
  1035.         this parameter allows you to set the MTU of this device.
  1036.  
  1037.      netmask <addr>
  1038.         this parameter allows you to set the network mask of the network
  1039.         this device belongs to.
  1040.  
  1041.      irq <addr>
  1042.         this parameter only works on certain types of hardware and
  1043.         allows you to set the IRQ of the hardware of this device.
  1044.  
  1045.      [-]broadcast [addr]
  1046.         this parameter allows you to enable and set the accepting of
  1047.         datagrams destined to the broadcast address, or to disable
  1048.         reception of these datagrams.
  1049.  
  1050.      [-]pointopoint [addr]
  1051.         this parameter allows you to set the address of the machine at
  1052.         the remote end of a point to point link such as for slip or ppp.
  1053.  
  1054.      hw <type> <addr>
  1055.         this parameter allows you to set the hardware address of certain
  1056.         types of network devices. This is not often useful for ethernet,
  1057.         but is useful for other network types such as AX.25.
  1058.  
  1059.  
  1060.   You may use the ifconfig command on any network interface. Some user
  1061.   programs such as pppd and dip automatically configure the network
  1062.   devices as they create them, so manual use of ifconfig is unnecessary.
  1063.  
  1064.   5.5.  Configuring your Name Resolver.
  1065.  
  1066.   The `Name Resolver' is a part of the linux standard library. Its prime
  1067.   function is to provide a service to convert human-friendly hostnames
  1068.   like `ftp.funet.fi' into machine friendly IP addresses such as
  1069.   128.214.248.6.
  1070.  
  1071.   5.5.1.  What's in a name ?
  1072.  
  1073.   You will probably be familiar with the appearance of Internet host
  1074.   names, but may not understand how they are constructed, or
  1075.   deconstructed. Internet domain names are hierarchical in nature, that
  1076.   is, they have a tree-like structure. A `domain' is a family, or group
  1077.   of names. A `domain' may be broken down into `subdomain'. A `toplevel
  1078.   domain' is a domain that is not a subdomain. The Top Level Domains are
  1079.   specified in RFC-920. Some examples of the most common top level
  1080.   domains are:
  1081.  
  1082.  
  1083.      COM
  1084.         Commercial Organizations
  1085.  
  1086.      EDU
  1087.         Educational Organizations
  1088.  
  1089.      GOV
  1090.         Government Organizations
  1091.  
  1092.      MIL
  1093.         Military Organizations
  1094.  
  1095.      ORG
  1096.         Other organizations
  1097.  
  1098.      NET
  1099.         Internet-Related Organizations
  1100.  
  1101.      Country Designator
  1102.         these are two letters codes that represent a particular country.
  1103.  
  1104.  
  1105.   For historical reasons most domains belonging to one of the non-
  1106.   country based top level domains were used by organizations within the
  1107.   United States, although the United States also has its own country
  1108.   code `.us'. This is not true any more for .com and .org domains, which
  1109.   are commonly used by non-us companies.
  1110.  
  1111.   Each of these top level domains has subdomains. The top level domains
  1112.   based on country name are often next broken down into subdomains based
  1113.   on the com, edu, gov, mil and org domains. So for example you end up
  1114.   with: com.au and gov.au for commercial and government organizations in
  1115.   Australia; note that this is not a general rule, as actual policies
  1116.   depend on the naming authority for each domain.
  1117.  
  1118.   The next level of division usually represents the name of the
  1119.   organization.  Further subdomains vary in nature, often the next level
  1120.   of subdomain is based on the departmental structure of the
  1121.   organization but it may be based on any criterion considered
  1122.   reasonable and meaningful by the network administrators for the
  1123.   organization.
  1124.  
  1125.   The very left-most portion of the name is always the unique name
  1126.   assigned to the host machine and is called the `hostname', the portion
  1127.   of the name to the right of the hostname is called the `domainname'
  1128.   and the complete name is called the `Fully Qualified Domain Name'.
  1129.  
  1130.   To use Terry's host as an example, the fully qualified domain name is
  1131.   `perf.no.itg.telstra.com.au'. This means that the host name is `perf'
  1132.   and the domain name is `no.itg.telstra.com.au'. The domain name is
  1133.   based on a top level domain based on his country, Australia and as his
  1134.   email address belongs to a commercial organization, `.com' is there as
  1135.   the next level domain. The name of the company is (was) `telstra' and
  1136.   their internal naming structure is based on organizational structure,
  1137.   in this case the machine belongs to the Information Technology Group,
  1138.   Network Operations section.
  1139.  
  1140.   Usually, the names are fairly shorter; for example, my ISP is called
  1141.   ``systemy.it'' and my non-profit organization is called ``linux.it'',
  1142.   without any com and org subdomain, so that my own host is just called
  1143.   ``morgana.systemy.it'' and rubini@linux.it is a valid email address.
  1144.   Note that the owner of a domain has the rights to register hostnames
  1145.   as well as subdomains; for example, the LUG I belong to uses the
  1146.   domain pluto.linux.it, because the owners of linux.it agreed to open a
  1147.   subdomain for the LUG.
  1148.  
  1149.   5.5.2.  What information you will need.
  1150.  
  1151.   You will need to know what domain your hosts name will belong to. The
  1152.   name resolver software provides this name translation service by
  1153.   making requests to a `Domain Name Server', so you will need to know
  1154.   the IP address of a local nameserver that you can use.
  1155.  
  1156.   There are three files you need to edit, I'll cover each of these in
  1157.   turn.
  1158.  
  1159.   5.5.3.  /etc/resolv.conf
  1160.  
  1161.   The /etc/resolv.conf is the main configuration file for the name
  1162.   resolver code. Its format is quite simple. It is a text file with one
  1163.   keyword per line. There are three keywords typically used, they are:
  1164.  
  1165.  
  1166.      domain
  1167.         this keyword specifies the local domain name.
  1168.  
  1169.      search
  1170.         this keyword specifies a list of alternate domain names to
  1171.         search for a hostname
  1172.  
  1173.      nameserver
  1174.         this keyword, which may be used many times, specifies an IP
  1175.         address of a domain name server to query when resolving names
  1176.  
  1177.  
  1178.   An example /etc/resolv.conf might look something like:
  1179.  
  1180.  
  1181.  
  1182.                domain maths.wu.edu.au
  1183.                search maths.wu.edu.au wu.edu.au
  1184.                nameserver 192.168.10.1
  1185.                nameserver 192.168.12.1
  1186.  
  1187.  
  1188.  
  1189.   This example specifies that the default domain name to append to
  1190.   unqualified names (ie hostnames supplied without a domain) is
  1191.   maths.wu.edu.au and that if the host is not found in that domain to
  1192.   also try the wu.edu.au domain directly. Two nameservers entry are
  1193.   supplied, each of which may be called upon by the name resolver code
  1194.   to resolve the name.
  1195.  
  1196.   5.5.4.  /etc/host.conf
  1197.  
  1198.   The /etc/host.conf file is where you configure some items that govern
  1199.   the behaviour of the name resolver code. The format of this file is
  1200.   described in detail in the `resolv+' man page. In nearly all
  1201.   circumstances the following example will work for you:
  1202.  
  1203.  
  1204.  
  1205.  
  1206.                order hosts,bind
  1207.                multi on
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.   This configuration tells the name resolver to check the /etc/hosts
  1215.   file before attempting to query a nameserver and to return all valid
  1216.   addresses for a host found in the /etc/hosts file instead of just the
  1217.   first.
  1218.  
  1219.   5.5.5.  /etc/hosts
  1220.  
  1221.   The /etc/hosts file is where you put the name and IP address of local
  1222.   hosts. If you place a host in this file then you do not need to query
  1223.   the domain name server to get its IP Address. The disadvantage of
  1224.   doing this is that you must keep this file up to date yourself if the
  1225.   IP address for that host changes. In a well managed system the only
  1226.   hostnames that usually appear in this file are an entry for the
  1227.   loopback interface and the local hosts name.
  1228.  
  1229.  
  1230.  
  1231.                # /etc/hosts
  1232.                127.0.0.1      localhost loopback
  1233.                192.168.0.1    this.host.name
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.   You may specify more than one host name per line as demonstrated by
  1241.   the first entry, which is a standard entry for the loopback interface.
  1242.  
  1243.   5.5.6.  Running a name server
  1244.  
  1245.   If you want to run a local nameserver, you can do it easily. Please
  1246.   refer to the DNS-HOWTO <DNS-HOWTO.html> and to any documents included
  1247.   in your version of BIND (Berkeley Internet Name Domain).
  1248.  
  1249.   5.6.  Configuring your loopback interface.
  1250.  
  1251.   The `loopback' interface is a special type of interface that allows
  1252.   you to make connections to yourself. There are various reasons why you
  1253.   might want to do this, for example, you may wish to test some network
  1254.   software without interfering with anybody else on your network. By
  1255.   convention the IP address `127.0.0.1' has been assigned specifically
  1256.   for loopback. So no matter what machine you go to, if you open a
  1257.   telnet connection to 127.0.0.1 you will always reach the local host.
  1258.  
  1259.   Configuring the loopback interface is simple and you should ensure you
  1260.   do (but note that this task is usually performed by the standard
  1261.   initialization scripts).
  1262.  
  1263.  
  1264.  
  1265.                root# ifconfig lo 127.0.0.1
  1266.                root# route add -host 127.0.0.1 lo
  1267.  
  1268.  
  1269.  
  1270.  
  1271.  
  1272.  
  1273.   We'll talk more about the route command in the next section.
  1274.  
  1275.   5.7.  Routing.
  1276.  
  1277.   Routing is a big topic. It is easily possible to write large volumes
  1278.   of text about it. Most of you will have fairly simple routing
  1279.   requirements, some of you will not. I will cover some basic
  1280.   fundamentals of routing only.  If you are interested in more detailed
  1281.   information then I suggest you refer to the references provided at the
  1282.   start of the document.
  1283.  
  1284.   Let's start with a definition. What is IP routing ? Here is one that
  1285.   I'm using:
  1286.  
  1287.  
  1288.        IP Routing is the process by which a host with multiple net¡
  1289.        work connections decides where to deliver IP datagrams it
  1290.        has received.
  1291.  
  1292.  
  1293.  
  1294.   It might be useful to illustrate this with an example. Imagine a
  1295.   typical office router, it might have a PPP link off the Internet, a
  1296.   number of ethernet segments feeding the workstations and another PPP
  1297.   link off to another office. When the router receives a datagram on any
  1298.   of its network connections, routing is the mechanism that it uses to
  1299.   determine which interface it should send the datagram to next. Simple
  1300.   hosts also need to route, all Internet hosts have two network devices,
  1301.   one is the loopback interface described above and the other is the one
  1302.   it uses to talk to the rest of the network, perhaps an ethernet,
  1303.   perhaps a PPP or SLIP serial interface.
  1304.  
  1305.   Ok, so how does routing work ? Each host keeps a special list of
  1306.   routing rules, called a routing table. This table contains rows which
  1307.   typically contain at least three fields, the first is a destination
  1308.   address, the second is the name of the interface to which the datagram
  1309.   is to be routed and the third is optionally the IP address of another
  1310.   machine which will carry the datagram on its next step through the
  1311.   network. In linux you can see this table by using the following
  1312.   command:
  1313.  
  1314.  
  1315.  
  1316.                user% cat /proc/net/route
  1317.  
  1318.  
  1319.  
  1320.  
  1321.   or by using either of the following commands:
  1322.  
  1323.  
  1324.  
  1325.                user% /sbin/route -n
  1326.                user% netstat -r
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333.   The routing process is fairly simple: an incoming datagram is
  1334.   received, the destination address (who it is for) is examined and
  1335.   compared with each entry in the table. The entry that best matches
  1336.   that address is selected and the datagram is forwarded to the
  1337.   specified interface. If the gateway field is filled then the datagram
  1338.   is forwarded to that host via the specified interface, otherwise the
  1339.   destination address is assumed to be on the network supported by the
  1340.   interface.
  1341.  
  1342.   To manipulate this table a special command is used. This command takes
  1343.   command line arguments and converts them into kernel system calls that
  1344.   request the kernel to add, delete or modify entries in the routing
  1345.   table.  The command is called `route'.
  1346.  
  1347.   A simple example. Imagine you have an ethernet network. You've been
  1348.   told it is a class-C network with an address of 192.168.1.0. You've
  1349.   been supplied with an IP address of 192.168.1.10 for your use and have
  1350.   been told that 192.168.1.1 is a router connected to the Internet.
  1351.  
  1352.   The first step is to configure the interface as described earlier. You
  1353.   would use a command like:
  1354.  
  1355.  
  1356.  
  1357.                root# ifconfig eth0 192.168.1.10 netmask 255.255.255.0 up
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.   You now need to add an entry into the routing table to tell the kernel
  1365.   that datagrams for all hosts with addresses that match 192.168.1.*
  1366.   should be sent to the ethernet device. You would use a command similar
  1367.   to:
  1368.  
  1369.  
  1370.  
  1371.                root# route add -net 192.168.1.0 netmask 255.255.255.0 eth0
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.   Note the use of the `-net' argument to tell the route program that
  1379.   this entry is a network route. Your other choice here is a `-host'
  1380.   route which is a route that is specific to one IP address.
  1381.  
  1382.   This route will enable you to establish IP connections with all of the
  1383.   hosts on your ethernet segment. But what about all of the IP hosts
  1384.   that aren't on your ethernet segment ?
  1385.  
  1386.  
  1387.   It would be a very difficult job to have to add routes to every
  1388.   possible destination network, so there is a special trick that is used
  1389.   to simplify this task. The trick is called the `default' route. The
  1390.   default route matches every possible destination, but poorly, so that
  1391.   if any other entry exists that matches the required address it will be
  1392.   used instead of the default route. The idea of the default route is
  1393.   simply to enable you to say "and everything else should go here". In
  1394.   the example I've contrived you would use an entry like:
  1395.  
  1396.  
  1397.  
  1398.                root# route add default gw 192.168.1.1 eth0
  1399.  
  1400.  
  1401.  
  1402.  
  1403.  
  1404.  
  1405.   The `gw' argument tells the route command that the next argument is
  1406.   the IP address, or name, of a gateway or router machine which all
  1407.   datagrams matching this entry should be directed to for further
  1408.   routing.
  1409.  
  1410.   So, your complete configuration would look like:
  1411.  
  1412.  
  1413.  
  1414.                root# ifconfig eth0 192.168.1.10 netmask 255.255.255.0 up
  1415.                root# route add -net 192.168.1.0 netmask 255.255.255.0 eth0
  1416.                root# route add default gw 192.168.1.1 eth0
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.   If you take a close look at your network `rc' files you will find that
  1424.   at least one of them looks very similar to this. This is a very common
  1425.   configuration.
  1426.  
  1427.   Let's now look at a slightly more complicated routing configuration.
  1428.   Let's imagine we are configuring the router we looked at earlier, the
  1429.   one supporting the PPP link to the Internet and the lan segments
  1430.   feeding the workstations in the office. Lets imagine the router has
  1431.   three ethernet segments and one PPP link. Our routing configuration
  1432.   would look something like:
  1433.  
  1434.  
  1435.  
  1436.                root# route add -net 192.168.1.0 netmask 255.255.255.0 eth0
  1437.                root# route add -net 192.168.2.0 netmask 255.255.255.0 eth1
  1438.                root# route add -net 192.168.3.0 netmask 255.255.255.0 eth2
  1439.                root# route add default ppp0
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.   Each of the workstations would use the simpler form presented above,
  1447.   only the router needs to specify each of the network routes separately
  1448.   because for the workstations the default route mechanism will capture
  1449.   all of them letting the router worry about splitting them up
  1450.   appropriately. You may be wondering why the default route presented
  1451.   doesn't specify a `gw'.  The reason for this is simple, serial link
  1452.   protocols such as PPP and slip only ever have two hosts on their
  1453.   network, one at each end. To specify the host at the other end of the
  1454.   link as the gateway is pointless and redundant as there is no other
  1455.   choice, so you do not need to specify a gateway for these types of
  1456.   network connections. Other network types such as ethernet, arcnet or
  1457.   token ring do require the gateway to be specified as these networks
  1458.   support large numbers of hosts on them.
  1459.  
  1460.   5.7.1.  So what does the routed  program do ?
  1461.  
  1462.   The routing configuration described above is best suited to simple
  1463.   network arrangements where there are only ever single possible paths
  1464.   to destinations.  When you have a more complex network arrangement
  1465.   things get a little more complicated. Fortunately for most of you this
  1466.   won't be an issue.
  1467.  
  1468.   The big problem with `manual routing' or `static routing' as
  1469.   described, is that if a machine or link fails in your network then the
  1470.   only way you can direct your datagrams another way, if another way
  1471.   exists, is by manually intervening and executing the appropriate
  1472.   commands. Naturally this is clumsy, slow, impractical and hazard
  1473.   prone. Various techniques have been developed to automatically adjust
  1474.   routing tables in the event of network failures where there are
  1475.   alternate routes, all of these techniques are loosely grouped by the
  1476.   term `dynamic routing protocols'.
  1477.  
  1478.   You may have heard of some of the more common dynamic routing
  1479.   protocols. The most common are probably RIP (Routing Information
  1480.   Protocol) and OSPF (Open Shortest Path First Protocol). The Routing
  1481.   Information Protocol is very common on small networks such as small-
  1482.   medium sized corporate networks or building networks. OSPF is more
  1483.   modern and more capable at handling large network configurations and
  1484.   better suited to environments where there is a large number of
  1485.   possible paths through the network. Common implementations of these
  1486.   protocols are: `routed' - RIP and `gated' - RIP, OSPF and others.  The
  1487.   `routed' program is normally supplied with your Linux distribution or
  1488.   is included in the `NetKit' package detailed above.
  1489.  
  1490.   An example of where and how you might use a dynamic routing protocol
  1491.   might look something like the following:
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.       192.168.1.0 /                         192.168.2.0 /
  1520.          255.255.255.0                         255.255.255.0
  1521.        -                                     -
  1522.        |                                     |
  1523.        |   /-----\                 /-----\   |
  1524.        |   |     |ppp0   //    ppp0|     |   |
  1525.   eth0 |---|  A  |------//---------|  B  |---| eth0
  1526.        |   |     |     //          |     |   |
  1527.        |   \-----/                 \-----/   |
  1528.        |      \ ppp1             ppp1 /      |
  1529.        -       \                     /       -
  1530.                 \                   /
  1531.                  \                 /
  1532.                   \               /
  1533.                    \             /
  1534.                     \           /
  1535.                      \         /
  1536.                       \       /
  1537.                        \     /
  1538.                     ppp0\   /ppp1
  1539.                        /-----\
  1540.                        |     |
  1541.                        |  C  |
  1542.                        |     |
  1543.                        \-----/
  1544.                           |eth0
  1545.                           |
  1546.                      |---------|
  1547.                      192.168.3.0 /
  1548.                         255.255.255.0
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.   We have three routers A, B and C. Each supports one ethernet segment
  1555.   with a Class C IP network (netmask 255.255.255.0). Each router also
  1556.   has a PPP link to each of the other routers. The network forms a
  1557.   triangle.
  1558.  
  1559.   It should be clear that the routing table at router A could look like:
  1560.  
  1561.  
  1562.  
  1563.                root# route add -net 192.168.1.0 netmask 255.255.255.0 eth0
  1564.                root# route add -net 192.168.2.0 netmask 255.255.255.0 ppp0
  1565.                root# route add -net 192.168.3.0 netmask 255.255.255.0 ppp1
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.   This would work just fine until the link between router A and B should
  1573.   fail.  If that link failed then with the routing entry shown above
  1574.   hosts on the ethernet segment of A could not reach hosts on the
  1575.   ethernet segment on B because their datagram would be directed to
  1576.   router A's ppp0 link which is broken. They could still continue to
  1577.   talk to hosts on the ethernet segment of C and hosts on the C's
  1578.   ethernet segment could still talk to hosts on B's ethernet segment
  1579.   because the link between B and C is still intact.
  1580.  
  1581.   But wait, if A can talk to C and C can still talk to B, why shouldn't
  1582.   A route its datagrams for B via C and let C send them to B ? This is
  1583.   exactly the sort of problem that dynamic routing protocols like RIP
  1584.   were designed to solve. If each of the routers A, B and C were running
  1585.   a routing daemon then their routing tables would be automatically
  1586.   adjusted to reflect the new state of the network should any one of the
  1587.   links in the network fail.  To configure such a network is simple, at
  1588.   each router you need only do two things. In this case for Router A:
  1589.  
  1590.  
  1591.  
  1592.                root# route add -net 192.168.1.0 netmask 255.255.255.0 eth0
  1593.                root# /usr/sbin/routed
  1594.  
  1595.  
  1596.  
  1597.  
  1598.  
  1599.  
  1600.   The `routed' routing daemon automatically finds all active network
  1601.   ports when it starts and sends and listens for messages on each of the
  1602.   network devices to allow it to determine and update the routing table
  1603.   on the host.
  1604.  
  1605.   This has been a very brief explanation of dynamic routing and where
  1606.   you would use it. If you want more information then you should refer
  1607.   to the suggested references listed at the top of the document.
  1608.  
  1609.   The important points relating to dynamic routing are:
  1610.  
  1611.  
  1612.   1. You only need to run a dynamic routing protocol daemon when your
  1613.      Linux machine has the possibility of selecting multiple possible
  1614.      routes to a destination.
  1615.  
  1616.   2. The dynamic routing daemon will automatically modify your routing
  1617.      table to adjust to changes in your network.
  1618.  
  1619.   3. RIP is suited to small to medium sized networks.
  1620.  
  1621.  
  1622.   5.8.  Configuring your network servers and services.
  1623.  
  1624.   Network servers and services are those programs that allow a remote
  1625.   user to make user of your Linux machine. Server programs listen on
  1626.   network ports.  Network ports are a means of addressing a particular
  1627.   service on any particular host and are how a server knows the
  1628.   difference between an incoming telnet connection and an incoming ftp
  1629.   connection. The remote user establishes a network connection to your
  1630.   machine and the server program, the network daemon program, listening
  1631.   on that port accepts the connection and executes. There are two ways
  1632.   that network daemons may operate. Both are commonly employed in
  1633.   practice. The two ways are:
  1634.  
  1635.  
  1636.  
  1637.      standalone
  1638.         the network daemon program listens on the designated network
  1639.         port and when an incoming connection is made it manages the
  1640.         network connection itself to provide the service.
  1641.  
  1642.  
  1643.      slave to the inetd server
  1644.         the inetd server is a special network daemon program that
  1645.         specializes in managing incoming network connections. It has a
  1646.         configuration file which tells it what program needs to be run
  1647.         when an incoming connection is received. Any service port may be
  1648.         configured for either of the tcp or udp protcols. The ports are
  1649.         described in another file that we will talk about soon.
  1650.  
  1651.   There are two important files that we need to configure. They are the
  1652.   /etc/services file which assigns names to port numbers and the
  1653.   /etc/inetd.conf file which is the configuration file for the inetd
  1654.   network daemon.
  1655.  
  1656.   5.8.1.  /etc/services
  1657.  
  1658.   The /etc/services file is a simple database that associates a human
  1659.   friendly name to a machine friendly service port. Its format is quite
  1660.   simple. The file is a text file with each line representing and entry
  1661.   in the database. Each entry is comprised of three fields separated by
  1662.   any number of whitespace (tab or space) characters. The fields are:
  1663.  
  1664.  
  1665.     name      port/protocol        aliases     # comment
  1666.  
  1667.  
  1668.  
  1669.  
  1670.  
  1671.  
  1672.      name
  1673.         a single word name that represents the service being described.
  1674.  
  1675.  
  1676.      port/protocol
  1677.         this field is split into two subfields.
  1678.  
  1679.  
  1680.  
  1681.         port
  1682.            a number that specifies the port number the named service
  1683.            will be available on. Most of the common services have
  1684.            assigned service numbers. These are described in RFC-1340.
  1685.  
  1686.  
  1687.         protocol
  1688.            this subfield may be set to either tcp or udp.
  1689.  
  1690.  
  1691.         It is important to note that an entry of 18/tcp is very differ¡
  1692.         ent from an entry of 18/udp and that there is no technical rea¡
  1693.         son why the same service needs to exist on both. Normally common
  1694.         sense prevails and it is only if a particular service is avail¡
  1695.         able via both tcp and udp that you will see an entry for both.
  1696.  
  1697.  
  1698.      aliases
  1699.         other names that may be used to refer to this service entry.
  1700.  
  1701.  
  1702.   Any text appearing in a line after a `#' character is ignored and
  1703.   treated as a comment.
  1704.  
  1705.   5.8.1.1.  An example /etc/services  file.
  1706.  
  1707.   All modern linux distributions provide a good /etc/services file.
  1708.   Just in case you happen to be building a machine from the ground up,
  1709.   here is a copy of the /etc/services file supplied with an old Debian
  1710.   <http://www.debian.org/> distribution:
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.   # /etc/services:
  1718.   # $Id: services,v 1.3 1996/05/06 21:42:37 tobias Exp $
  1719.   #
  1720.   # Network services, Internet style
  1721.   #
  1722.   # Note that it is presently the policy of IANA to assign a single well-known
  1723.   # port number for both TCP and UDP; hence, most entries here have two entries
  1724.   # even if the protocol doesn't support UDP operations.
  1725.   # Updated from RFC 1340, ``Assigned Numbers'' (July 1992).  Not all ports
  1726.   # are included, only the more common ones.
  1727.  
  1728.   tcpmux          1/tcp                           # TCP port service multiplexer
  1729.   echo            7/tcp
  1730.   echo            7/udp
  1731.   discard         9/tcp           sink null
  1732.   discard         9/udp           sink null
  1733.   systat          11/tcp          users
  1734.   daytime         13/tcp
  1735.   daytime         13/udp
  1736.   netstat         15/tcp
  1737.   qotd            17/tcp          quote
  1738.   msp             18/tcp                          # message send protocol
  1739.   msp             18/udp                          # message send protocol
  1740.   chargen         19/tcp          ttytst source
  1741.   chargen         19/udp          ttytst source
  1742.   ftp-data        20/tcp
  1743.   ftp             21/tcp
  1744.   ssh             22/tcp                          # SSH Remote Login Protocol
  1745.   ssh             22/udp                          # SSH Remote Login Protocol
  1746.   telnet          23/tcp
  1747.   # 24 - private
  1748.   smtp            25/tcp          mail
  1749.   # 26 - unassigned
  1750.   time            37/tcp          timserver
  1751.   time            37/udp          timserver
  1752.   rlp             39/udp          resource        # resource location
  1753.   nameserver      42/tcp          name            # IEN 116
  1754.   whois           43/tcp          nicname
  1755.   re-mail-ck      50/tcp                          # Remote Mail Checking Protocol
  1756.   re-mail-ck      50/udp                          # Remote Mail Checking Protocol
  1757.   domain          53/tcp          nameserver      # name-domain server
  1758.   domain          53/udp          nameserver
  1759.   mtp             57/tcp                          # deprecated
  1760.   bootps          67/tcp                          # BOOTP server
  1761.   bootps          67/udp
  1762.   bootpc          68/tcp                          # BOOTP client
  1763.   bootpc          68/udp
  1764.   tftp            69/udp
  1765.   gopher          70/tcp                          # Internet Gopher
  1766.   gopher          70/udp
  1767.   rje             77/tcp          netrjs
  1768.   finger          79/tcp
  1769.   www             80/tcp          http            # WorldWideWeb HTTP
  1770.   www             80/udp                          # HyperText Transfer Protocol
  1771.   link            87/tcp          ttylink
  1772.   kerberos        88/tcp          kerberos5 krb5  # Kerberos v5
  1773.   kerberos        88/udp          kerberos5 krb5  # Kerberos v5
  1774.   supdup          95/tcp
  1775.   # 100 - reserved
  1776.   hostnames       101/tcp         hostname        # usually from sri-nic
  1777.   iso-tsap        102/tcp         tsap            # part of ISODE.
  1778.   csnet-ns        105/tcp         cso-ns          # also used by CSO name server
  1779.   csnet-ns        105/udp         cso-ns
  1780.   rtelnet         107/tcp                         # Remote Telnet
  1781.   rtelnet         107/udp
  1782.   pop-2           109/tcp         postoffice      # POP version 2
  1783.   pop-2           109/udp
  1784.   pop-3           110/tcp                         # POP version 3
  1785.   pop-3           110/udp
  1786.   sunrpc          111/tcp         portmapper      # RPC 4.0 portmapper TCP
  1787.   sunrpc          111/udp         portmapper      # RPC 4.0 portmapper UDP
  1788.   auth            113/tcp         authentication tap ident
  1789.   sftp            115/tcp
  1790.   uucp-path       117/tcp
  1791.   nntp            119/tcp         readnews untp   # USENET News Transfer Protocol
  1792.   ntp             123/tcp
  1793.   ntp             123/udp                         # Network Time Protocol
  1794.   netbios-ns      137/tcp                         # NETBIOS Name Service
  1795.   netbios-ns      137/udp
  1796.   netbios-dgm     138/tcp                         # NETBIOS Datagram Service
  1797.   netbios-dgm     138/udp
  1798.   netbios-ssn     139/tcp                         # NETBIOS session service
  1799.   netbios-ssn     139/udp
  1800.   imap2           143/tcp                         # Interim Mail Access Proto v2
  1801.   imap2           143/udp
  1802.   snmp            161/udp                         # Simple Net Mgmt Proto
  1803.   snmp-trap       162/udp         snmptrap        # Traps for SNMP
  1804.   cmip-man        163/tcp                         # ISO mgmt over IP (CMOT)
  1805.   cmip-man        163/udp
  1806.   cmip-agent      164/tcp
  1807.   cmip-agent      164/udp
  1808.   xdmcp           177/tcp                         # X Display Mgr. Control Proto
  1809.   xdmcp           177/udp
  1810.   nextstep        178/tcp         NeXTStep NextStep       # NeXTStep window
  1811.   nextstep        178/udp         NeXTStep NextStep       # server
  1812.   bgp             179/tcp                         # Border Gateway Proto.
  1813.   bgp             179/udp
  1814.   prospero        191/tcp                         # Cliff Neuman's Prospero
  1815.   prospero        191/udp
  1816.   irc             194/tcp                         # Internet Relay Chat
  1817.   irc             194/udp
  1818.   smux            199/tcp                         # SNMP Unix Multiplexer
  1819.   smux            199/udp
  1820.   at-rtmp         201/tcp                         # AppleTalk routing
  1821.   at-rtmp         201/udp
  1822.   at-nbp          202/tcp                         # AppleTalk name binding
  1823.   at-nbp          202/udp
  1824.   at-echo         204/tcp                         # AppleTalk echo
  1825.   at-echo         204/udp
  1826.   at-zis          206/tcp                         # AppleTalk zone information
  1827.   at-zis          206/udp
  1828.   z3950           210/tcp         wais            # NISO Z39.50 database
  1829.   z3950           210/udp         wais
  1830.   ipx             213/tcp                         # IPX
  1831.   ipx             213/udp
  1832.   imap3           220/tcp                         # Interactive Mail Access
  1833.   imap3           220/udp                         # Protocol v3
  1834.   ulistserv       372/tcp                         # UNIX Listserv
  1835.   ulistserv       372/udp
  1836.   #
  1837.   # UNIX specific services
  1838.   #
  1839.   exec            512/tcp
  1840.   biff            512/udp         comsat
  1841.   login           513/tcp
  1842.   who             513/udp         whod
  1843.   shell           514/tcp         cmd             # no passwords used
  1844.   syslog          514/udp
  1845.   printer         515/tcp         spooler         # line printer spooler
  1846.   talk            517/udp
  1847.   ntalk           518/udp
  1848.   route           520/udp         router routed   # RIP
  1849.   timed           525/udp         timeserver
  1850.   tempo           526/tcp         newdate
  1851.   courier         530/tcp         rpc
  1852.   conference      531/tcp         chat
  1853.   netnews         532/tcp         readnews
  1854.   netwall         533/udp                         # -for emergency broadcasts
  1855.   uucp            540/tcp         uucpd           # uucp daemon
  1856.   remotefs        556/tcp         rfs_server rfs  # Brunhoff remote filesystem
  1857.   klogin          543/tcp                         # Kerberized `rlogin' (v5)
  1858.   kshell          544/tcp         krcmd           # Kerberized `rsh' (v5)
  1859.   kerberos-adm    749/tcp                         # Kerberos `kadmin' (v5)
  1860.   #
  1861.   webster         765/tcp                         # Network dictionary
  1862.   webster         765/udp
  1863.   #
  1864.   # From ``Assigned Numbers'':
  1865.   #
  1866.   #> The Registered Ports are not controlled by the IANA and on most systems
  1867.   #> can be used by ordinary user processes or programs executed by ordinary
  1868.   #> users.
  1869.   #
  1870.   #> Ports are used in the TCP [45,106] to name the ends of logical
  1871.   #> connections which carry long term conversations.  For the purpose of
  1872.   #> providing services to unknown callers, a service contact port is
  1873.   #> defined.  This list specifies the port used by the server process as its
  1874.   #> contact port.  While the IANA can not control uses of these ports it
  1875.   #> does register or list uses of these ports as a convenience to the
  1876.   #> community.
  1877.   #
  1878.   ingreslock      1524/tcp
  1879.   ingreslock      1524/udp
  1880.   prospero-np     1525/tcp                # Prospero non-privileged
  1881.   prospero-np     1525/udp
  1882.   rfe             5002/tcp                # Radio Free Ethernet
  1883.   rfe             5002/udp                # Actually uses UDP only
  1884.   bbs             7000/tcp                # BBS service
  1885.   #
  1886.   #
  1887.   # Kerberos (Project Athena/MIT) services
  1888.   # Note that these are for Kerberos v4 and are unofficial.  Sites running
  1889.   # v4 should uncomment these and comment out the v5 entries above.
  1890.   #
  1891.   kerberos4       750/udp         kdc     # Kerberos (server) udp
  1892.   kerberos4       750/tcp         kdc     # Kerberos (server) tcp
  1893.   kerberos_master 751/udp                 # Kerberos authentication
  1894.   kerberos_master 751/tcp                 # Kerberos authentication
  1895.   passwd_server   752/udp                 # Kerberos passwd server
  1896.   krb_prop        754/tcp                 # Kerberos slave propagation
  1897.   krbupdate       760/tcp         kreg    # Kerberos registration
  1898.   kpasswd         761/tcp         kpwd    # Kerberos "passwd"
  1899.   kpop            1109/tcp                # Pop with Kerberos
  1900.   knetd           2053/tcp                # Kerberos de-multiplexor
  1901.   zephyr-srv      2102/udp                # Zephyr server
  1902.   zephyr-clt      2103/udp                # Zephyr serv-hm connection
  1903.   zephyr-hm       2104/udp                # Zephyr hostmanager
  1904.   eklogin         2105/tcp                # Kerberos encrypted rlogin
  1905.   #
  1906.   # Unofficial but necessary (for NetBSD) services
  1907.   #
  1908.   supfilesrv      871/tcp                 # SUP server
  1909.   supfiledbg      1127/tcp                # SUP debugging
  1910.   #
  1911.   # Datagram Delivery Protocol services
  1912.   #
  1913.   rtmp            1/ddp                   # Routing Table Maintenance Protocol
  1914.   nbp             2/ddp                   # Name Binding Protocol
  1915.   echo            4/ddp                   # AppleTalk Echo Protocol
  1916.   zip             6/ddp                   # Zone Information Protocol
  1917.   #
  1918.   # Debian GNU/Linux services
  1919.   rmtcfg          1236/tcp                # Gracilis Packeten remote config server
  1920.   xtel            1313/tcp                # french minitel
  1921.   cfinger         2003/tcp                # GNU Finger
  1922.   postgres        4321/tcp                # POSTGRES
  1923.   mandelspawn     9359/udp        mandelbrot      # network mandelbrot
  1924.  
  1925.   # Local services
  1926.  
  1927.  
  1928.  
  1929.  
  1930.  
  1931.   In the real world, the actual file is always growing as new services
  1932.   are being created. If you fear your own copy is incomplete, I'd
  1933.   suggest to copy a new /etc/services from a recent distribution.
  1934.  
  1935.   5.8.2.  /etc/inetd.conf
  1936.  
  1937.   The /etc/inetd.conf file is the configuration file for the inetd
  1938.   server daemon. Its function is to tell inetd what to do when it
  1939.   receives a connection request for a particular service. For each
  1940.   service that you wish to accept connections for you must tell inetd
  1941.   what network server daemon to run and how to run it.
  1942.  
  1943.   Its format is also fairly simple. It is a text file with each line
  1944.   describing a service that you wish to provide. Any text in a line
  1945.   following a `#' is ignored and considered a comment. Each line
  1946.   contains seven fields separated by any number of whitespace (tab or
  1947.   space) characters. The general format is as follows:
  1948.  
  1949.  
  1950.  
  1951.          service  socket_type  proto  flags  user  server_path  server_args
  1952.  
  1953.  
  1954.  
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960.      service
  1961.         is the service relevant to this configuration as taken from the
  1962.         /etc/services file.
  1963.  
  1964.  
  1965.      socket_type
  1966.         this field describes the type of socket that this entry will
  1967.         consider relevant, allowable values are: stream, dgram, raw,
  1968.         rdm, or seqpacket. This is a little technical in nature, but as
  1969.         a rule of thumb nearly all tcp based services use stream and
  1970.         nearly all udp based services use dgram. It is only very special
  1971.         types of server daemons that would use any of the other values.
  1972.  
  1973.  
  1974.      proto
  1975.         the protocol to considered valid for this entry. This should
  1976.         match the appropriate entry in the /etc/services file and will
  1977.         typically be either tcp or udp. Sun RPC (Remote Procedure Call)
  1978.         based servers will use rpc/tcp or rpc/udp.
  1979.  
  1980.  
  1981.      flags
  1982.         there are really only two possible settings for this field.
  1983.         This field setting tells inetd whether the network server
  1984.         program frees the socket after it has been started and therefore
  1985.         whether inetd can start another one on the next connection
  1986.         request, or whether inetd should wait and assume that any server
  1987.         daemon already running will handle the new connection request.
  1988.         Again this is a little tricky to work out, but as a rule of
  1989.         thumb all tcp servers should have this entry set to nowait and
  1990.         most udp servers should have this entry set to wait. Be warned
  1991.         there are some notable exceptions to this, so let the example
  1992.         guide you if you are not sure.
  1993.  
  1994.  
  1995.      user
  1996.         this field describes which user account from /etc/passwd will be
  1997.         set as the owner of the network daemon when it is started. This
  1998.         is often useful if you want to safeguard against security risks.
  1999.         You can set the user of an entry to the nobody user so that if
  2000.         the network server security is breached the possible damage is
  2001.         minimized.  Typically this field is set to root though, because
  2002.         many servers require root privileges in order to function
  2003.         correctly.
  2004.  
  2005.  
  2006.      server_path
  2007.         this field is pathname to the actual server program to execute
  2008.         for this entry.
  2009.  
  2010.  
  2011.      server_args
  2012.         this field comprises the rest of the line and is optional. This
  2013.         field is where you place any command line arguments that you
  2014.         wish to pass to the server daemon program when it is launched.
  2015.  
  2016.  
  2017.   5.8.2.1.  An example /etc/inetd.conf
  2018.  
  2019.   As for the /etc/services file all modern distributions will include a
  2020.   good /etc/inetd.conf file for you to work with. Here, for completeness
  2021.   is the /etc/inetd.conf file from the Debian <http://www.debian.org/>
  2022.   distribution.
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.   # /etc/inetd.conf:  see inetd(8) for further informations.
  2048.   #
  2049.   # Internet server configuration database
  2050.   #
  2051.   #
  2052.   # Modified for Debian by Peter Tobias <tobias@et-inf.fho-emden.de>
  2053.   #
  2054.   # <service_name> <sock_type> <proto> <flags> <user> <server_path> <args>
  2055.   #
  2056.   # Internal services
  2057.   #
  2058.   #echo           stream  tcp     nowait  root    internal
  2059.   #echo           dgram   udp     wait    root    internal
  2060.   discard         stream  tcp     nowait  root    internal
  2061.   discard         dgram   udp     wait    root    internal
  2062.   daytime         stream  tcp     nowait  root    internal
  2063.   daytime         dgram   udp     wait    root    internal
  2064.   #chargen        stream  tcp     nowait  root    internal
  2065.   #chargen        dgram   udp     wait    root    internal
  2066.   time            stream  tcp     nowait  root    internal
  2067.   time            dgram   udp     wait    root    internal
  2068.   #
  2069.   # These are standard services.
  2070.   #
  2071.   telnet  stream  tcp     nowait  root    /usr/sbin/tcpd  /usr/sbin/in.telnetd
  2072.   ftp     stream  tcp     nowait  root    /usr/sbin/tcpd  /usr/sbin/in.ftpd
  2073.   #fsp    dgram   udp     wait    root    /usr/sbin/tcpd  /usr/sbin/in.fspd
  2074.   #
  2075.   # Shell, login, exec and talk are BSD protocols.
  2076.   #
  2077.   shell   stream  tcp     nowait  root    /usr/sbin/tcpd  /usr/sbin/in.rshd
  2078.   login   stream  tcp     nowait  root    /usr/sbin/tcpd  /usr/sbin/in.rlogind
  2079.   #exec   stream  tcp     nowait  root    /usr/sbin/tcpd  /usr/sbin/in.rexecd
  2080.   talk    dgram   udp     wait    root    /usr/sbin/tcpd  /usr/sbin/in.talkd
  2081.   ntalk   dgram   udp     wait    root    /usr/sbin/tcpd  /usr/sbin/in.ntalkd
  2082.   #
  2083.   # Mail, news and uucp services.
  2084.   #
  2085.   smtp    stream  tcp     nowait  root    /usr/sbin/tcpd  /usr/sbin/in.smtpd
  2086.   #nntp   stream  tcp     nowait  news    /usr/sbin/tcpd  /usr/sbin/in.nntpd
  2087.   #uucp   stream  tcp     nowait  uucp    /usr/sbin/tcpd  /usr/lib/uucp/uucico
  2088.   #comsat dgram   udp     wait    root    /usr/sbin/tcpd  /usr/sbin/in.comsat
  2089.   #
  2090.   # Pop et al
  2091.   #
  2092.   #pop-2  stream  tcp     nowait  root    /usr/sbin/tcpd  /usr/sbin/in.pop2d
  2093.   #pop-3  stream  tcp     nowait  root    /usr/sbin/tcpd  /usr/sbin/in.pop3d
  2094.   #
  2095.   # `cfinger' is for the GNU finger server available for Debian.  (NOTE: The
  2096.   # current implementation of the `finger' daemon allows it to be run as `root'.)
  2097.   #
  2098.   #cfinger stream tcp     nowait  root    /usr/sbin/tcpd  /usr/sbin/in.cfingerd
  2099.   #finger stream  tcp     nowait  root    /usr/sbin/tcpd  /usr/sbin/in.fingerd
  2100.   #netstat        stream  tcp     nowait  nobody  /usr/sbin/tcpd  /bin/netstat
  2101.   #systat stream  tcp     nowait  nobody  /usr/sbin/tcpd  /bin/ps -auwwx
  2102.   #
  2103.   # Tftp service is provided primarily for booting.  Most sites
  2104.   # run this only on machines acting as "boot servers."
  2105.   #
  2106.   #tftp   dgram   udp     wait    nobody  /usr/sbin/tcpd  /usr/sbin/in.tftpd
  2107.   #tftp   dgram   udp     wait    nobody  /usr/sbin/tcpd  /usr/sbin/in.tftpd /boot
  2108.   #bootps dgram   udp     wait    root    /usr/sbin/bootpd        bootpd -i -t 120
  2109.   #
  2110.   # Kerberos authenticated services (these probably need to be corrected)
  2111.   #
  2112.   #klogin         stream  tcp     nowait  root    /usr/sbin/tcpd  /usr/sbin/in.rlogind -k
  2113.   #eklogin        stream  tcp     nowait  root    /usr/sbin/tcpd  /usr/sbin/in.rlogind -k -x
  2114.   #kshell         stream  tcp     nowait  root    /usr/sbin/tcpd  /usr/sbin/in.rshd -k
  2115.   #
  2116.   # Services run ONLY on the Kerberos server (these probably need to be corrected)
  2117.   #
  2118.   #krbupdate      stream tcp      nowait  root    /usr/sbin/tcpd  /usr/sbin/registerd
  2119.   #kpasswd        stream  tcp     nowait  root    /usr/sbin/tcpd  /usr/sbin/kpasswdd
  2120.   #
  2121.   # RPC based services
  2122.   #
  2123.   #mountd/1       dgram   rpc/udp wait    root    /usr/sbin/tcpd  /usr/sbin/rpc.mountd
  2124.   #rstatd/1-3     dgram   rpc/udp wait    root    /usr/sbin/tcpd  /usr/sbin/rpc.rstatd
  2125.   #rusersd/2-3    dgram   rpc/udp wait    root    /usr/sbin/tcpd  /usr/sbin/rpc.rusersd
  2126.   #walld/1        dgram   rpc/udp wait    root    /usr/sbin/tcpd  /usr/sbin/rpc.rwalld
  2127.   #
  2128.   # End of inetd.conf.
  2129.   ident           stream  tcp     nowait  nobody  /usr/sbin/identd        identd -i
  2130.  
  2131.  
  2132.  
  2133.  
  2134.  
  2135.   5.9.  Other miscellaneous network related configuration files.
  2136.  
  2137.   There are a number of miscellaneous files relating to network
  2138.   configuration under linux that you might be interested in. You may
  2139.   never have to modify these files, but it is worth describing them so
  2140.   you know what they contain and what they are for.
  2141.  
  2142.   5.9.1.  /etc/protocols
  2143.  
  2144.   The /etc/protocols file is a database that maps protocol id numbers
  2145.   against protocol names. This is used by programmers to allow them to
  2146.   specify protocols by name in their programs and also by some programs
  2147.   such as tcpdump to allow them to display names instead of numbers in
  2148.   their output. The general syntax of the file is:
  2149.  
  2150.  
  2151.  
  2152.          protocolname  number  aliases
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.   The /etc/protocols file supplied with the Debian
  2160.   <http://www.debian.org/> distribution is as follows:
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.   # /etc/protocols:
  2180.   # $Id: protocols,v 1.1 1995/02/24 01:09:41 imurdock Exp $
  2181.   #
  2182.   # Internet (IP) protocols
  2183.   #
  2184.   #       from: @(#)protocols     5.1 (Berkeley) 4/17/89
  2185.   #
  2186.   # Updated for NetBSD based on RFC 1340, Assigned Numbers (July 1992).
  2187.  
  2188.   ip      0       IP              # internet protocol, pseudo protocol number
  2189.   icmp    1       ICMP            # internet control message protocol
  2190.   igmp    2       IGMP            # Internet Group Management
  2191.   ggp     3       GGP             # gateway-gateway protocol
  2192.   ipencap 4       IP-ENCAP        # IP encapsulated in IP (officially ``IP'')
  2193.   st      5       ST              # ST datagram mode
  2194.   tcp     6       TCP             # transmission control protocol
  2195.   egp     8       EGP             # exterior gateway protocol
  2196.   pup     12      PUP             # PARC universal packet protocol
  2197.   udp     17      UDP             # user datagram protocol
  2198.   hmp     20      HMP             # host monitoring protocol
  2199.   xns-idp 22      XNS-IDP         # Xerox NS IDP
  2200.   rdp     27      RDP             # "reliable datagram" protocol
  2201.   iso-tp4 29      ISO-TP4         # ISO Transport Protocol class 4
  2202.   xtp     36      XTP             # Xpress Tranfer Protocol
  2203.   ddp     37      DDP             # Datagram Delivery Protocol
  2204.   idpr-cmtp       39      IDPR-CMTP       # IDPR Control Message Transport
  2205.   rspf    73      RSPF            # Radio Shortest Path First.
  2206.   vmtp    81      VMTP            # Versatile Message Transport
  2207.   ospf    89      OSPFIGP         # Open Shortest Path First IGP
  2208.   ipip    94      IPIP            # Yet Another IP encapsulation
  2209.   encap   98      ENCAP           # Yet Another IP encapsulation
  2210.  
  2211.  
  2212.  
  2213.  
  2214.  
  2215.  
  2216.   5.9.2.  /etc/networks
  2217.  
  2218.   The /etc/networks file has a similar function to that of the
  2219.   /etc/hosts file. It provides a simple database of network names
  2220.   against network addresses. Its format differs in that there may be
  2221.   only two fields per line and that the fields are coded as:
  2222.  
  2223.  
  2224.  
  2225.          networkname networkaddress
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.   An example might look like:
  2233.  
  2234.  
  2235.  
  2236.                loopnet    127.0.0.0
  2237.                localnet   192.168.0.0
  2238.                amprnet    44.0.0.0
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.   When you use commands like the route command, if a destination is a
  2246.   network and that network has an entry in the /etc/networks file then
  2247.   the route command will display that network name instead of its
  2248.   address.
  2249.  
  2250.   5.10.  Network Security and access control.
  2251.  
  2252.   Let me start this section by warning you that securing your machine
  2253.   and network against malicious attack is a complex art. I do not
  2254.   consider myself an expert in this field at all and while the following
  2255.   mechanisms I describe will help, if you are serious about security
  2256.   then I recommend you do some research of your own into the subject.
  2257.   There are many good references on the Internet relating to the
  2258.   subject, including the Security-HOWTO <Security-HOWTO.html>
  2259.  
  2260.   An important rule of thumb is: `Don't run servers you don't intend to
  2261.   use'.  Many distributions come configured with all sorts of services
  2262.   configured and automatically started. To ensure even a minimum level
  2263.   of safety you should go through your /etc/inetd.conf file and comment
  2264.   out (place a `#' at the start of the line) any entries for services
  2265.   you don't intend to use.  Good candidates are services such as: shell,
  2266.   login, exec, uucp, ftp and informational services such as finger,
  2267.   netstat and systat.
  2268.  
  2269.   There are all sorts of security and access control mechanisms, I'll
  2270.   describe the most elementary of them.
  2271.  
  2272.   5.10.1.  /etc/ftpusers
  2273.  
  2274.   The /etc/ftpusers file is a simple mechanism that allows you to deny
  2275.   certain users from logging into your machine via ftp. The
  2276.   /etc/ftpusers file is read by the ftp daemon program (ftpd) when an
  2277.   incoming ftp connection is received. The file is a simple list of
  2278.   those users who are disallowed from logging in. It might looks
  2279.   something like:
  2280.  
  2281.  
  2282.  
  2283.                # /etc/ftpusers - users not allowed to login via ftp
  2284.                root
  2285.                uucp
  2286.                bin
  2287.                mail
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.   5.10.2.  /etc/securetty
  2295.  
  2296.   The /etc/securetty file allows you to specify which tty devices root
  2297.   is allowed to login on. The /etc/securetty file is read by the login
  2298.   program (usually /bin/login). Its format is a list of the tty devices
  2299.   names allowed, on all others root login is disallowed:
  2300.  
  2301.  
  2302.  
  2303.                # /etc/securetty - tty's on which root is allowed to login
  2304.                tty1
  2305.                tty2
  2306.                tty3
  2307.                tty4
  2308.  
  2309.  
  2310.  
  2311.   5.10.3.  The tcpd  hosts access control mechanism.
  2312.  
  2313.   The tcpd program you will have seen listed in the same /etc/inetd.conf
  2314.   provides logging and access control mechanisms to services it is
  2315.   configured to protect.
  2316.  
  2317.   When it is invoked by the inetd program it reads two files containing
  2318.   access rules and either allows or denies access to the server it is
  2319.   protecting accordingly.
  2320.  
  2321.   It will search the rules files until the first match is found. If no
  2322.   match is found then it assumes that access should be allowed to
  2323.   anyone. The files it searches in sequence are: /etc/hosts.allow,
  2324.   /etc/hosts.deny.  I'll describe each of these in turn. For a complete
  2325.   description of this facility you should refer to the appropriate man
  2326.   pages (hosts_access(5) is a good starting point).
  2327.  
  2328.   5.10.3.1.  /etc/hosts.allow
  2329.  
  2330.   The /etc/hosts.allow file is a configuration file of the
  2331.   /usr/sbin/tcpd program. The hosts.allow file contains rules describing
  2332.   which hosts are allowed access to a service on your machine.
  2333.  
  2334.   The file format is quite simple:
  2335.  
  2336.  
  2337.  
  2338.                # /etc/hosts.allow
  2339.                #
  2340.                # <service list>: <host list> [: command]
  2341.  
  2342.  
  2343.  
  2344.  
  2345.  
  2346.  
  2347.  
  2348.  
  2349.      service list
  2350.         is a comma delimited list of server names that this rule applies
  2351.         to.  Example server names are: ftpd, telnetd and fingerd.
  2352.  
  2353.  
  2354.      host list
  2355.         is a comma delimited list of host names. You may also use IP
  2356.         addresses here. You may additionally specify hostnames or
  2357.         addresses using wildcard characters to match groups of hosts.
  2358.         Examples include: gw.vk2ktj.ampr.org to match a specific host,
  2359.         .uts.edu.au to match any hostname ending in that string, 44. to
  2360.         match any IP address commencing with those digits.  There are
  2361.         some special tokens to simplify configuration, some of these
  2362.         are: ALL matches every host, LOCAL matches any host whose name
  2363.         does not contain a `.' ie is in the same domain as your machine
  2364.         and PARANOID matches any host whose name does not match its
  2365.         address (name spoofing). There is one last token that is also
  2366.         useful. The EXCEPT token allows you to provide a list with
  2367.         exceptions. This will be covered in an example later.
  2368.  
  2369.  
  2370.      command
  2371.         is an optional parameter. This parameter is the full pathname of
  2372.         a command that would be executed everytime this rule is matched.
  2373.         It could for example run a command that would attempt to
  2374.         identify who is logged onto the connecting host, or to generate
  2375.         a mail message or some other warning to a system administrator
  2376.         that someone is attempting to connect. There are a number of
  2377.         expansions that may be included, some common examples are: %h
  2378.         expands to the name of the connecting host or address if it
  2379.         doesn't have a name, %d the daemon name being called.
  2380.  
  2381.  
  2382.   An example:
  2383.  
  2384.  
  2385.  
  2386.          # /etc/hosts.allow
  2387.          #
  2388.          # Allow mail to anyone
  2389.          in.smtpd: ALL
  2390.          # All telnet and ftp to only hosts within my domain and my host at home.
  2391.          telnetd, ftpd: LOCAL, myhost.athome.org.au
  2392.          # Allow finger to anyone but keep a record of who they are.
  2393.          fingerd: ALL: (finger @%h | mail -s "finger from %h" root)
  2394.  
  2395.  
  2396.  
  2397.  
  2398.  
  2399.  
  2400.   5.10.3.2.  /etc/hosts.deny
  2401.  
  2402.   The /etc/hosts.deny file is a configuration file of the /usr/sbin/tcpd
  2403.   program. The hosts.deny file contains rules describing which hosts are
  2404.   disallowed access to a service on your machine.
  2405.  
  2406.   A simple sample would look something like this:
  2407.  
  2408.  
  2409.  
  2410.          # /etc/hosts.deny
  2411.          #
  2412.          # Disallow all hosts with suspect hostnames
  2413.          ALL: PARANOID
  2414.          #
  2415.          # Disallow all hosts.
  2416.          ALL: ALL
  2417.  
  2418.  
  2419.  
  2420.  
  2421.  
  2422.  
  2423.   The PARANOID entry is really redundant because the other entry traps
  2424.   everything in any case. Either of these entry would make a reasonable
  2425.   default depending on your particular requirement.
  2426.  
  2427.   Having an ALL: ALL default in the /etc/hosts.deny and then
  2428.   specifically enabling on those services and hosts that you want in the
  2429.   /etc/hosts.allow file is the safest configuration.
  2430.  
  2431.   5.10.4.  /etc/hosts.equiv
  2432.  
  2433.   The hosts.equiv file is used to grant certain hosts and users access
  2434.   rights to accounts on your machine without having to supply a
  2435.   password. This is useful in a secure environment where you control all
  2436.   machines, but is a security hazard otherwise. Your machine is only as
  2437.   secure as the least secure of the trusted hosts. To maximize security,
  2438.   don't use this mechanism and encourage your users not to use the
  2439.   .rhosts file as well.
  2440.  
  2441.  
  2442.  
  2443.   5.10.5.  Configure your ftp  daemon properly.
  2444.  
  2445.   Many sites will be interested in running an anonymous ftp server to
  2446.   allow other people to upload and download files without requiring a
  2447.   specific userid. If you decide to offer this facility make sure you
  2448.   configure the ftp daemon properly for anonymous access. Most man pages
  2449.   for ftpd(8) describe in some length how to go about this. You should
  2450.   always ensure that you follow these instructions. An important tip is
  2451.   to not use a copy of your /etc/passwd file in the anonymous account
  2452.   /etc directory, make sure you strip out all account details except
  2453.   those that you must have, otherwise you will be vulnerable to brute
  2454.   force password cracking techniques.
  2455.  
  2456.   5.10.6.  Network Firewalling.
  2457.  
  2458.   Not allowing datagrams to even reach your machine or servers is an
  2459.   excellent means of security. This is covered in depth in the Firewall-
  2460.   HOWTO <Firewall-HOWTO.html>, and (more concisely) in a later section
  2461.   of this document.
  2462.  
  2463.   5.10.7.  Other suggestions.
  2464.  
  2465.   Here are some other, potentially religious suggestions for you to
  2466.   consider.
  2467.  
  2468.  
  2469.  
  2470.      sendmail
  2471.         despite its popularity the sendmail daemon appears with
  2472.         frightening regularity on security warning announcements. Its up
  2473.         to you, but I choose not to run it.
  2474.  
  2475.  
  2476.      NFS and other Sun RPC services
  2477.         be wary of these. There are all sorts of possible exploits for
  2478.         these services. It is difficult finding an option to services
  2479.         like NFS, but if you configure them, make sure you are careful
  2480.         with who you allow mount rights to.
  2481.  
  2482.  
  2483.   6.  IP- and Ethernet-Related Information
  2484.  
  2485.   This section covers information specific to Ethernet and IP. These
  2486.   subsections have been grouped together because I think they are the
  2487.   most interesting ones in the formerly-called ``Technology Specific''
  2488.   Section. Anyone with a LAN should be able to benefit from these
  2489.   goodies.
  2490.  
  2491.   6.1.  Ethernet
  2492.  
  2493.   Ethernet device names are `eth0', `eth1', `eth2' etc. The first card
  2494.   detected by the kernel is assigned `eth0' and the rest are assigned
  2495.   sequentially in the order they are detected.
  2496.  
  2497.   By default, the Linux kernel only probes for one Ethernet device, you
  2498.   need to pass command line arguments to the kernel in order to force
  2499.   detection of furter boards.
  2500.  
  2501.   To learn how to make your ethernet card(s) working under Linux you
  2502.   should refer to the Ethernet-HOWTO <Ethernet-HOWTO.html>.
  2503.  
  2504.   Once you have your kernel properly built to support your ethernet card
  2505.   then configuration of the card is easy.
  2506.  
  2507.   Typically you would use something like (which most distributions
  2508.   already do for you, if you configured them to support your ethernet):
  2509.                root# ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up
  2510.                root# route add -net 192.168.0.0 netmask 255.255.255.0 eth0
  2511.  
  2512.  
  2513.  
  2514.  
  2515.  
  2516.  
  2517.   Most of the ethernet drivers were developed by Donald Becker,
  2518.   becker@CESDIS.gsfc.nasa.gov.
  2519.  
  2520.  
  2521.   6.2.  EQL - multiple line traffic equaliser
  2522.  
  2523.   The EQL device name is `eql'. With the standard kernel source you may
  2524.   have only one EQL device per machine. EQL provides a means of
  2525.   utilizing multiple point to point lines such as PPP, slip or plip as a
  2526.   single logical link to carry tcp/ip. Often it is cheaper to use
  2527.   multiple lower speed lines than to have one high speed line installed.
  2528.  
  2529.   Kernel Compile Options:
  2530.  
  2531.  
  2532.                Network device support  --->
  2533.                    [*] Network device support
  2534.                    <*> EQL (serial line load balancing) support
  2535.  
  2536.  
  2537.  
  2538.  
  2539.  
  2540.  
  2541.   To support this mechanism the machine at the other end of the lines
  2542.   must also support EQL. Linux, Livingstone Portmasters and newer dial-
  2543.   in servers support compatible facilities.
  2544.  
  2545.   To configure EQL you will need the eql tools which are available from:
  2546.   sunsite.unc.edu
  2547.   <ftp://sunsite.unc.edu/pub/linux/system/Serial/eql-1.2.tar.gz>.
  2548.  
  2549.   Configuration is fairly straightforward. You start by configuring the
  2550.   eql interface. The eql interface is just like any other network
  2551.   device. You configure the IP address and mtu using the ifconfig
  2552.   utility, so something like:
  2553.  
  2554.  
  2555.  
  2556.                root# ifconfig eql 192.168.10.1 mtu 1006
  2557.  
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.   Next you need to manually initiate each of the lines you will use.
  2564.   These may be any combination of point to point network devices. How
  2565.   you initiate the connections will depend on what sort of link they
  2566.   are, refer to the appropriate sections for further information.
  2567.  
  2568.   Lastly you need to associate the serial link with the EQL device, this
  2569.   is called `enslaving' and is done with the eql_enslave command as
  2570.   shown:
  2571.  
  2572.  
  2573.  
  2574.  
  2575.           root# eql_enslave eql sl0 28800
  2576.           root# eql_enslave eql ppp0 14400
  2577.  
  2578.  
  2579.  
  2580.  
  2581.  
  2582.  
  2583.   The `estimated speed' parameter you supply eql_enslave doesn't do
  2584.   anything directly. It is used by the EQL driver to determine what
  2585.   share of the datagrams that device should receive, so you can fine
  2586.   tune the balancing of the lines by playing with this value.
  2587.  
  2588.   To disassociate a line from an EQL device you use the eql_emancipate
  2589.   command as shown:
  2590.  
  2591.  
  2592.  
  2593.                root# eql_emancipate eql sl0
  2594.  
  2595.  
  2596.  
  2597.  
  2598.  
  2599.  
  2600.   You add routing as you would for any other point to point link, except
  2601.   your routes should refer to the eql device rather than the actual
  2602.   serial devices themselves, typically you would use:
  2603.  
  2604.  
  2605.  
  2606.                root# route add default eql
  2607.  
  2608.  
  2609.  
  2610.  
  2611.  
  2612.  
  2613.   The EQL driver was developed by Simon Janes, simon@ncm.com.
  2614.  
  2615.   6.3.  IP Accounting (for Linux-2.0)
  2616.  
  2617.   The IP accounting features of the Linux kernel allow you to collect
  2618.   and analyze some network usage data. The data collected comprises the
  2619.   number of packets and the number of bytes accumulated since the
  2620.   figures were last reset. You may specify a variety of rules to
  2621.   categorize the figures to suit whatever purpose you may have. This
  2622.   option has been removed in kernel 2.1.102, because the old ipfwadm-
  2623.   based firewalling was replaced by ``ipfwchains''.
  2624.  
  2625.   Kernel Compile Options:
  2626.  
  2627.  
  2628.                Networking options  --->
  2629.                    [*] IP: accounting
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.   After you have compiled and installed the kernel you need to use the
  2637.   ipfwadm command to configure IP accounting. There are many different
  2638.   ways of breaking down the accounting information that you might
  2639.   choose.  I've picked a simple example of what might be useful to use,
  2640.   you should read the ipfwadm man page for more information.
  2641.   Scenario: You have a ethernet network that is linked to the internet
  2642.   via a PPP link. On the ethernet you have a machine that offers a
  2643.   number of services and that you are interested in knowing how much
  2644.   traffic is generated by each of  ftp and world wide web traffic, as
  2645.   well as total tcp and udp traffic.
  2646.  
  2647.   You might use a command set that looks like the following, which is
  2648.   shown as a shell script:
  2649.  
  2650.  
  2651.  
  2652.                #!/bin/sh
  2653.                #
  2654.                # Flush the accounting rules
  2655.                ipfwadm -A -f
  2656.                #
  2657.                # Set shortcuts
  2658.                localnet=44.136.8.96/29
  2659.                any=0/0
  2660.                # Add rules for local ethernet segment
  2661.                ipfwadm -A in  -a -P tcp -D $localnet ftp-data
  2662.                ipfwadm -A out -a -P tcp -S $localnet ftp-data
  2663.                ipfwadm -A in  -a -P tcp -D $localnet www
  2664.                ipfwadm -A out -a -P tcp -S $localnet www
  2665.                ipfwadm -A in  -a -P tcp -D $localnet
  2666.                ipfwadm -A out -a -P tcp -S $localnet
  2667.                ipfwadm -A in  -a -P udp -D $localnet
  2668.                ipfwadm -A out -a -P udp -S $localnet
  2669.                #
  2670.                # Rules for default
  2671.                ipfwadm -A in  -a -P tcp -D $any ftp-data
  2672.                ipfwadm -A out -a -P tcp -S $any ftp-data
  2673.                ipfwadm -A in  -a -P tcp -D $any www
  2674.                ipfwadm -A out -a -P tcp -S $any www
  2675.                ipfwadm -A in  -a -P tcp -D $any
  2676.                ipfwadm -A out -a -P tcp -S $any
  2677.                ipfwadm -A in  -a -P udp -D $any
  2678.                ipfwadm -A out -a -P udp -S $any
  2679.                #
  2680.                # List the rules
  2681.                ipfwadm -A -l -n
  2682.                #
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.   The names ``ftp-data'' and ``www'' refer to lines in /etc/services.
  2690.   The last command lists each of the Accounting rules and displays the
  2691.   collected totals.
  2692.  
  2693.   An important point to note when analyzing IP accounting is that totals
  2694.   for all rules that match will be incremented so that to obtain
  2695.   differential figures you need to perform appropriate maths. For
  2696.   example if I wanted to know how much data was not ftp nor www I would
  2697.   substract the individual totals from the rule that matches all ports.
  2698.  
  2699.  
  2700.  
  2701.  
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707.   root# ipfwadm -A -l -n
  2708.   IP accounting rules
  2709.    pkts bytes dir prot source               destination          ports
  2710.       0     0 in  tcp  0.0.0.0/0            44.136.8.96/29       * -> 20
  2711.       0     0 out tcp  44.136.8.96/29       0.0.0.0/0            20 -> *
  2712.      10  1166 in  tcp  0.0.0.0/0            44.136.8.96/29       * -> 80
  2713.      10   572 out tcp  44.136.8.96/29       0.0.0.0/0            80 -> *
  2714.     252 10943 in  tcp  0.0.0.0/0            44.136.8.96/29       * -> *
  2715.     231 18831 out tcp  44.136.8.96/29       0.0.0.0/0             * -> *
  2716.       0     0 in  udp  0.0.0.0/0            44.136.8.96/29       * -> *
  2717.       0     0 out udp  44.136.8.96/29       0.0.0.0/0            * -> *
  2718.       0     0 in  tcp  0.0.0.0/0            0.0.0.0/0            * -> 20
  2719.       0     0 out tcp  0.0.0.0/0            0.0.0.0/0            20 -> *
  2720.      10  1166 in  tcp  0.0.0.0/0            0.0.0.0/0            * -> 80
  2721.      10   572 out tcp  0.0.0.0/0            0.0.0.0/0            80 -> *
  2722.     253 10983 in  tcp  0.0.0.0/0            0.0.0.0/0            * -> *
  2723.     231 18831 out tcp  0.0.0.0/0            0.0.0.0/0            * -> *
  2724.       0     0 in  udp  0.0.0.0/0            0.0.0.0/0            * -> *
  2725.       0     0 out udp  0.0.0.0/0            0.0.0.0/0            * -> *
  2726.  
  2727.  
  2728.  
  2729.  
  2730.  
  2731.   6.4.  IP Accounting (for Linux-2.2)
  2732.  
  2733.   The new accounting code is accessed via ``IP Firewall Chains''.  See
  2734.   the IP chanins home page
  2735.   <http://www.adelaide.net.au/~rustcorp/ipfwchains/ipfwchains.html> for
  2736.   more information.  Among other things, you'll now need to use ipchains
  2737.   instead of ipfwadm to configure your filters. (From
  2738.   Documentation/Changes in the latest kernel sources).
  2739.  
  2740.   6.5.  IP Aliasing
  2741.  
  2742.   There are some applications where being able to configure multiple IP
  2743.   addresses to a single network device is useful. Internet Service
  2744.   Providers often use this facility to provide a `customized' to their
  2745.   World Wide Web and ftp offerings for their customers. You can refer to
  2746.   the ``IP-Alias mini-HOWTO'' for more information than you find here.
  2747.  
  2748.   Kernel Compile Options:
  2749.  
  2750.  
  2751.                Networking options  --->
  2752.                    ....
  2753.                    [*] Network aliasing
  2754.                    ....
  2755.                    <*> IP: aliasing support
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.  
  2762.   After compiling and installing your kernel with IP_Alias support
  2763.   configuration is very simple. The aliases are added to virtual network
  2764.   devices associated with the actual network device. A simple naming
  2765.   convention applies to these devices being <devname>:<virtual dev num>,
  2766.   e.g. eth0:0, ppp0:10 etc. Note that the the ifname:number device can
  2767.   only be configured after the main interface has been set up.
  2768.  
  2769.   For example, assume you have an ethernet network that supports two
  2770.   different IP subnetworks simultaneously and you wish your machine to
  2771.   have direct access to both, you could use something like:
  2772.  
  2773.                root# ifconfig eth0 192.168.1.1 netmask 255.255.255.0 up
  2774.                root# route add -net 192.168.1.0 netmask 255.255.255.0 eth0
  2775.  
  2776.                root# ifconfig eth0:0 192.168.10.1 netmask 255.255.255.0 up
  2777.                root# route add -net 192.168.10.0 netmask 255.255.255.0 eth0:0
  2778.  
  2779.  
  2780.  
  2781.  
  2782.  
  2783.  
  2784.   To delete an alias you simply add a `-' to the end of its name and
  2785.   refer to it and is as simple as:
  2786.  
  2787.  
  2788.  
  2789.                root# ifconfig eth0:0- 0
  2790.  
  2791.  
  2792.  
  2793.  
  2794.  
  2795.  
  2796.   All routes associated with that alias will also be deleted
  2797.   automatically.
  2798.  
  2799.   6.6.  IP Firewall (for Linux-2.0)
  2800.  
  2801.   IP Firewall and Firewalling issues are covered in more depth in the
  2802.   Firewall-HOWTO <Firewall-HOWTO.html>. IP Firewalling allows you to
  2803.   secure your machine against unauthorized network access by filtering
  2804.   or allowing datagrams from or to IP addresses that you nominate. There
  2805.   are three different classes of rules, incoming filtering, outgoing
  2806.   filtering and forwarding filtering. Incoming rules are applied to
  2807.   datagrams that are received by a network device. Outgoing rules are
  2808.   applied to datagrams that are to be transmitted by a network device.
  2809.   Forwarding rules are applied to datagrams that are received and are
  2810.   not for this machine, ie datagrams that would be routed.
  2811.  
  2812.   Kernel Compile Options:
  2813.  
  2814.  
  2815.                Networking options  --->
  2816.                    [*] Network firewalls
  2817.                    ....
  2818.                    [*] IP: forwarding/gatewaying
  2819.                    ....
  2820.                    [*] IP: firewalling
  2821.                    [ ] IP: firewall packet logging
  2822.  
  2823.  
  2824.  
  2825.  
  2826.  
  2827.  
  2828.   Configuration of the IP firewall rules is performed using the ipfwadm
  2829.   command. As I mentioned earlier, security is not something I am expert
  2830.   at, so while I will present an example you can use, you should do your
  2831.   own research and develop your own rules if security is important to
  2832.   you.
  2833.  
  2834.   Probably the most common use of IP firewall is when you are using your
  2835.   linux machine as a router and firewall gateway to protect your local
  2836.   network from unauthorized access from outside your network.
  2837.  
  2838.  
  2839.   The following configuration is based on a contribution from Arnt
  2840.   Gulbrandsen, <agulbra@troll.no>.
  2841.  
  2842.   The example describes the configuration of the firewall rules on the
  2843.   Linux firewall/router machine illustrated in this diagram:
  2844.  
  2845.  
  2846.  
  2847.        -                                   -
  2848.         \                                  | 172.16.37.0
  2849.          \                                 |   /255.255.255.0
  2850.           \                 ---------      |
  2851.            |  172.16.174.30 | Linux |      |
  2852.        NET =================|  f/w  |------|    ..37.19
  2853.            |    PPP         | router|      |  --------
  2854.           /                 ---------      |--| Mail |
  2855.          /                                 |  | /DNS |
  2856.         /                                  |  --------
  2857.        -                                   -
  2858.  
  2859.  
  2860.  
  2861.  
  2862.  
  2863.   The following commands would normally be placed in an rc file so that
  2864.   they were automatically started each time the system boots. For
  2865.   maximum security they would be performed after the network interfaces
  2866.   are configured, but before the interfaces are actually brought up to
  2867.   prevent anyone gaining access while the firewall machine is rebooting.
  2868.  
  2869.  
  2870.  
  2871.  
  2872.  
  2873.  
  2874.  
  2875.  
  2876.  
  2877.  
  2878.  
  2879.  
  2880.  
  2881.  
  2882.  
  2883.  
  2884.  
  2885.  
  2886.  
  2887.  
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899.  
  2900.  
  2901.  
  2902.  
  2903.  
  2904.  
  2905.           #!/bin/sh
  2906.  
  2907.           # Flush the 'Forwarding' rules table
  2908.           # Change the default policy to 'accept'
  2909.           #
  2910.           /sbin/ipfwadm -F -f
  2911.           /sbin/ipfwadm -F -p accept
  2912.           #
  2913.           # .. and for 'Incoming'
  2914.           #
  2915.           /sbin/ipfwadm -I -f
  2916.           /sbin/ipfwadm -I -p accept
  2917.  
  2918.           # First off, seal off the PPP interface
  2919.           # I'd love to use '-a deny' instead of '-a reject -y' but then it
  2920.           # would be impossible to originate connections on that interface too.
  2921.           # The -o causes all rejected datagrams to be logged. This trades
  2922.           # disk space against knowledge of an attack of configuration error.
  2923.           #
  2924.           /sbin/ipfwadm -I -a reject -y -o -P tcp -S 0/0 -D 172.16.174.30
  2925.  
  2926.           # Throw away certain kinds of obviously forged packets right away:
  2927.           # Nothing should come from multicast/anycast/broadcast addresses
  2928.           #
  2929.           /sbin/ipfwadm -F -a deny -o -S 224.0/3 -D 172.16.37.0/24
  2930.           #
  2931.           # and nothing coming from the loopback network should ever be
  2932.           # seen on a wire
  2933.           #
  2934.           /sbin/ipfwadm -F -a deny -o -S 127.0/8 -D 172.16.37.0/24
  2935.  
  2936.           # accept incoming SMTP and DNS connections, but only
  2937.           # to the Mail/Name Server
  2938.           #
  2939.           /sbin/ipfwadm -F -a accept -P tcp -S 0/0 -D 172.16.37.19 25 53
  2940.           #
  2941.           # DNS uses UDP as well as TCP, so allow that too
  2942.           # for questions to our name server
  2943.           #
  2944.           /sbin/ipfwadm -F -a accept -P udp -S 0/0 -D 172.16.37.19 53
  2945.           #
  2946.           # but not "answers" coming to dangerous ports like NFS and
  2947.           # Larry McVoy's NFS extension.  If you run squid, add its port here.
  2948.           #
  2949.           /sbin/ipfwadm -F -a deny -o -P udp -S 0/0 53 \
  2950.                   -D 172.16.37.0/24 2049 2050
  2951.  
  2952.           # answers to other user ports are okay
  2953.           #
  2954.           /sbin/ipfwadm -F -a accept -P udp -S 0/0 53 \
  2955.                   -D 172.16.37.0/24 53 1024:65535
  2956.  
  2957.           # Reject incoming connections to identd
  2958.           # We use 'reject' here so that the connecting host is told
  2959.           # straight away not to bother continuing, otherwise we'd experience
  2960.           # delays while ident timed out.
  2961.           #
  2962.           /sbin/ipfwadm -F -a reject -o -P tcp -S 0/0 -D 172.16.37.0/24 113
  2963.  
  2964.           # Accept some common service connections from the 192.168.64 and
  2965.           # 192.168.65 networks, they are friends that we trust.
  2966.           #
  2967.           /sbin/ipfwadm -F -a accept -P tcp -S 192.168.64.0/23 \
  2968.                   -D 172.16.37.0/24 20:23
  2969.  
  2970.           # accept and pass through anything originating inside
  2971.           #
  2972.           /sbin/ipfwadm -F -a accept -P tcp -S 172.16.37.0/24 -D 0/0
  2973.  
  2974.           # deny most other incoming TCP connections and log them
  2975.           # (append 1:1023 if you have problems with ftp not working)
  2976.           #
  2977.           /sbin/ipfwadm -F -a deny -o -y -P tcp -S 0/0 -D 172.16.37.0/24
  2978.  
  2979.           # ... for UDP too
  2980.           #
  2981.           /sbin/ipfwadm -F -a deny -o -P udp -S 0/0 -D 172.16.37.0/24
  2982.  
  2983.  
  2984.  
  2985.  
  2986.  
  2987.  
  2988.   Good firewall configurations are a little tricky. This example should
  2989.   be a reasonable starting point for you. The ipfwadm manual page offers
  2990.   some assistance in how to use the tool. If you intend to configure a
  2991.   firewall, be sure to ask around and get as much advice from sources
  2992.   you consider reliable and get someone to test/sanity check your
  2993.   configuration from the outside.
  2994.  
  2995.   6.7.  IP Firewall (for Linux-2.2)
  2996.  
  2997.   The new firewalling code is accessed via ``IP Firewall Chains''.  See
  2998.   the IP chanins home page
  2999.   <http://www.adelaide.net.au/~rustcorp/ipfwchains/ipfwchains.html> for
  3000.   more information.  Among other things, you'll now need to use ipchains
  3001.   instead of ipfwadm to configure your filters. (From
  3002.   Documentation/Changes in the latest kernel sources).
  3003.  
  3004.  
  3005.   6.8.  IPIP Encapsulation
  3006.  
  3007.   Why would you want to encapsulate IP datagrams within IP datagrams? It
  3008.   must seem an odd thing to do if you've never seen an application of it
  3009.   before.  Ok, here are a couple of common places where it is used:
  3010.   Mobile-IP and IP-Multicast. What is perhaps the most widely spread use
  3011.   of it though is also the least well known, Amateur Radio.
  3012.  
  3013.   Kernel Compile Options:
  3014.  
  3015.  
  3016.                Networking options  --->
  3017.                    [*] TCP/IP networking
  3018.                    [*] IP: forwarding/gatewaying
  3019.                    ....
  3020.                    <*> IP: tunneling
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.   IP tunnel devices are called `tunl0', `tunl1' etc.
  3027.  
  3028.   "But why ?". Ok, ok. Conventional IP routing rules mandate that an IP
  3029.   network comprises a network address and a network mask. This produces
  3030.   a series of contiguous addresses that may all be routed via a single
  3031.   routing entry.  This is very convenient, but it means that you may
  3032.   only use any particular IP address while you are connected to the
  3033.   particular piece of network to which it belongs. In most instances
  3034.   this is ok, but if you are a mobile netizen then you may not be able
  3035.   to stay connected to the one place all the time. IP/IP encapsulation
  3036.   (IP tunneling) allows you to overcome this restriction by allowing
  3037.   datagrams destined for your IP address to be wrapped up and redirected
  3038.   to another IP address. If you know that you're going to be operating
  3039.   from some other IP network for some time you can set up a machine on
  3040.   your home network to accept datagrams to your IP address and redirect
  3041.   them to the address that you will actually be using temporarily.
  3042.  
  3043.   6.8.1.  A tunneled network configuration.
  3044.  
  3045.   As always, I believe a diagram will save me lots of confusing text, so
  3046.   here is one:
  3047.  
  3048.  
  3049.  
  3050.         192.168.1/24                          192.168.2/24
  3051.  
  3052.             -                                     -
  3053.             |      ppp0 =            ppp0 =       |
  3054.             |  aaa.bbb.ccc.ddd  fff.ggg.hhh.iii   |
  3055.             |                                     |
  3056.             |   /-----\                 /-----\   |
  3057.             |   |     |       //        |     |   |
  3058.             |---|  A  |------//---------|  B  |---|
  3059.             |   |     |     //          |     |   |
  3060.             |   \-----/                 \-----/   |
  3061.             |                                     |
  3062.             -                                     -
  3063.  
  3064.  
  3065.  
  3066.  
  3067.  
  3068.   The diagram illustrates another possible reason to use IPIP encapsula¡
  3069.   tion, virtual private networking. This example presupposes that you
  3070.   have two machines each with a simple dial up internet connection. Each
  3071.   host is allocated just a single IP address. Behind each of these
  3072.   machines are some private local area networks configured with reserved
  3073.   IP network addresses. Suppose that you want to allow any host on net¡
  3074.   work A to connect to any host on network B, just as if they were prop¡
  3075.   erly connected to the Internet with a network route. IPIP encapsula¡
  3076.   tion will allow you to do this. Note, encapsulation does not solve the
  3077.   problem of how you get the hosts on networks A and B to talk to any
  3078.   other on the Internet, you still need tricks like IP Masquerade for
  3079.   that.  Encapsulation is normally performed by machine functioning as
  3080.   routers.
  3081.  
  3082.   Linux router `A' would be configured with a script like the following:
  3083.  
  3084.  
  3085.  
  3086.  
  3087.  
  3088.  
  3089.  
  3090.  
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.  
  3098.  
  3099.  
  3100.  
  3101.  
  3102.  
  3103.           #!/bin/sh
  3104.           PATH=/sbin:/usr/sbin
  3105.           mask=255.255.255.0
  3106.           remotegw=fff.ggg.hhh.iii
  3107.           #
  3108.           # Ethernet configuration
  3109.           ifconfig eth0 192.168.1.1 netmask $mask up
  3110.           route add -net 192.168.1.0 netmask $mask eth0
  3111.           #
  3112.           # ppp0 configuration (start ppp link, set default route)
  3113.           pppd
  3114.           route add default ppp0
  3115.           #
  3116.           # Tunnel device configuration
  3117.           ifconfig tunl0 192.168.1.1 up
  3118.           route add -net 192.168.2.0 netmask $mask gw $remotegw tunl0
  3119.  
  3120.  
  3121.  
  3122.  
  3123.  
  3124.  
  3125.   Linux router `B' would be configured with a similar script:
  3126.  
  3127.  
  3128.  
  3129.                #!/bin/sh
  3130.                PATH=/sbin:/usr/sbin
  3131.                mask=255.255.255.0
  3132.                remotegw=aaa.bbb.ccc.ddd
  3133.                #
  3134.                # Ethernet configuration
  3135.                ifconfig eth0 192.168.2.1 netmask $mask up
  3136.                route add -net 192.168.2.0 netmask $mask eth0
  3137.                #
  3138.                # ppp0 configuration (start ppp link, set default route)
  3139.                pppd
  3140.                route add default ppp0
  3141.                #
  3142.                # Tunnel device configuration
  3143.                ifconfig tunl0 192.168.2.1 up
  3144.                route add -net 192.168.1.0 netmask $mask gw $remotegw tunl0
  3145.  
  3146.  
  3147.  
  3148.  
  3149.  
  3150.  
  3151.   The command:
  3152.  
  3153.  
  3154.  
  3155.                route add -net 192.168.1.0 netmask $mask gw $remotegw tunl0
  3156.  
  3157.  
  3158.  
  3159.  
  3160.  
  3161.  
  3162.   reads: `Send any datagrams destined for 192.168.1.0/24 inside an IPIP
  3163.   encap datagram with a destination address of aaa.bbb.ccc.ddd'.
  3164.  
  3165.   Note that the configurations are reciprocated at either end. The
  3166.   tunnel device uses the `gw' in the route as the destination of the IP
  3167.   datagram in which it will place the datagram it has received to route.
  3168.   That machine must know how to decapsulate IPIP datagrams, that is, it
  3169.   must also be configured with a tunnel device.
  3170.  
  3171.   6.8.2.  A tunneled host configuration.
  3172.  
  3173.   It doesn't have to be a whole network you route. You could for example
  3174.   route just a single IP address. In that instance you might configure
  3175.   the tunl device on the `remote' machine with its home IP address and
  3176.   at the A end just use a host route (and Proxy Arp) rather than a
  3177.   network route via the tunnel device. Let's redraw and modify our
  3178.   configuration appropriately. Now we have just host `B' which to want
  3179.   to act and behave as if it is both fully connected to the Internet and
  3180.   also part of the remote network supported by host `A':
  3181.  
  3182.  
  3183.  
  3184.         192.168.1/24
  3185.  
  3186.             -
  3187.             |      ppp0 =                ppp0 =
  3188.             |  aaa.bbb.ccc.ddd      fff.ggg.hhh.iii
  3189.             |
  3190.             |   /-----\                 /-----\
  3191.             |   |     |       //        |     |
  3192.             |---|  A  |------//---------|  B  |
  3193.             |   |     |     //          |     |
  3194.             |   \-----/                 \-----/
  3195.             |                      also: 192.168.1.12
  3196.             -
  3197.  
  3198.  
  3199.  
  3200.  
  3201.   Linux router `A' would be configured with:
  3202.  
  3203.  
  3204.  
  3205.                #!/bin/sh
  3206.                PATH=/sbin:/usr/sbin
  3207.                mask=255.255.255.0
  3208.                remotegw=fff.ggg.hhh.iii
  3209.                #
  3210.                # Ethernet configuration
  3211.                ifconfig eth0 192.168.1.1 netmask $mask up
  3212.                route add -net 192.168.1.0 netmask $mask eth0
  3213.                #
  3214.                # ppp0 configuration (start ppp link, set default route)
  3215.                pppd
  3216.                route add default ppp0
  3217.                #
  3218.                # Tunnel device configuration
  3219.                ifconfig tunl0 192.168.1.1 up
  3220.                route add -host 192.168.1.12 gw $remotegw tunl0
  3221.                #
  3222.                # Proxy ARP for the remote host
  3223.                arp -s 192.168.1.12 xx:xx:xx:xx:xx:xx pub
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.  
  3230.   Linux host `B' would be configured with:
  3231.  
  3232.  
  3233.  
  3234.  
  3235.           #!/bin/sh
  3236.           PATH=/sbin:/usr/sbin
  3237.           mask=255.255.255.0
  3238.           remotegw=aaa.bbb.ccc.ddd
  3239.           #
  3240.           # ppp0 configuration (start ppp link, set default route)
  3241.           pppd
  3242.           route add default ppp0
  3243.           #
  3244.           # Tunnel device configuration
  3245.           ifconfig tunl0 192.168.1.12 up
  3246.           route add -net 192.168.1.0 netmask $mask gw $remotegwtunl0
  3247.  
  3248.  
  3249.  
  3250.  
  3251.  
  3252.  
  3253.   This sort of configuration is more typical of a Mobile-IP application.
  3254.   Where a single host wants to roam around the Internet and maintain a
  3255.   single usable IP address the whole time. You should refer to the
  3256.   Mobile-IP section for more information on how that is handled in
  3257.   practice.
  3258.  
  3259.   6.9.  IP Masquerade (for Linux-2.0)
  3260.  
  3261.   Many people have a simple dialup account to connect to the Internet.
  3262.   Nearly everybody using this sort of configuration is allocated a
  3263.   single IP address by the Internet Service Provider. This is normally
  3264.   enough to allow only one host full access to the network. IP
  3265.   Masquerade is a clever trick that enables you to have many machines
  3266.   make use of that one IP address, by causing the other hosts to look
  3267.   like, hence the term masquerade, the machine supporting the dialup
  3268.   connection. There is a small caveat and that is that the masquerade
  3269.   function nearly always works only in one direction, that is the
  3270.   masqueraded hosts can make calls out, but they cannot accept or
  3271.   receive network connections from remote hosts. This means that some
  3272.   network services do not work such as talk and others such as ftp must
  3273.   be configured to operate in passive (PASV) mode to operate.
  3274.   Fortunately the most common network services such as telnet, World
  3275.   Wide Web and irc do work just fine.
  3276.  
  3277.   Kernel Compile Options:
  3278.  
  3279.  
  3280.                Code maturity level options  --->
  3281.                    [*] Prompt for development and/or incomplete code/drivers
  3282.                Networking options  --->
  3283.                    [*] Network firewalls
  3284.                    ....
  3285.                    [*] TCP/IP networking
  3286.                    [*] IP: forwarding/gatewaying
  3287.                    ....
  3288.                    [*] IP: masquerading (EXPERIMENTAL)
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295.   Normally you have your linux machine supporting a slip or PPP dialup
  3296.   line just as it would if it were a standalone machine. Additionally it
  3297.   would have another network device configured, perhaps an ethernet,
  3298.   configured with one of the reserved network addresses. The hosts to be
  3299.   masqueraded would be on this second network. Each of these hosts would
  3300.   have the IP address of the ethernet port of the linux machine set as
  3301.   their default gateway or router.
  3302.  
  3303.   A typical configuration might look something like this:
  3304.  
  3305.  
  3306.  
  3307.        -                                   -
  3308.         \                                  | 192.168.1.0
  3309.          \                                 |   /255.255.255.0
  3310.           \                 ---------      |
  3311.            |                | Linux | .1.1 |
  3312.        NET =================| masq  |------|
  3313.            |    PPP/slip    | router|      |  --------
  3314.           /                 ---------      |--| host |
  3315.          /                                 |  |      |
  3316.         /                                  |  --------
  3317.        -                                   -
  3318.  
  3319.  
  3320.  
  3321.  
  3322.  
  3323.   The most relevant commands for this configuration are:
  3324.  
  3325.  
  3326.  
  3327.                # Network route for ethernet
  3328.                route add -net 192.168.1.0 netmask 255.255.255.0 eth0
  3329.                #
  3330.                # Default route to the rest of the internet.
  3331.                route add default ppp0
  3332.                #
  3333.                # Cause all hosts on the 192.168.1/24 network to be masqueraded.
  3334.                ipfwadm -F -a m -S 192.168.1.0/24 -D 0.0.0.0/0
  3335.  
  3336.  
  3337.  
  3338.  
  3339.  
  3340.  
  3341.   If you are minimalist and a lazy typist, like me, and your
  3342.   masquerading host has only two interfaces (so that every packet being
  3343.   forwarded must be masqueraded), the following command will suffice:
  3344.  
  3345.  
  3346.  
  3347.                root# /sbin/ipfwadm -F -a accept -m
  3348.  
  3349.  
  3350.  
  3351.  
  3352.  
  3353.  
  3354.   You can get more information on the Linux IP Masquerade feature from
  3355.   the IP Masquerade Resource Page <http://www.hwy401.com/achau/ipmasq/>.
  3356.   Also, a very detailed document about masquesrading is the ``IP-
  3357.   Masquerade mini-HOWTO'' (which also intructs to configure other OS's
  3358.   to run with a Linux masquerade server).
  3359.  
  3360.  
  3361.  
  3362.   6.10.  IP Transparent Proxy
  3363.  
  3364.   IP transparent proxy is a feature that enables you to redirect servers
  3365.   or services destined for another machine to those services on this
  3366.   machine.  Typically this would be useful where you have a linux
  3367.   machine as a router and also provides a proxy server. You would
  3368.   redirect all connections destined for that service remotely to the
  3369.   local proxy server.
  3370.  
  3371.   Kernel Compile Options:
  3372.  
  3373.  
  3374.                Code maturity level options  --->
  3375.                        [*] Prompt for development and/or incomplete code/drivers
  3376.                Networking options  --->
  3377.                        [*] Network firewalls
  3378.                        ....
  3379.                        [*] TCP/IP networking
  3380.                        ....
  3381.                        [*] IP: firewalling
  3382.                        ....
  3383.                        [*] IP: transparent proxy support (EXPERIMENTAL)
  3384.  
  3385.  
  3386.  
  3387.  
  3388.  
  3389.  
  3390.   Configuration of the transparent proxy feature is performed using the
  3391.   ipfwadm command
  3392.  
  3393.   An example that might be useful is as follows:
  3394.  
  3395.  
  3396.  
  3397.                root# ipfwadm -I -a accept -D 0/0 telnet -r 2323
  3398.  
  3399.  
  3400.  
  3401.  
  3402.  
  3403.  
  3404.   This example will cause any connection attempts to port telnet (23) on
  3405.   any host to be redirected to port 2323 on this host. If you run a
  3406.   service on that port, you could forward telnet connections, log them
  3407.   or do whatever fits your need.
  3408.  
  3409.   A more interesting example is redirecting all http traffic through a
  3410.   local cache. However, the protocol used by proxy servers is different
  3411.   from native http: where a client connects to www.server.com:80 and
  3412.   asks for /path/page, when it connects to the local cache it contacts
  3413.   proxy.local.domain:8080 and asks for www.server.com/path/page.
  3414.  
  3415.   To filter an http request through the local proxy, you need to adapt
  3416.   the protocol by inserting a small server, called transproxy (you can
  3417.   find it on the world wide web). You can choose to run transproxy on
  3418.   port 8081, and issue this command:
  3419.  
  3420.  
  3421.  
  3422.                root# ipfwadm -I -a accept -D 0/0 80 -r 8081
  3423.  
  3424.  
  3425.  
  3426.  
  3427.  
  3428.  
  3429.   The transproxy program, then, will receive all connections meant to
  3430.   reach external servers and will pass them to the local proxy after
  3431.   fixing protocol differences.
  3432.  
  3433.   6.11.  IPv6
  3434.  
  3435.   Just when you thought you were beginning to understand IP networking
  3436.   the rules get changed! IPv6 is the shorthand notation for version 6 of
  3437.   the Internet Protocol. IPv6 was developed primarily to overcome the
  3438.   concerns in the Internet community that there would soon be a shortage
  3439.   of IP addresses to allocate. IPv6 addresses are 16 bytes long (128
  3440.   bits). IPv6 incorporates a number of other changes, mostly
  3441.   simplifications, that will make IPv6 networks more managable than IPv4
  3442.   networks.
  3443.  
  3444.   Linux already has a working, but not complete, IPv6 implementation in
  3445.   the 2.1.* series kernels.
  3446.  
  3447.   If you wish to experiment with this next generation Internet
  3448.   technology, or have a requirement for it, then you should read the
  3449.   IPv6-FAQ which is available from www.terra.net
  3450.   <http://www.terra.net/ipv6/>.
  3451.  
  3452.   6.12.  Mobile IP
  3453.  
  3454.   The term "IP mobility" describes the ability of a host that is able to
  3455.   move its network connection from one point on the Internet to another
  3456.   without changing its IP address or losing connectivity. Usually when
  3457.   an IP host changes its point of connectivity it must also change its
  3458.   IP address.  IP Mobility overcomes this problem by allocating a fixed
  3459.   IP address to the mobile host and using IP encapsulation (tunneling)
  3460.   with automatic routing to ensure that datagrams destined for it are
  3461.   routed to the actual IP address it is currently using.
  3462.  
  3463.   A project is underway to provide a complete set of IP mobility tools
  3464.   for Linux.  The Status of the project and tools may be obtained from
  3465.   the: Linux Mobile IP Home Page
  3466.   <http://anchor.cs.binghamton.edu/~mobileip/>.
  3467.  
  3468.   6.13.  Multicast
  3469.  
  3470.   IP Multicast allows an arbitrary number of IP hosts on disparate IP
  3471.   networks to have IP datagrams simultaneously routed to them. This
  3472.   mechanism is exploited to provide Internet wide "broadcast" material
  3473.   such as audio and video transmissions and other novel applications.
  3474.  
  3475.   Kernel Compile Options:
  3476.  
  3477.  
  3478.        Networking options  --->
  3479.                [*] TCP/IP networking
  3480.                ....
  3481.                [*] IP: multicasting
  3482.  
  3483.  
  3484.  
  3485.  
  3486.   A suite of tools and some minor network configuration is required.
  3487.   Please check the Multicast-HOWTO <Multicast-HOWTO.html> for more
  3488.   information on Multicast support in Linux.
  3489.  
  3490.   6.14.  NAT - Network Address Translation
  3491.  
  3492.   The IP Network Address Translation facility is pretty much the
  3493.   standardized big brother of the Linux IP Masquerade facility. It is
  3494.   specified in some detail in RFC-1631 at your nearest RFC archive. NAT
  3495.   provides features that IP-Masquerade does not that make it eminently
  3496.   more suitable for use in corporate firewall router designs and larger
  3497.   scale installations.
  3498.  
  3499.   An alpha implementation of NAT for Linux 2.0.29 kernel has been
  3500.   developed by Michael.Hasenstein, Michael.Hasenstein@informatik.tu-
  3501.   chemnitz.de. Michaels documentation and implementation are available
  3502.   from:
  3503.  
  3504.   Linux IP Network Address Web Page <http://www.csn.tu-
  3505.   chemnitz.de/HyperNews/get/linux-ip-nat.html>
  3506.  
  3507.   Newer Linux 2.1.* kernels also include some NAT functionality in the
  3508.   routing algorithm.
  3509.  
  3510.   6.15.  Traffic Shaper - Changing allowed bandwidth
  3511.  
  3512.   The traffic shaper is a driver that creates new interface devices,
  3513.   those devices are traffic-limited in a user-defined way, they rely on
  3514.   physical network devices for actual transmission and can be used as
  3515.   outgoing routed for network traffic.
  3516.  
  3517.   The shaper was introduced in Linux-2.1.15 and was backported to
  3518.   Linux-2.0.36 (it appeared in 2.0.36-pre-patch-2 distributed by Alan
  3519.   Cox, the author of the shaper device and maintainer of Linux-2.0).
  3520.  
  3521.   The traffic shaper can only be compiled as a module and is configured
  3522.   by the shapecfg program with commands like the following:
  3523.  
  3524.  
  3525.  
  3526.                shapecfg attach shaper0 eth1
  3527.                shapecfg speed shaper0 64000
  3528.  
  3529.  
  3530.  
  3531.  
  3532.  
  3533.  
  3534.   The shaper device can only control the bandwidth of outgoing traffic,
  3535.   as packets are transmitted via the shaper only according to the
  3536.   routing tables; therefore, a ``route by source address'' functionality
  3537.   could help in limiting the overall bandwidth of specific hosts using a
  3538.   Linux router.
  3539.  
  3540.   Linux-2.1 already has support for such routing, if you need it for
  3541.   Linux-2.0 please check the patch by Mike McLagan, at ftp.invlogic.com.
  3542.   Refer to Documentationnetworking/shaper.txt for further information
  3543.   about the shaper.
  3544.  
  3545.   If you want to try out a (tentative) shaping for incoming packets, try
  3546.   out rshaper-1.01 (or newer), from ftp.systemy.it
  3547.   <ftp://ftp.systemy.it/pub/develop>.
  3548.  
  3549.   6.16.  Routing in Linux-2.2
  3550.  
  3551.   The latest versions of Linux-2.1 offer a lot of flexibility in routing
  3552.   policy. Unfortunately, you have to wait for the next version of this
  3553.   howto, or go read the kernel sources.
  3554.  
  3555.  
  3556.   7.  Using common PC hardware
  3557.  
  3558.   7.1.  ISDN
  3559.  
  3560.   The Integrated Services Digital Network (ISDN) is a series of
  3561.   standards that specify a general purpose switched digital data
  3562.   network. An ISDN `call' creates a synchronous point to point data
  3563.   service to the destination. ISDN is generally delivered on a high
  3564.   speed link that is broken down into a number of discrete channels.
  3565.   There are two different types of channels, the `B Channels' which will
  3566.   actually carry the user data and a single channel called the `D
  3567.   channel' which is used to send control information to the ISDN
  3568.   exchange to establish calls and other functions. In Australia for
  3569.   example, ISDN may be delivered on a 2Mbps link that is broken into 30
  3570.   discrete 64kbps B channels with one 64kbps D channel. Any number of
  3571.   channels may be used at a time and in any combination. You could for
  3572.   example establish 30 separate calls to 30 different destinations at
  3573.   64kbps each, or you could establish 15 calls to 15 different
  3574.   destinations at 128kbps each (two channels used per call), or just a
  3575.   small number of calls and leave the rest idle. A channel may be used
  3576.   for either incoming or outgoing calls. The original intention of ISDN
  3577.   was to allow Telecommunications companies to provide a single data
  3578.   service which could deliver either telephone (via digitised voice) or
  3579.   data services to your home or business without requiring you to make
  3580.   any special configuration changes.
  3581.  
  3582.   There are a few different ways to connect your computer to an ISDN
  3583.   service.  One way is to use a device called a `Terminal Adaptor' which
  3584.   plugs into the Network Terminating Unit that you telecommunications
  3585.   carrier will have installed when you got your ISDN service and
  3586.   presents a number of serial interfaces. One of those interfaces is
  3587.   used to enter commands to establish calls and configuration and the
  3588.   others are actually connected to the network devices that will use the
  3589.   data circuits when they are established. Linux will work in this sort
  3590.   of configuration without modification, you just treat the port on the
  3591.   Terminal Adaptor like you would treat any other serial device.
  3592.   Another way, which is the way the kernel ISDN support is designed for
  3593.   allows you to install an ISDN card into your Linux machine and then
  3594.   has your Linux software handle the protocols and make the calls
  3595.   itself.
  3596.  
  3597.   Kernel Compile Options:
  3598.  
  3599.  
  3600.                ISDN subsystem  --->
  3601.                        <*> ISDN support
  3602.                        [ ] Support synchronous PPP
  3603.                        [ ] Support audio via ISDN
  3604.                        < > ICN 2B and 4B support
  3605.                        < > PCBIT-D support
  3606.                        < > Teles/NICCY1016PC/Creatix support
  3607.  
  3608.  
  3609.  
  3610.  
  3611.  
  3612.  
  3613.   The Linux implementation of ISDN supports a number of different types
  3614.   of internal ISDN cards. These are those listed in the kernel
  3615.   configuration options:
  3616.  
  3617.  
  3618.   ╖  ICN 2B and 4B
  3619.  
  3620.   ╖  Octal PCBIT-D
  3621.  
  3622.   ╖  Teles ISDN-cards and compatibles
  3623.  
  3624.  
  3625.   Some of these cards require software to be downloaded to them to make
  3626.   them operational. There is a separate utility to do this with.
  3627.  
  3628.   Full details on how to configure the Linux ISDN support is available
  3629.   from the /usr/src/linux/Documentation/isdn/ directory and an FAQ
  3630.   dedicated to isdn4linux is available at www.lrz-muenchen.de
  3631.   <http://www.lrz-muenchen.de/~ui161ab/www/isdn/>.  (You can click on
  3632.   the english flag to get an english version).
  3633.  
  3634.   A note about PPP. The PPP suite of protocols will operate over either
  3635.   asynchronous or synchronous serial lines. The commonly distributed PPP
  3636.   daemon for Linux `pppd' supports only asynchronous mode. If you wish
  3637.   to run the PPP protocols over your ISDN service you need a specially
  3638.   modified version. Details of where to find it are available in the
  3639.   documentation referred to above.
  3640.  
  3641.   7.2.  PLIP for Linux-2.0
  3642.  
  3643.   PLIP device names are `plip0', `plip1 and plip2.
  3644.  
  3645.   Kernel Compile Options:
  3646.  
  3647.  
  3648.                Network device support  --->
  3649.                    <*> PLIP (parallel port) support
  3650.  
  3651.  
  3652.  
  3653.  
  3654.  
  3655.  
  3656.   plip (Parallel Line IP), is like SLIP, in that it is used for
  3657.   providing a point to point network connection between two machines,
  3658.   except that it is designed to use the parallel printer ports on your
  3659.   machine instead of the serial ports (a cabling diagram in included in
  3660.   the cabling diagram section later in this document). Because it is
  3661.   possible to transfer more than one bit at a time with a parallel port,
  3662.   it is possible to attain higher speeds with the plip interface than
  3663.   with a standard serial device.  In addition, even the simplest of
  3664.   parallel ports, printer ports, can be used in lieu of you having to
  3665.   purchase comparatively expensive 16550AFN UART's for your serial
  3666.   ports. PLIP uses a lot of CPU compared to a serial link and is most
  3667.   certainly not a good option if you can obtain some cheap ethernet
  3668.   cards, but it will work when nothing else is available and will work
  3669.   quite well.  You should expect a data transfer rate of about 20
  3670.   kilobytes per second when a link is running well.
  3671.  
  3672.   The PLIP device drivers competes with the parallel device driver for
  3673.   the parallel port hardware. If you wish to use both drivers then you
  3674.   should compile them both as modules to ensure that you are able to
  3675.   select which port you want to use for PLIP and which ports you want
  3676.   for the printer driver.  Refer to the ``Mudules mini-HOWTO'' for more
  3677.   information on kernel module configuration.
  3678.  
  3679.   Please note that some laptops use chipsets that will not work with
  3680.   PLIP because they do not allow some combinations of signals that PLIP
  3681.   relies on, that printers don't use.
  3682.  
  3683.   The Linux plip interface is compatible with the Crynwyr Packet Driver
  3684.   PLIP and this will mean that you can connect your Linux machine to a
  3685.   DOS machine running any other sort of tcp/ip software via plip.
  3686.  
  3687.   In the 2.0.* series kernel the plip devices are mapped to i/o port and
  3688.   IRQ as follows:
  3689.  
  3690.  
  3691.  
  3692.  
  3693.  
  3694.  
  3695.  
  3696.  
  3697.           device  i/o     IRQ
  3698.           ------  -----   ---
  3699.           plip0   0x3bc   5
  3700.           plip1   0x378   7
  3701.           plip2   0x278   2
  3702.  
  3703.  
  3704.  
  3705.  
  3706.  
  3707.  
  3708.   If your parallel ports don't match any of the above combinations then
  3709.   you can change the IRQ of a port using the ifconfig command using the
  3710.   `irq' parameter (be sure to enable IRQ's on your printer ports in your
  3711.   ROM BIOS if it supports this option). As an alternative, you can
  3712.   specify ``io='' annd ``irq='' options on the insmod command line, if
  3713.   you use modules. For example:
  3714.  
  3715.  
  3716.  
  3717.                root# insmod plip.o io=0x288 irq=5
  3718.  
  3719.  
  3720.  
  3721.  
  3722.  
  3723.  
  3724.   PLIP operation is controlled by two timeouts, whose default values are
  3725.   probably ok in most cases. You will probably need to increase them if
  3726.   you have an especially slow computer, in which case the timers to
  3727.   increase are actually on the other computer.  A program called
  3728.   plipconfig exists that allows you to change these timer settings
  3729.   without recompiling your kernel. It is supplied with many Linux
  3730.   distributions.
  3731.  
  3732.   To configure a plip interface, you will need to invoke the following
  3733.   commands (or add them to your initialization scripts):
  3734.  
  3735.  
  3736.  
  3737.                root# /sbin/ifconfig plip1 localplip pointopoint remoteplip
  3738.                root# /sbin/route add remoteplip plip1
  3739.  
  3740.  
  3741.  
  3742.  
  3743.  
  3744.  
  3745.   Here, the port being used is the one at I/O address 0x378; localplip
  3746.   amd remoteplip are the names or IP addresses used over the PLIP cable.
  3747.   I personally keep them in my /etc/hosts database:
  3748.  
  3749.  
  3750.  
  3751.                # plip entries
  3752.                192.168.3.1   localplip
  3753.                192.168.3.2   remoteplip
  3754.  
  3755.  
  3756.  
  3757.  
  3758.  
  3759.  
  3760.   The pointopoint parameter has the same meaning as for SLIP, in that it
  3761.   specifies the address of the machine at the other end of the link.
  3762.  
  3763.   In almost all respects you can treat a plip interface as though it
  3764.   were a SLIP interface, except that neither dip nor slattach need be,
  3765.   nor can be, used.
  3766.  
  3767.   Further information on PLIP may be obtained from the ``PLIP mini-
  3768.   HOWTO''.
  3769.  
  3770.   7.3.  PLIP for Linux-2.2
  3771.  
  3772.   During development of the 2.1 kernel versions, support for the
  3773.   parallel port was changed to a better setup.
  3774.  
  3775.   Kernel Compile Options:
  3776.  
  3777.  
  3778.                General setup  --->
  3779.                    [*] Parallel port support
  3780.                Network device support  --->
  3781.                    <*> PLIP (parallel port) support
  3782.  
  3783.  
  3784.  
  3785.  
  3786.  
  3787.  
  3788.   The new code for PLIP behaves like the old one (use the same ifconfig
  3789.   and route commands as in the previous section, but initialization of
  3790.   the device is different due to the advanced parallel port support.
  3791.  
  3792.   The ``first'' PLIP device is always called ``plip0'', where first is
  3793.   the first device detected by the system, similarly to what happens for
  3794.   Ethernet devices. The actual parallel port being used is one of the
  3795.   available ports, as shown in /proc/parport. For example, if you have
  3796.   only one parallel port, you'll only have a directory called
  3797.   /proc/parport/0.
  3798.  
  3799.   If your kernel didn't detect the IRQ number used by your port,
  3800.   ``insmod plip'' will fail; in this case just write the right number to
  3801.   /proc/parport/0/irq and reinvoke insmod.
  3802.  
  3803.   Complete information about parallel port management is available in
  3804.   the file Documentation/parport.txt, part of your kernel sources.
  3805.  
  3806.   7.4.  PPP
  3807.  
  3808.   PPP devices names are `ppp0', `ppp1, etc. Devices are numbered
  3809.   sequentially with the first device configured receiving `0'.
  3810.  
  3811.   Kernel Compile Options:
  3812.  
  3813.  
  3814.                Networking options  --->
  3815.                    <*> PPP (point-to-point) support
  3816.  
  3817.  
  3818.  
  3819.  
  3820.  
  3821.  
  3822.   PPP configuration is covered in detail in the PPP-HOWTO <PPP-
  3823.   HOWTO.html>.
  3824.  
  3825.   7.4.1.  Maintaining a permanent connection to the net with pppd .
  3826.  
  3827.   If you are fortunate enough to have a semi permanent connection to the
  3828.   net and would like to have your machine automatically redial your PPP
  3829.   connection if it is lost then here is a simple trick to do so.
  3830.  
  3831.   Configure PPP such that it can be started by the root user by issuing
  3832.   the command:
  3833.  
  3834.  
  3835.        # pppd
  3836.  
  3837.  
  3838.  
  3839.  
  3840.   Be sure that you have the `-detach' option configured in your
  3841.   /etc/ppp/options file. Then, insert the following line into your
  3842.   /etc/inittab file, down with the getty definitions:
  3843.  
  3844.  
  3845.        pd:23:respawn:/usr/sbin/pppd
  3846.  
  3847.  
  3848.  
  3849.  
  3850.   This will cause the init program to spawn and monitor the pppd program
  3851.   and automatically restart it if it dies.
  3852.  
  3853.   7.5.  SLIP client
  3854.  
  3855.   SLIP devices are named `sl0', `sl1' etc. with the first device
  3856.   configured being assigned `0' and the rest incrementing sequentially
  3857.   as they are configured.
  3858.  
  3859.   Kernel Compile Options:
  3860.  
  3861.  
  3862.                Network device support  --->
  3863.                    [*] Network device support
  3864.                    <*> SLIP (serial line) support
  3865.                    [ ]  CSLIP compressed headers
  3866.                    [ ]  Keepalive and linefill
  3867.                    [ ]  Six bit SLIP encapsulation
  3868.  
  3869.  
  3870.  
  3871.  
  3872.  
  3873.  
  3874.   SLIP (Serial Line Internet Protocol) allows you to use tcp/ip over a
  3875.   serial line, be that a phone line with a dialup modem, or a leased
  3876.   line of some sort.  Of course to use SLIP you need access to a SLIP-
  3877.   server in your area. Many universities and businesses provide SLIP
  3878.   access all over the world.
  3879.  
  3880.   Slip uses the serial ports on your machine to carry IP datagrams. To
  3881.   do this it must take control of the serial device. Slip device names
  3882.   are named sl0, sl1 etc. How do these correspond to your serial devices
  3883.   ? The networking code uses what is called an ioctl (i/o control) call
  3884.   to change the serial devices into SLIP devices. There are two programs
  3885.   supplied that can do this, they are called dip and slattach
  3886.  
  3887.   7.5.1.  dip
  3888.  
  3889.   dip (Dialup IP) is a smart program that is able to set the speed of
  3890.   the serial device, command your modem to dial the remote end of the
  3891.   link, automatically log you into the remote server, search for
  3892.   messages sent to you by the server and extract information for them
  3893.   such as your IP address and perform the ioctl necessary to switch your
  3894.   serial port into SLIP mode. dip has a powerful scripting ability and
  3895.   it is this that you can exploit to automate your logon procedure.
  3896.  
  3897.   You can find it at: sunsite.unc.edu
  3898.   <ftp://sunsite.unc.edu/pub/Linux/system/Network/serial/dip/dip337o-
  3899.   uri.tgz>.
  3900.  
  3901.   To install it, try the following:
  3902.  
  3903.  
  3904.  
  3905.                user% tar xvzf dip337o-uri.tgz
  3906.                user% cd dip-3.3.7o
  3907.                user% vi Makefile
  3908.                root# make install
  3909.  
  3910.  
  3911.  
  3912.  
  3913.  
  3914.  
  3915.   The Makefile assumes the existence of a group called uucp, but you
  3916.   might like to change this to either dip or SLIP depending on your
  3917.   configuration.
  3918.  
  3919.   7.5.2.  slattach
  3920.  
  3921.   slattach as contrasted with dip is a very simple program, that is very
  3922.   easy to use, but does not have the sophistication of dip.  It does not
  3923.   have the scripting ability, all it does is configure your serial
  3924.   device as a SLIP device. It assumes you have all the information you
  3925.   need and the serial line is established before you invoke it. slattach
  3926.   is ideal to use where you have a permanent connection to your server,
  3927.   such as a physical cable, or a leased line.
  3928.  
  3929.   7.5.3.  When do I use which ?
  3930.  
  3931.   You would use dip when your link to the machine that is your SLIP
  3932.   server is a dialup modem, or some other temporary link. You would use
  3933.   slattach when you have a leased line, perhaps a cable, between your
  3934.   machine and the server and there is no special action needed to get
  3935.   the link working. See section `Permanent Slip connection' for more
  3936.   information.
  3937.  
  3938.   Configuring SLIP is much like configuring an Ethernet interface (read
  3939.   section `Configuring an ethernet device' above). However there are a
  3940.   few key differences.
  3941.  
  3942.   First of all, SLIP links are unlike ethernet networks in that there is
  3943.   only ever two hosts on the network, one at each end of the link.
  3944.   Unlike an ethernet that is available for use as soon are you are
  3945.   cabled, with SLIP, depending on the type of link you have, you may
  3946.   have to initialize your network connection in some special way.
  3947.  
  3948.   If you are using dip then this would not normally be done at boot
  3949.   time, but at some time later, when you were ready to use the link.  It
  3950.   is possible to automate this procedure. If you are using slattach then
  3951.   you will probably want to add a section to your rc.inet1 file.  This
  3952.   will be described soon.
  3953.  
  3954.   There are two major types of SLIP servers: Dynamic IP address servers
  3955.   and static IP address servers. Almost every SLIP server will prompt
  3956.   you to login using a username and password when dialing in. dip can
  3957.   handle logging you in automatically.
  3958.  
  3959.  
  3960.  
  3961.   7.5.4.  Static SLIP server with a dialup line and DIP.
  3962.  
  3963.   A static SLIP server is one in which you have been supplied an IP
  3964.   address that is exclusively yours. Each time you connect to the
  3965.   server, you will configure your SLIP port with that address. The
  3966.   static SLIP server will answer your modem call, possibly prompt you
  3967.   for a username and password, and then route any datagrams destined for
  3968.   your address to you via that connection. If you have a static server,
  3969.   then you may want to put entries for your hostname and IP address
  3970.   (since you know what it will be) into your /etc/hosts. You should also
  3971.   configure some other files such as: rc.inet2, host.conf, resolv.conf,
  3972.   /etc/HOSTNAME and rc.local. Remember that when configuring rc.inet1,
  3973.   you don't need to add any special commands for your SLIP connection
  3974.   since it is dip that does all of the hard work for you in configuring
  3975.   your interface. You will need to give dip the appropriate information
  3976.   and it will configure the interface for you after commanding the modem
  3977.   to establish the call and logging you into your SLIP server.
  3978.  
  3979.   If this is how your SLIP server works then you can move to section
  3980.   `Using Dip' to learn how to configure dip appropriately.
  3981.  
  3982.   7.5.5.  Dynamic SLIP server with a dialup line and DIP.
  3983.  
  3984.   A dynamic SLIP server is one which allocates you an IP address
  3985.   randomly, from a pool of addresses, each time you logon. This means
  3986.   that there is no guarantee that you will have any particular address
  3987.   each time, and that address may well be used by someone else after you
  3988.   have logged off.  The network administrator who configured the SLIP
  3989.   server will have assigned a pool of address for the SLIP server to
  3990.   use, when the server receives a new incoming call, it finds the first
  3991.   unused address, guides the caller through the login process and then
  3992.   prints a welcome message that contains the IP address it has allocated
  3993.   and will proceed to use that IP address for the duration of that call.
  3994.  
  3995.   Configuring for this type of server is similar to configuring for a
  3996.   static server, except that you must add a step where you obtain the IP
  3997.   address that the server has allocated for you and configure your SLIP
  3998.   device with that.
  3999.  
  4000.   Again, dip does the hard work and new versions are smart enough to not
  4001.   only log you in, but to also be able to automatically read the IP
  4002.   address printed in the welcome message and store it so that you can
  4003.   have it configure your SLIP device with it.
  4004.  
  4005.   If this is how your SLIP server works then you can move to section
  4006.   `Using Dip' to learn how to configure dip appropriately.
  4007.  
  4008.   7.5.6.  Using DIP.
  4009.  
  4010.   As explained earlier, dip is a powerful program that can simplify and
  4011.   automate the process of dialing into the SLIP server, logging you in,
  4012.   starting the connection and configuring your SLIP devices with the
  4013.   appropriate ifconfig and route commands.
  4014.  
  4015.   Essentially to use dip you'll write a `dip script', which is basically
  4016.   a list of commands that dip understands that tell dip how to perform
  4017.   each of the actions you want it to perform. See sample.dip that comes
  4018.   supplied with dip to get an idea of how it works. dip is quite a
  4019.   powerful program, with many options.  Instead of going into all of
  4020.   them here you should look at the man page, README and sample files
  4021.   that will have come with your version of dip.
  4022.  
  4023.   You may notice that the sample.dip script assumes that you're using a
  4024.   static SLIP server, so you know what your IP address is beforehand.
  4025.   For dynamic SLIP servers, the newer versions of dip include a command
  4026.   you can use to automatically read and configure your SLIP device with
  4027.   the IP address that the dynamic server allocates for you. The
  4028.   following sample is a modified version of the sample.dip that came
  4029.   supplied with dip337j-uri.tgz and is probably a good starting point
  4030.   for you.  You might like to save it as /etc/dipscript and edit it to
  4031.   suit your configuration:
  4032.  
  4033.  
  4034.  
  4035.  
  4036.  
  4037.  
  4038.  
  4039.  
  4040.  
  4041.  
  4042.  
  4043.  
  4044.  
  4045.  
  4046.  
  4047.  
  4048.  
  4049.  
  4050.  
  4051.  
  4052.  
  4053.  
  4054.  
  4055.  
  4056.  
  4057.  
  4058.  
  4059.  
  4060.  
  4061.  
  4062.  
  4063.  
  4064.  
  4065.  
  4066.  
  4067.  
  4068.  
  4069.  
  4070.  
  4071.  
  4072.  
  4073.  
  4074.  
  4075.  
  4076.  
  4077.  
  4078.  
  4079.  
  4080.  
  4081.  
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.  
  4088.  
  4089.  
  4090.  
  4091.  
  4092.  
  4093.   #
  4094.   # sample.dip    Dialup IP connection support program.
  4095.   #
  4096.   #               This file (should show) shows how to use the DIP
  4097.   #       This file should work for Annex type dynamic servers, if you
  4098.   #       use a static address server then use the sample.dip file that
  4099.   #       comes as part of the dip337-uri.tgz package.
  4100.   #
  4101.   #
  4102.   # Version:      @(#)sample.dip  1.40    07/20/93
  4103.   #
  4104.   # Author:       Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  4105.   #
  4106.  
  4107.   main:
  4108.   # Next, set up the other side's name and address.
  4109.   # My dialin machine is called 'xs4all.hacktic.nl' (== 193.78.33.42)
  4110.   get $remote xs4all.hacktic.nl
  4111.   # Set netmask on sl0 to 255.255.255.0
  4112.   netmask 255.255.255.0
  4113.   # Set the desired serial port and speed.
  4114.   port cua02
  4115.   speed 38400
  4116.  
  4117.   # Reset the modem and terminal line.
  4118.   # This seems to cause trouble for some people!
  4119.   reset
  4120.  
  4121.   # Note! "Standard" pre-defined "errlevel" values:
  4122.   #  0 - OK
  4123.   #  1 - CONNECT
  4124.   #  2 - ERROR
  4125.   #
  4126.   # You can change those grep'ping for "addchat()" in *.c...
  4127.  
  4128.   # Prepare for dialing.
  4129.   send ATQ0V1E1X4\r
  4130.   wait OK 2
  4131.   if $errlvl != 0 goto modem_trouble
  4132.   dial 555-1234567
  4133.   if $errlvl != 1 goto modem_trouble
  4134.  
  4135.   # We are connected.  Login to the system.
  4136.   login:
  4137.   sleep 2
  4138.   wait ogin: 20
  4139.   if $errlvl != 0 goto login_trouble
  4140.   send MYLOGIN\n
  4141.   wait ord: 20
  4142.   if $errlvl != 0 goto password_error
  4143.   send MYPASSWD\n
  4144.   loggedin:
  4145.  
  4146.   # We are now logged in.
  4147.   wait SOMEPROMPT 30
  4148.   if $errlvl != 0 goto prompt_error
  4149.  
  4150.   # Command the server into SLIP mode
  4151.   send SLIP\n
  4152.   wait SLIP 30
  4153.   if $errlvl != 0 goto prompt_error
  4154.  
  4155.   # Get and Set your IP address from the server.
  4156.   #   Here we assume that after commanding the SLIP server into SLIP
  4157.   #   mode that it prints your IP address
  4158.   get $locip remote 30
  4159.   if $errlvl != 0 goto prompt_error
  4160.  
  4161.   # Set up the SLIP operating parameters.
  4162.   get $mtu 296
  4163.   # Ensure "route add -net default xs4all.hacktic.nl" will be done
  4164.   default
  4165.  
  4166.   # Say hello and fire up!
  4167.   done:
  4168.   print CONNECTED $locip ---> $rmtip
  4169.   mode CSLIP
  4170.   goto exit
  4171.  
  4172.   prompt_error:
  4173.   print TIME-OUT waiting for sliplogin to fire up...
  4174.   goto error
  4175.  
  4176.   login_trouble:
  4177.   print Trouble waiting for the Login: prompt...
  4178.   goto error
  4179.  
  4180.   password:error:
  4181.   print Trouble waiting for the Password: prompt...
  4182.   goto error
  4183.  
  4184.   modem_trouble:
  4185.   print Trouble occurred with the modem...
  4186.   error:
  4187.   print CONNECT FAILED to $remote
  4188.   quit
  4189.  
  4190.   exit:
  4191.   exit
  4192.  
  4193.  
  4194.  
  4195.  
  4196.  
  4197.   The above example assumes you are calling a dynamic SLIP server, if
  4198.   you are calling a static SLIP server, then the sample.dip file that
  4199.   comes with dip337j-uri.tgz should work for you.
  4200.  
  4201.   When dip is given the get $local command it searches the incoming text
  4202.   from the remote end for a string that looks like an IP address, ie
  4203.   strings numbers separated by `.' characters. This modification was put
  4204.   in place specifically for dynamic SLIP servers, so that the process of
  4205.   reading the IP address granted by the server could be automated.
  4206.  
  4207.   The example above will automatically create a default route via your
  4208.   SLIP link, if this is not what you want, you might have an ethernet
  4209.   connection that should be your default route, then remove the default
  4210.   command from the script.  After this script has finished running, if
  4211.   you do an ifconfig command, you will see that you have a device sl0.
  4212.   This is your SLIP device.  Should you need to, you can modify its
  4213.   configuration manually, after the dip command has finished, using the
  4214.   ifconfig and route commands.
  4215.  
  4216.   Please note that dip allows you to select a number of different
  4217.   protocols to use with the mode command, the most common example is
  4218.   cSLIP for SLIP with compression. Please note that both ends of the
  4219.   link must agree, so you should ensure that whatever you select agrees
  4220.   with what your server is set to.
  4221.  
  4222.   The above example is fairly robust and should cope with most errors.
  4223.   Please refer to the dip man page for more information. Naturally you
  4224.   could, for example, code the script to do such things as redial the
  4225.   server if it doesn't get a connection within a prescribed period of
  4226.   time, or even try a series of servers if you have access to more than
  4227.   one.
  4228.  
  4229.   7.5.7.  Permanent SLIP connection using a leased line and slattach.
  4230.  
  4231.   If you have a cable between two machines, or are fortunate enough to
  4232.   have a leased line, or some other permanent serial connection between
  4233.   your machine and another, then you don't need to go to all the trouble
  4234.   of using dip to set up your serial link. slattach is a very simple to
  4235.   use utility that will allow you just enough functionality to configure
  4236.   your connection.
  4237.  
  4238.   Since your connection will be a permanent one, you will want to add
  4239.   some commands to your rc.inet1 file. In essence all you need to do for
  4240.   a permanent connection is ensure that you configure the serial device
  4241.   to the correct speed and switch the serial device into SLIP mode.
  4242.   slattach allows you to do this with one command. Add the following to
  4243.   your rc.inet1 file:
  4244.  
  4245.  
  4246.  
  4247.                #
  4248.                # Attach a leased line static SLIP connection
  4249.                #
  4250.                #  configure /dev/cua0 for 19.2kbps and cslip
  4251.                /sbin/slattach -p cslip -s 19200 /dev/cua0 &
  4252.                /sbin/ifconfig sl0 IPA.IPA.IPA.IPA pointopoint IPR.IPR.IPR.IPR up
  4253.                #
  4254.                # End static SLIP.
  4255.  
  4256.  
  4257.  
  4258.  
  4259.  
  4260.  
  4261.   Where:
  4262.  
  4263.  
  4264.      IPA.IPA.IPA.IPA
  4265.         represents your IP address.
  4266.  
  4267.  
  4268.      IPR.IPR.IPR.IPR
  4269.         represents the IP address of the remote end.
  4270.  
  4271.  
  4272.   slattach allocates the first unallocated SLIP device to the serial
  4273.   device specified. slattach starts with sl0. Therefore the first
  4274.   slattach command attaches SLIP device sl0 to the serial device
  4275.   specified and sl1 the next time, etc.
  4276.  
  4277.   slattach allows you to configure a number of different protocols with
  4278.   the -p argument. In your case you will use either SLIP or cSLIP
  4279.   depending on whether you want to use compression or not.  Note: both
  4280.   ends must agree on whether you want compression or not.
  4281.  
  4282.   7.6.  SLIP server.
  4283.  
  4284.   If you have a machine that is perhaps network connected, that you'd
  4285.   like other people be able to dial into and provide network services,
  4286.   then you will need to configure your machine as a server. If you want
  4287.   to use SLIP as the serial line protocol, then currently you have three
  4288.   options as to how to configure your Linux machine as a SLIP server. My
  4289.   preference would be to use the first presented, sliplogin, as it seems
  4290.   the easiest to configure and understand, but I will present a summary
  4291.   of each, so you can make your own decision.
  4292.  
  4293.   7.6.1.  Slip Server using sliplogin .
  4294.  
  4295.   sliplogin is a program that you can use in place of the normal login
  4296.   shell for SLIP users that converts the terminal line into a SLIP line.
  4297.   It allows you to configure your Linux machine as either a static
  4298.   address server, users get the same address everytime they call in, or
  4299.   a dynamic address server, where users get an address allocated for
  4300.   them which will not necessarily be the same as the last time they
  4301.   called.
  4302.  
  4303.   The caller will login as per the standard login process, entering
  4304.   their username and password, but instead of being presented with a
  4305.   shell after their login, sliplogin is executed which searches its
  4306.   configuration file (/etc/slip.hosts) for an entry with a login name
  4307.   that matches that of the caller. If it locates one, it configures the
  4308.   line as an 8bit clean line, and uses an ioctl call to convert the line
  4309.   discipline to SLIP. When this process is complete, the last stage of
  4310.   configuration takes place, where sliplogin invokes a shell script
  4311.   which configures the SLIP interface with the relevant ip address,
  4312.   netmask and sets appropriate routing in place.  This script is usually
  4313.   called /etc/slip.login, but in a similar manner to getty, if you have
  4314.   certain callers that require special initialization, then you can
  4315.   create configuration scripts called /etc/slip.login.loginname that
  4316.   will be run instead of the default specifically for them.
  4317.  
  4318.   There are either three or four files that you need to configure to get
  4319.   sliplogin working for you. I will detail how and where to get the
  4320.   software and how each is configured in detail. The files are:
  4321.  
  4322.  
  4323.   ╖  /etc/passwd, for the dialin user accounts.
  4324.  
  4325.   ╖  /etc/slip.hosts, to contain the information unique to each dial-in
  4326.      user.
  4327.  
  4328.   ╖  /etc/slip.login, which manages the configuration of the routing
  4329.      that needs to be performed for the user.
  4330.  
  4331.   ╖  /etc/slip.tty, which is required only if you are configuring your
  4332.      server for dynamic address allocation and contains a table of
  4333.      addresses to allocate
  4334.  
  4335.   ╖  /etc/slip.logout, which contains commands to clean up after the
  4336.      user has hung up or logged out.
  4337.  
  4338.  
  4339.   7.6.1.1.  Where to get sliplogin
  4340.  
  4341.   You may already have the sliplogin package installed as part of your
  4342.   distribution, if not then sliplogin can be obtained from:
  4343.   sunsite.unc.edu
  4344.   <ftp://sunsite.unc.edu/pub/linux/system/Network/serial/sliplogin-2.1.1.tar.gz>.
  4345.   The tar file contains both source, precompiled binaries and a man
  4346.   page.
  4347.  
  4348.   To ensure that only authorized users will be able to run sliplogin
  4349.   program, you should add an entry to your /etc/group file similar to
  4350.   the following:
  4351.  
  4352.  
  4353.  
  4354.  
  4355.  
  4356.  
  4357.    ..
  4358.   slip::13:radio,fred
  4359.    ..
  4360.  
  4361.  
  4362.  
  4363.  
  4364.  
  4365.   When you install the sliplogin package, the Makefile will change the
  4366.   group ownership of the sliplogin program to slip, and this will mean
  4367.   that only users who belong to that group will be able to execute it.
  4368.   The example above will allow only users radio and fred to execute
  4369.   sliplogin.
  4370.  
  4371.   To install the binaries into your /sbin directory and the man page
  4372.   into section 8, do the following:
  4373.  
  4374.  
  4375.  
  4376.        # cd /usr/src
  4377.        # gzip -dc .../sliplogin-2.1.1.tar.gz | tar xvf -
  4378.        # cd sliplogin-2.1.1
  4379.        # <..edit the Makefile if you don't use shadow passwords..>
  4380.        # make install
  4381.  
  4382.  
  4383.  
  4384.  
  4385.  
  4386.   If you want to recompile the binaries before installation, add a make
  4387.   clean before the make install. If you want to install the binaries
  4388.   somewhere else, you will need to edit the Makefile install rule.
  4389.  
  4390.   Please read the README files that come with the package for more
  4391.   information.
  4392.  
  4393.   7.6.1.2.  Configuring /etc/passwd  for Slip hosts.
  4394.  
  4395.   Normally you would create some special logins for Slip callers in your
  4396.   /etc/passwd file. A convention commonly followed is to use the
  4397.   hostname of the calling host with a capital `S' prefixing it. So, for
  4398.   example, if the calling host is called radio then you could create a
  4399.   /etc/passwd entry that looked like:
  4400.  
  4401.  
  4402.  
  4403.        Sradio:FvKurok73:1427:1:radio SLIP login:/tmp:/sbin/sliplogin
  4404.  
  4405.  
  4406.  
  4407.  
  4408.  
  4409.   It doesn't really matter what the account is called, so long as it is
  4410.   meaningful to you.
  4411.  
  4412.   Note: the caller doesn't need any special home directory, as they will
  4413.   not be presented with a shell from this machine, so /tmp is a good
  4414.   choice.  Also note that sliplogin is used in place of the normal login
  4415.   shell.
  4416.  
  4417.   7.6.1.3.  Configuring /etc/slip.hosts
  4418.  
  4419.   The /etc/slip.hosts file is the file that sliplogin searches for
  4420.   entries matching the login name to obtain configuration details for
  4421.   this caller. It is this file where you specify the ip address and
  4422.   netmask that will be assigned to the caller and configured for their
  4423.   use. Sample entries for two hosts, one a static configuration for host
  4424.   radio and another, a dynamic configuration for user host albert might
  4425.   look like:
  4426.  
  4427.  
  4428.  
  4429.        #
  4430.        Sradio   44.136.8.99   44.136.8.100  255.255.255.0  normal      -1
  4431.        Salbert  44.136.8.99   DYNAMIC       255.255.255.0  compressed  60
  4432.        #
  4433.  
  4434.  
  4435.  
  4436.  
  4437.  
  4438.   The /etc/slip.hosts file entries are:
  4439.  
  4440.  
  4441.   1. the login name of the caller.
  4442.  
  4443.   2. ip address of the server machine, ie this machine.
  4444.  
  4445.   3. ip address that the caller will be assigned. If this field is coded
  4446.      DYNAMIC then an ip address will be allocated based on the
  4447.      information contained in your /etc/slip.tty file discussed later.
  4448.      Note: you must be using at least version 1.3 of sliplogin for this
  4449.      to work.
  4450.  
  4451.   4. the netmask assigned to the calling machine in dotted decimal
  4452.      notation eg 255.255.255.0 for a Class C network mask.
  4453.  
  4454.   5. the slip mode setting which allows you to enable/disable
  4455.      compression and slip other features. Allowable values here are
  4456.      "normal" or "compressed".
  4457.  
  4458.   6. a timeout parameter which specifies how long the line can remain
  4459.      idle (no datagrams received) before the line is automatically
  4460.      disconnected. A negative value disables this feature.
  4461.  
  4462.   7. optional arguments.
  4463.  
  4464.  
  4465.   Note: You can use either hostnames or IP addresses in dotted decimal
  4466.   notation for fields 2 and 3. If you use hostnames then those hosts
  4467.   must be resolvable, that is, your machine must be able to locate an ip
  4468.   address for those hostnames, otherwise the script will fail when it is
  4469.   called. You can test this by trying trying to telnet to the hostname,
  4470.   if you get the `Trying nnn.nnn.nnn...' message then your machine has
  4471.   been able to find an ip address for that name. If you get the message
  4472.   `Unknown host', then it has not. If not, either use ip addresses in
  4473.   dotted decimal notation, or fix up your name resolver configuration
  4474.   (See section Name Resolution).
  4475.  
  4476.   The most common slip modes are:
  4477.  
  4478.  
  4479.      normal
  4480.         to enable normal uncompressed SLIP.
  4481.  
  4482.  
  4483.      compressed
  4484.         to enable van Jacobsen header compression (cSLIP)
  4485.  
  4486.  
  4487.   Naturally these are mutually exclusive, you can use one or the other.
  4488.   For more information on the other options available, refer to the man
  4489.   pages.
  4490.  
  4491.   7.6.1.4.  Configuring the /etc/slip.login  file.
  4492.  
  4493.   After sliplogin has searched the /etc/slip.hosts and found a matching
  4494.   entry, it will attempt to execute the /etc/slip.login file to actually
  4495.   configure the SLIP interface with its ip address and netmask.
  4496.  
  4497.   The sample /etc/slip.login file supplied with the sliplogin package
  4498.   looks like this:
  4499.  
  4500.  
  4501.  
  4502.        #!/bin/sh -
  4503.        #
  4504.        #       @(#)slip.login  5.1 (Berkeley) 7/1/90
  4505.        #
  4506.        # generic login file for a SLIP line.  sliplogin invokes this with
  4507.        # the parameters:
  4508.        #     $1       $2       $3    $4, $5, $6 ...
  4509.        #   SLIPunit ttyspeed   pid   the arguments from the slip.host entry
  4510.        #
  4511.        /sbin/ifconfig $1 $5 pointopoint $6 mtu 1500 -trailers up
  4512.        /sbin/route add $6
  4513.        arp -s $6 <hw_addr> pub
  4514.        exit 0
  4515.        #
  4516.  
  4517.  
  4518.  
  4519.  
  4520.  
  4521.   You will note that this script simply uses the ifconfig and route com¡
  4522.   mands to configure the SLIP device with its ipaddress, remote ip
  4523.   address and netmask and creates a route for the remote address via the
  4524.   SLIP device. Just the same as you would if you were using the slattach
  4525.   command.
  4526.  
  4527.   Note also the use of Proxy ARP to ensure that other hosts on the same
  4528.   ethernet as the server machine will know how to reach the dial-in
  4529.   host.  The <hw_addr> field should be the hardware address of the
  4530.   ethernet card in the machine. If your server machine isn't on an
  4531.   ethernet network then you can leave this line out completely.
  4532.  
  4533.   7.6.1.5.  Configuring the /etc/slip.logout  file.
  4534.  
  4535.   When the call drops out, you want to ensure that the serial device is
  4536.   restored to its normal state so that future callers will be able to
  4537.   login correctly.  This is achieved with the use of the
  4538.   /etc/slip.logout file. It is quite simple in format and is called with
  4539.   the same argument as the /etc/slip.login file.
  4540.  
  4541.  
  4542.  
  4543.                #!/bin/sh -
  4544.                #
  4545.                #               slip.logout
  4546.                #
  4547.                /sbin/ifconfig $1 down
  4548.                arp -d $6
  4549.                exit 0
  4550.                #
  4551.  
  4552.  
  4553.  
  4554.  
  4555.   All it does is `down' the interface which will delete the manual route
  4556.   previously created. It also uses the arp command to delete any proxy
  4557.   arp put in place, again, you don't need the arp command in the script
  4558.   if your server machine does not have an ethernet port.
  4559.  
  4560.   7.6.1.6.  Configuring the /etc/slip.tty  file.
  4561.  
  4562.   If you are using dynamic ip address allocation (have any hosts
  4563.   configured with the DYNAMIC keyword in the /etc/slip.hosts file, then
  4564.   you must configure the /etc/slip.tty file to list what addresses are
  4565.   assigned to what port. You only need this file if you wish your server
  4566.   to dynamically allocate addresses to users.
  4567.  
  4568.   The file is a table that lists the tty devices that will support dial-
  4569.   in SLIP connections and the ip address that should be assigned to
  4570.   users who call in on that port.
  4571.  
  4572.   Its format is as follows:
  4573.  
  4574.  
  4575.        # slip.tty    tty -> IP address mappings for dynamic SLIP
  4576.        # format: /dev/tty?? xxx.xxx.xxx.xxx
  4577.        #
  4578.        /dev/ttyS0      192.168.0.100
  4579.        /dev/ttyS1      192.168.0.101
  4580.        #
  4581.  
  4582.  
  4583.  
  4584.  
  4585.  
  4586.   What this table says is that callers that dial in on port /dev/ttyS0
  4587.   who have their remote address field in the /etc/slip.hosts file set to
  4588.   DYNAMIC will be assigned an address of 192.168.0.100.
  4589.  
  4590.   In this way you need only allocate one address per port for all users
  4591.   who do not require an dedicated address for themselves. This helps you
  4592.   keep the number of addresses you need down to a minimum to avoid
  4593.   wastage.
  4594.  
  4595.   7.6.2.  Slip Server using dip .
  4596.  
  4597.   Let me start by saying that some of the information below came from
  4598.   the dip man pages, where how to run Linux as a SLIP server is briefly
  4599.   documented. Please also beware that the following has been based on
  4600.   the dip337o-uri.tgz package and probably will not apply to other
  4601.   versions of dip.
  4602.  
  4603.   dip has an input mode of operation, where it automatically locates an
  4604.   entry for the user who invoked it and configures the serial line as a
  4605.   SLIP link according to information it finds in the /etc/diphosts file.
  4606.   This input mode of operation is activated by invoking dip as diplogin.
  4607.   This therefore is how you use dip as a SLIP server, by creating
  4608.   special accounts where diplogin is used as the login shell.
  4609.  
  4610.   The first thing you will need to do is to make a symbolic link as
  4611.   follows:
  4612.  
  4613.  
  4614.  
  4615.        # ln -sf /usr/sbin/dip /usr/sbin/diplogin
  4616.  
  4617.  
  4618.  
  4619.  
  4620.  
  4621.   You then need to add entries to both your /etc/passwd and your
  4622.   /etc/diphosts files. The entries you need to make are formatted as
  4623.   follows:
  4624.  
  4625.   To configure Linux as a SLIP server with dip, you need to create some
  4626.   special SLIP accounts for users, where dip (in input mode) is used as
  4627.   the login shell. A suggested convention is that of having all SLIP
  4628.   accounts begin with a capital `S', eg `Sfredm'.
  4629.  
  4630.   A sample /etc/passwd entry for a SLIP user looks like:
  4631.  
  4632.  
  4633.  
  4634.        Sfredm:ij/SMxiTlGVCo:1004:10:Fred:/tmp:/usr/sbin/diplogin
  4635.        ^^         ^^        ^^  ^^   ^^   ^^   ^^
  4636.        |          |         |   |    |    |    \__ diplogin as login shell
  4637.        |          |         |   |    |    \_______ Home directory
  4638.        |          |         |   |    \____________ User Full Name
  4639.        |          |         |   \_________________ User Group ID
  4640.        |          |         \_____________________ User ID
  4641.        |          \_______________________________ Encrypted User Password
  4642.        \__________________________________________ Slip User Login Name
  4643.  
  4644.  
  4645.  
  4646.  
  4647.  
  4648.   After the user logs in, the login program, if it finds and verifies
  4649.   the user ok, will execute the diplogin command. dip, when invoked as
  4650.   diplogin knows that it should automatically assume that it is being
  4651.   used a login shell. When it is started as diplogin the first thing it
  4652.   does is use the getuid() function call to get the userid of whoever
  4653.   has invoked it. It then searches the /etc/diphosts file for the first
  4654.   entry that matches either the userid or the name of the tty device
  4655.   that the call has come in on and configures itself appropriately.  By
  4656.   judicious decision as to whether to give a user an entry in the
  4657.   diphosts file, or whether to let the user be given the default
  4658.   configuration you can build your server in such a way that you can
  4659.   have a mix of static and dynamically assigned address users.
  4660.  
  4661.   dip will automatically add a `Proxy-ARP' entry if invoked in input
  4662.   mode, so you do not need to worry about manually adding such entries.
  4663.  
  4664.   7.6.2.1.  Configuring /etc/diphosts
  4665.  
  4666.   /etc/diphosts is used by dip to lookup preset configurations for
  4667.   remote hosts. These remote hosts might be users dialing into your
  4668.   linux machine, or they might be for machines that you dial into with
  4669.   your linux machine.
  4670.  
  4671.   The general format for /etc/diphosts is as follows:
  4672.  
  4673.  
  4674.  
  4675.         ..
  4676.        Suwalt::145.71.34.1:145.71.34.2:255.255.255.0:SLIP uwalt:CSLIP,1006
  4677.        ttyS1::145.71.34.3:145.71.34.2:255.255.255.0:Dynamic ttyS1:CSLIP,296
  4678.         ..
  4679.  
  4680.  
  4681.  
  4682.  
  4683.  
  4684.   The fields are:
  4685.  
  4686.  
  4687.   1. login name: as returned by getpwuid(getuid()) or tty name.
  4688.  
  4689.   2. unused: compat. with passwd
  4690.  
  4691.   3. Remote Address: IP address of the calling host, either numeric or
  4692.      by name
  4693.  
  4694.   4. Local Address: IP address of this machine, again numeric or by name
  4695.  
  4696.   5. Netmask: in dotted decimal notation
  4697.  
  4698.   6. Comment field: put whatever you want here.
  4699.  
  4700.   7. protocol: Slip, CSlip etc.
  4701.  
  4702.   8. MTU: decimal number
  4703.  
  4704.  
  4705.      An example /etc/net/diphosts entry for a remote SLIP user might be:
  4706.  
  4707.  
  4708.  
  4709.        Sfredm::145.71.34.1:145.71.34.2:255.255.255.0:SLIP uwalt:SLIP,296
  4710.  
  4711.  
  4712.  
  4713.  
  4714.  
  4715.   which specifies a SLIP link with remote address of 145.71.34.1 and MTU
  4716.   of 296, or:
  4717.  
  4718.  
  4719.  
  4720.        Sfredm::145.71.34.1:145.71.34.2:255.255.255.0:SLIP uwalt:CSLIP,1006
  4721.  
  4722.  
  4723.  
  4724.  
  4725.  
  4726.   which specifies a cSLIP-capable link with remote address 145.71.34.1
  4727.   and MTU of 1006.
  4728.  
  4729.   Therefore, all users who you wish to be allowed a statically allocated
  4730.   dial-up IP access should have an entry in the /etc/diphosts. If you
  4731.   want users who call a particular port to have their details
  4732.   dynamically allocated then you must have an entry for the tty device
  4733.   and do not configure a user based entry. You should remember to
  4734.   configure at least one entry for each tty device that your dialup
  4735.   users use to ensure that a suitable configuration is available for
  4736.   them regardless of which modem they call in on.
  4737.  
  4738.   When a user logs in they will receive a normal login and password
  4739.   prompt at which they should enter their SLIP-login userid and
  4740.   password. If these verify ok then the user will see no special
  4741.   messages and they should just change into SLIP mode at their end. The
  4742.   user should then be able to connect ok and be configured with the
  4743.   relevant parameters from the diphosts file.
  4744.  
  4745.   7.6.3.  SLIP server using the dSLIP  package.
  4746.  
  4747.   Matt Dillon <dillon@apollo.west.oic.com> has written a package that
  4748.   does not only dial-in but also dial-out SLIP. Matt's package is a
  4749.   combination of small programs and scripts that manage your connections
  4750.   for you. You will need to have tcsh installed as at least one of the
  4751.   scripts requires it. Matt supplies a binary copy of the expect utility
  4752.   as it too is needed by one of the scripts. You will most likely need
  4753.   some experience with expect to get this package working to your
  4754.   liking, but don't let that put you off.
  4755.  
  4756.   Matt has written a good set of installation instructions in the README
  4757.   file, so I won't bother repeating them.
  4758.  
  4759.   You can get the dSLIP package from its home site at:
  4760.  
  4761.   apollo.west.oic.com
  4762.  
  4763.  
  4764.        /pub/linux/dillon_src/dSLIP203.tgz
  4765.  
  4766.  
  4767.  
  4768.  
  4769.  
  4770.   or from:
  4771.  
  4772.   sunsite.unc.edu
  4773.  
  4774.  
  4775.        /pub/Linux/system/Network/serial/dSLIP203.tgz
  4776.  
  4777.  
  4778.  
  4779.  
  4780.  
  4781.   Read the README file and create the /etc/passwd and /etc/group entries
  4782.   before doing a make install.
  4783.  
  4784.  
  4785.   8.  Other Network Technologies
  4786.  
  4787.   The following subsections are specific to particular network
  4788.   technologies.  The information contained in these sections does not
  4789.   necessarily apply to any other type of network technology. The topics
  4790.   are sorted alphabetically.
  4791.  
  4792.   8.1.  ARCNet
  4793.  
  4794.   ARCNet device names are `arc0e', `arc1e', `arc2e' etc. or `arc0s',
  4795.   `arc1s', `arc2s' etc. The first card detected by the kernel is
  4796.   assigned `arc0e' or `arc0s' and the rest are assigned sequentially in
  4797.   the order they are detected. The letter at the end signifies whether
  4798.   you've selected ethernet encapsulation packet format or RFC1051 packet
  4799.   format.
  4800.  
  4801.   Kernel Compile Options:
  4802.  
  4803.  
  4804.                Network device support  --->
  4805.                    [*] Network device support
  4806.                    <*> ARCnet support
  4807.                    [ ]   Enable arc0e (ARCnet "Ether-Encap" packet format)
  4808.                    [ ]   Enable arc0s (ARCnet RFC1051 packet format)
  4809.  
  4810.  
  4811.  
  4812.  
  4813.  
  4814.  
  4815.   Once you have your kernel properly built to support your ethernet card
  4816.   then configuration of the card is easy.
  4817.  
  4818.  
  4819.   Typically you would use something like:
  4820.  
  4821.  
  4822.  
  4823.                root# ifconfig arc0e 192.168.0.1 netmask 255.255.255.0 up
  4824.                root# route add -net 192.168.0.0 netmask 255.255.255.0 arc0e
  4825.  
  4826.  
  4827.  
  4828.  
  4829.  
  4830.  
  4831.   Please refer to the /usr/src/linux/Documentation/networking/arcnet.txt
  4832.   and /usr/src/linux/Documentation/networking/arcnet-hardware.txt files
  4833.   for further information.
  4834.  
  4835.   ARCNet support was developed by Avery Pennarun, apenwarr@foxnet.net.
  4836.  
  4837.   8.2.  Appletalk ( AF_APPLETALK )
  4838.  
  4839.   The Appletalk support has no special device names as it uses existing
  4840.   network devices.
  4841.  
  4842.   Kernel Compile Options:
  4843.  
  4844.  
  4845.                Networking options  --->
  4846.                    <*> Appletalk DDP
  4847.  
  4848.  
  4849.  
  4850.  
  4851.  
  4852.  
  4853.   Appletalk support allows your Linux machine to interwork with Apple
  4854.   networks.  An important use for this is to share resources such as
  4855.   printers and disks between both your Linux and Apple computers.
  4856.   Additional software is required, this is called netatalk. Wesley Craig
  4857.   netatalk@umich.edu represents a team called the `Research Systems Unix
  4858.   Group' at the University of Michigan and they have produced the
  4859.   netatalk package which provides software that implements the Appletalk
  4860.   protocol stack and some useful utilities.  The netatalk package will
  4861.   either have been supplied with your Linux distribution, or you will
  4862.   have to ftp it from its home site at the University of Michigan
  4863.   <ftp://terminator.rs.itd.umich.edu/unix/netatalk/>
  4864.  
  4865.   To build and install the package do something like:
  4866.  
  4867.  
  4868.  
  4869.                user% tar xvfz .../netatalk-1.4b2.tar.Z
  4870.                user% make
  4871.                root# make install
  4872.  
  4873.  
  4874.  
  4875.  
  4876.  
  4877.  
  4878.   You may want to edit the `Makefile' before calling make to actually
  4879.   compile the software. Specifically, you might want to change the
  4880.   DESTDIR variable which defines where the files will be installed
  4881.   later.  The default of /usr/local/atalk is fairly safe.
  4882.  
  4883.  
  4884.  
  4885.   8.2.1.  Configuring the Appletalk software.
  4886.  
  4887.   The first thing you need to do to make it all work is to ensure that
  4888.   the appropriate entries in the /etc/services file are present. The
  4889.   entries you need are:
  4890.  
  4891.  
  4892.  
  4893.          rtmp  1/ddp   # Routing Table Maintenance Protocol
  4894.          nbp   2/ddp   # Name Binding Protocol
  4895.          echo  4/ddp   # AppleTalk Echo Protocol
  4896.          zip   6/ddp   # Zone Information Protocol
  4897.  
  4898.  
  4899.  
  4900.  
  4901.  
  4902.  
  4903.   The next step is to create the Appletalk configuration files in the
  4904.   /usr/local/atalk/etc directory (or wherever you installed the
  4905.   package).
  4906.  
  4907.   The first file to create is the /usr/local/atalk/etc/atalkd.conf file.
  4908.   Initially this file needs only one line that gives the name of the
  4909.   network device that supports the network that your Apple machines are
  4910.   on:
  4911.  
  4912.  
  4913.  
  4914.          eth0
  4915.  
  4916.  
  4917.  
  4918.  
  4919.  
  4920.  
  4921.   The Appletalk daemon program will add extra details after it is run.
  4922.  
  4923.   8.2.2.  Exporting a Linux filesystems via Appletalk.
  4924.  
  4925.   You can export filesystems from your linux machine to the network so
  4926.   that Apple machine on the network can share them.
  4927.  
  4928.   To do this you must configure the
  4929.   /usr/local/atalk/etc/AppleVolumes.system file. There is another
  4930.   configuration file called /usr/local/atalk/etc/AppleVolumes.default
  4931.   which has exactly the same format and describes which filesystems
  4932.   users connecting with guest privileges will receive.
  4933.  
  4934.   Full details on how to configure these files and what the various
  4935.   options are can be found in the afpd man page.
  4936.  
  4937.   A simple example might look like:
  4938.  
  4939.  
  4940.  
  4941.          /tmp Scratch
  4942.          /home/ftp/pub "Public Area"
  4943.  
  4944.  
  4945.  
  4946.  
  4947.  
  4948.  
  4949.   Which would export your /tmp filesystem as AppleShare Volume `Scratch'
  4950.   and your ftp public directory as AppleShare Volume `Public Area'.  The
  4951.   volume names are not mandatory, the daemon will choose some for you,
  4952.   but it won't hurt to specify them anyway.
  4953.  
  4954.   8.2.3.  Sharing your Linux printer across Appletalk.
  4955.  
  4956.   You can share your linux printer with your Apple machines quite
  4957.   simply.  You need to run the papd program which is the Appletalk
  4958.   Printer Access Protocol Daemon. When you run this program it will
  4959.   accept requests from your Apple machines and spool the print job to
  4960.   your local line printer daemon for printing.
  4961.  
  4962.   You need to edit the /usr/local/atalk/etc/papd.conf file to configure
  4963.   the daemon. The syntax of this file is the same as that of your usual
  4964.   /etc/printcap file. The name you give to the definition is registered
  4965.   with the Appletalk naming protocol, NBP.
  4966.  
  4967.   A sample configuration might look like:
  4968.  
  4969.  
  4970.  
  4971.          TricWriter:\
  4972.             :pr=lp:op=cg:
  4973.  
  4974.  
  4975.  
  4976.  
  4977.  
  4978.  
  4979.   Which would make a printer named `TricWriter' available to your
  4980.   Appletalk network and all accepted jobs would be printed to the linux
  4981.   printer `lp' (as defined in the /etc/printcap file) using lpd. The
  4982.   entry `op=cg' says that the linux user `cg' is the operator of the
  4983.   printer.
  4984.  
  4985.   8.2.4.  Starting the appletalk software.
  4986.  
  4987.   Ok, you should now be ready to test this basic configuration. There is
  4988.   an rc.atalk file supplied with the netatalk package that should work
  4989.   ok for you, so all you should have to do is:
  4990.  
  4991.  
  4992.  
  4993.                root# /usr/local/atalk/etc/rc.atalk
  4994.  
  4995.  
  4996.  
  4997.  
  4998.  
  4999.  
  5000.   and all should startup and run ok. You should see no error messages
  5001.   and the software will send messages to the console indicating each
  5002.   stage as it starts.
  5003.  
  5004.   8.2.5.  Testing the appletalk software.
  5005.  
  5006.   To test that the software is functioning properly, go to one of your
  5007.   Apple machines, pull down the Apple menu, select the Chooser, click on
  5008.   AppleShare, and your Linux box should appear.
  5009.  
  5010.   8.2.6.  Caveats of the appletalk software.
  5011.  
  5012.  
  5013.  
  5014.   ╖  You may need to start the Appletalk support before you configure
  5015.      your IP network. If you have problems starting the Appletalk
  5016.      programs, or if after you start them you have trouble with your IP
  5017.      network, then try starting the Appletalk software before you run
  5018.      your /etc/rc.d/rc.inet1 file.
  5019.  
  5020.   ╖  The afpd (Apple Filing Protocol Daemon) severely messes up your
  5021.      hard disk. Below the mount points it creates a couple of
  5022.      directories called ``.AppleDesktop'' and Network Trash Folder.
  5023.      Then, for each directory you access it will create a .AppleDouble
  5024.      below it so it can store resource forks, etc. So think twice before
  5025.      exporting /, you will have a great time cleaning up afterwards.
  5026.  
  5027.   ╖  The afpd program expects clear text passwords from the Macs.
  5028.      Security could be a problem, so be very careful when you run this
  5029.      daemon on a machine connected to the Internet, you have yourself to
  5030.      blame if somebody nasty does something bad.
  5031.  
  5032.   ╖  The existing diagnostic tools such as netstat and ifconfig don't
  5033.      support Appletalk. The raw information is available in the
  5034.      /proc/net/ directory if you need it.
  5035.  
  5036.  
  5037.   8.2.7.  More information
  5038.  
  5039.   For a much more detailed description of how to configure Appletalk for
  5040.   Linux refer to Anders Brownworth Linux Netatalk-HOWTO page at
  5041.   thehamptons.com <http://thehamptons.com/anders/netatalk/>.
  5042.  
  5043.   8.3.  ATM
  5044.  
  5045.   Werner Almesberger <werner.almesberger@lrc.di.epfl.ch> is managing a
  5046.   project to provide Asynchronous Transfer Mode support for Linux.
  5047.   Current information on the status of the project may be obtained from:
  5048.   lrcwww.epfl.ch <http://lrcwww.epfl.ch/linux-atm/>.
  5049.  
  5050.   8.4.  AX25 ( AF_AX25 )
  5051.  
  5052.   AX.25 device names are `sl0', `sl1', etc. in 2.0.* kernels or `ax0',
  5053.   `ax1', etc. in 2.1.* kernels.
  5054.  
  5055.   Kernel Compile Options:
  5056.  
  5057.  
  5058.                Networking options  --->
  5059.                    [*] Amateur Radio AX.25 Level 2
  5060.  
  5061.  
  5062.  
  5063.  
  5064.  
  5065.  
  5066.   The AX25, Netrom and Rose protocols are covered by the AX25-HOWTO
  5067.   <AX25-HOWTO.html>.  These protocols are used by Amateur Radio
  5068.   Operators world wide in packet radio experimentation.
  5069.  
  5070.   Most of the work for implementation of these protocols has been done
  5071.   by Jonathon Naylor, jsn@cs.nott.ac.uk.
  5072.  
  5073.   8.5.  DECNet
  5074.  
  5075.   Support for DECNet is currently being worked on. You should expect it
  5076.   to appear in a late 2.1.* kernel.
  5077.  
  5078.   8.6.  FDDI
  5079.  
  5080.   FDDI device names are `fddi0', `fddi1', `fddi2' etc. The first card
  5081.   detected by the kernel is assigned `fddi0' and the rest are assigned
  5082.   sequentially in the order they are detected.
  5083.   Larry Stefani, lstefani@ultranet.com, has developed a driver for the
  5084.   Digital Equipment Corporation FDDI EISA and PCI cards.
  5085.  
  5086.   Kernel Compile Options:
  5087.  
  5088.  
  5089.                Network device support  --->
  5090.                    [*] FDDI driver support
  5091.                    [*] Digital DEFEA and DEFPA adapter support
  5092.  
  5093.  
  5094.  
  5095.  
  5096.  
  5097.  
  5098.   When you have your kernel built to support the FDDI driver and
  5099.   installed, configuration of the FDDI interface is almost identical to
  5100.   that of an ethernet interface. You just specify the appropriate FDDI
  5101.   interface name in the ifconfig and route commands.
  5102.  
  5103.   8.7.  Frame Relay
  5104.  
  5105.   The Frame Relay device names are `dlci00', `dlci01' etc for the DLCI
  5106.   encapsulation devices and `sdla0', `sdla1' etc for the FRAD(s).
  5107.  
  5108.   Frame Relay is a new networking technology that is designed to suit
  5109.   data communications traffic that is of a `bursty' or intermittent
  5110.   nature. You connect to a Frame Relay network using a Frame Relay
  5111.   Access Device (FRAD).  The Linux Frame Relay supports IP over Frame
  5112.   Relay as described in RFC-1490.
  5113.  
  5114.   Kernel Compile Options:
  5115.  
  5116.  
  5117.                Network device support  --->
  5118.                    <*> Frame relay DLCI support (EXPERIMENTAL)
  5119.                    (24)   Max open DLCI
  5120.                    (8)   Max DLCI per device
  5121.                    <*>   SDLA (Sangoma S502/S508) support
  5122.  
  5123.  
  5124.  
  5125.  
  5126.  
  5127.   Mike McLagan, mike.mclagan@linux.org, developed the Frame Relay
  5128.   support and configuration tools.
  5129.  
  5130.   Currently the only FRAD supported are the Sangoma Technologies
  5131.   <http://www.sangoma.com/> S502A, S502E and S508.
  5132.  
  5133.   To configure the FRAD and DLCI devices after you have rebuilt your
  5134.   kernel you will need the Frame Relay configuration tools. These are
  5135.   available from ftp.invlogic.com
  5136.   <ftp://ftp.invlogic.com/pub/linux/fr/frad-0.15.tgz>.  Compiling and
  5137.   installing the tools is straightforward, but the lack of a top level
  5138.   Makefile makes it a fairly manual process:
  5139.  
  5140.  
  5141.  
  5142.  
  5143.  
  5144.  
  5145.  
  5146.  
  5147.  
  5148.  
  5149.           user% tar xvfz .../frad-0.15.tgz
  5150.           user% cd frad-0.15
  5151.           user% for i in common dlci frad; make -C $i clean; make -C $i; done
  5152.           root# mkdir /etc/frad
  5153.           root# install -m 644 -o root -g root bin/*.sfm /etc/frad
  5154.           root# install -m 700 -o root -g root frad/fradcfg /sbin
  5155.           rppt# install -m 700 -o root -g root dlci/dlcicfg /sbin
  5156.  
  5157.  
  5158.  
  5159.  
  5160.  
  5161.  
  5162.   Note that the previous commands use sh syntax, if you use a csh
  5163.   flavour instead (like tcsh), the for loop will look different.
  5164.  
  5165.   After installing the tools you need to create an /etc/frad/router.conf
  5166.   file. You can use this template, which is a modified version of one of
  5167.   the example files:
  5168.  
  5169.  
  5170.  
  5171.  
  5172.  
  5173.  
  5174.  
  5175.  
  5176.  
  5177.  
  5178.  
  5179.  
  5180.  
  5181.  
  5182.  
  5183.  
  5184.  
  5185.  
  5186.  
  5187.  
  5188.  
  5189.  
  5190.  
  5191.  
  5192.  
  5193.  
  5194.  
  5195.  
  5196.  
  5197.  
  5198.  
  5199.  
  5200.  
  5201.  
  5202.  
  5203.  
  5204.  
  5205.  
  5206.  
  5207.  
  5208.  
  5209.  
  5210.  
  5211.  
  5212.  
  5213.  
  5214.  
  5215.   # /etc/frad/router.conf
  5216.   # This is a template configuration for frame relay.
  5217.   # All tags are included. The default values are based on the code
  5218.   # supplied with the DOS drivers for the Sangoma S502A card.
  5219.   #
  5220.   # A '#' anywhere in a line constitutes a comment
  5221.   # Blanks are ignored (you can indent with tabs too)
  5222.   # Unknown [] entries and unknown keys are ignored
  5223.   #
  5224.  
  5225.   [Devices]
  5226.   Count=1                 # number of devices to configure
  5227.   Dev_1=sdla0             # the name of a device
  5228.   #Dev_2=sdla1            # the name of a device
  5229.  
  5230.   # Specified here, these are applied to all devices and can be overridden for
  5231.   # each individual board.
  5232.   #
  5233.   Access=CPE
  5234.   Clock=Internal
  5235.   KBaud=64
  5236.   Flags=TX
  5237.   #
  5238.   # MTU=1500              # Maximum transmit IFrame length, default is 4096
  5239.   # T391=10               # T391 value    5 - 30, default is 10
  5240.   # T392=15               # T392 value    5 - 30, default is 15
  5241.   # N391=6                # N391 value    1 - 255, default is 6
  5242.   # N392=3                # N392 value    1 - 10, default is 3
  5243.   # N393=4                # N393 value    1 - 10, default is 4
  5244.  
  5245.   # Specified here, these set the defaults for all boards
  5246.   # CIRfwd=16             # CIR forward   1 - 64
  5247.   # Bc_fwd=16             # Bc forward    1 - 512
  5248.   # Be_fwd=0              # Be forward    0 - 511
  5249.   # CIRbak=16             # CIR backward  1 - 64
  5250.   # Bc_bak=16             # Bc backward   1 - 512
  5251.   # Be_bak=0              # Be backward   0 - 511
  5252.  
  5253.  
  5254.   #
  5255.   #
  5256.   # Device specific configuration
  5257.   #
  5258.   #
  5259.  
  5260.   #
  5261.   # The first device is a Sangoma S502E
  5262.   #
  5263.   [sdla0]
  5264.   Type=Sangoma            # Type of the device to configure, currently only
  5265.                           # SANGOMA is recognized
  5266.   #
  5267.   # These keys are specific to the 'Sangoma' type
  5268.   #
  5269.   # The type of Sangoma board - S502A, S502E, S508
  5270.   Board=S502E
  5271.   #
  5272.   # The name of the test firmware for the Sangoma board
  5273.   # Testware=/usr/src/frad-0.10/bin/sdla_tst.502
  5274.   #
  5275.   # The name of the FR firmware
  5276.   # Firmware=/usr/src/frad-0.10/bin/frm_rel.502
  5277.   #
  5278.   Port=360                # Port for this particular card
  5279.   Mem=C8                  # Address of memory window, A0-EE, depending on card
  5280.   IRQ=5                   # IRQ number, do not supply for S502A
  5281.   DLCIs=1                 # Number of DLCI's attached to this device
  5282.   DLCI_1=16               # DLCI #1's number, 16 - 991
  5283.   # DLCI_2=17
  5284.   # DLCI_3=18
  5285.   # DLCI_4=19
  5286.   # DLCI_5=20
  5287.   #
  5288.   # Specified here, these apply to this device only,
  5289.   # and override defaults from above
  5290.   #
  5291.   # Access=CPE            # CPE or NODE, default is CPE
  5292.   # Flags=TXIgnore,RXIgnore,BufferFrames,DropAborted,Stats,MCI,AutoDLCI
  5293.   # Clock=Internal        # External or Internal, default is Internal
  5294.   # Baud=128              # Specified baud rate of attached CSU/DSU
  5295.   # MTU=2048              # Maximum transmit IFrame length, default is 4096
  5296.   # T391=10               # T391 value    5 - 30, default is 10
  5297.   # T392=15               # T392 value    5 - 30, default is 15
  5298.   # N391=6                # N391 value    1 - 255, default is 6
  5299.   # N392=3                # N392 value    1 - 10, default is 3
  5300.   # N393=4                # N393 value    1 - 10, default is 4
  5301.  
  5302.   #
  5303.   # The second device is some other card
  5304.   #
  5305.   # [sdla1]
  5306.   # Type=FancyCard        # Type of the device to configure.
  5307.   # Board=                # Type of Sangoma board
  5308.   # Key=Value             # values specific to this type of device
  5309.  
  5310.  
  5311.   #
  5312.   # DLCI Default configuration parameters
  5313.   # These may be overridden in the DLCI specific configurations
  5314.   #
  5315.   CIRfwd=64               # CIR forward   1 - 64
  5316.   # Bc_fwd=16             # Bc forward    1 - 512
  5317.   # Be_fwd=0              # Be forward    0 - 511
  5318.   # CIRbak=16             # CIR backward  1 - 64
  5319.   # Bc_bak=16             # Bc backward   1 - 512
  5320.   # Be_bak=0              # Be backward   0 - 511
  5321.  
  5322.   #
  5323.   # DLCI Configuration
  5324.   # These are all optional. The naming convention is
  5325.   # [DLCI_D<devicenum>_<DLCI_Num>]
  5326.   #
  5327.  
  5328.   [DLCI_D1_16]
  5329.   # IP=
  5330.   # Net=
  5331.   # Mask=
  5332.   # Flags defined by Sangoma: TXIgnore,RXIgnore,BufferFrames
  5333.   # DLCIFlags=TXIgnore,RXIgnore,BufferFrames
  5334.   # CIRfwd=64
  5335.   # Bc_fwd=512
  5336.   # Be_fwd=0
  5337.   # CIRbak=64
  5338.   # Bc_bak=512
  5339.   # Be_bak=0
  5340.  
  5341.   [DLCI_D2_16]
  5342.   # IP=
  5343.   # Net=
  5344.   # Mask=
  5345.   # Flags defined by Sangoma: TXIgnore,RXIgnore,BufferFrames
  5346.   # DLCIFlags=TXIgnore,RXIgnore,BufferFrames
  5347.   # CIRfwd=16
  5348.   # Bc_fwd=16
  5349.   # Be_fwd=0
  5350.   # CIRbak=16
  5351.   # Bc_bak=16
  5352.   # Be_bak=0
  5353.  
  5354.  
  5355.  
  5356.  
  5357.  
  5358.   When you've built your /etc/frad/router.conf file the only step
  5359.   remaining is to configure the actual devices themselves. This is only
  5360.   a little trickier than a normal network device configuration, you need
  5361.   to remember to bring up the FRAD device before the DLCI encapsulation
  5362.   devices. These commands are best hosted in a shell script, due to
  5363.   their number:
  5364.  
  5365.  
  5366.  
  5367.                #!/bin/sh
  5368.                # Configure the frad hardware and the DLCI parameters
  5369.                /sbin/fradcfg /etc/frad/router.conf || exit 1
  5370.                /sbin/dlcicfg file /etc/frad/router.conf
  5371.                #
  5372.                # Bring up the FRAD device
  5373.                ifconfig sdla0 up
  5374.                #
  5375.                # Configure the DLCI encapsulation interfaces and routing
  5376.                ifconfig dlci00 192.168.10.1 pointopoint 192.168.10.2 up
  5377.                route add -net 192.168.10.0 netmask 255.255.255.0 dlci00
  5378.                #
  5379.                ifconfig dlci01 192.168.11.1 pointopoint 192.168.11.2 up
  5380.                route add -net 192.168.11.0 netmask 255.255.255.0 dlci00
  5381.                #
  5382.                route add default dev dlci00
  5383.                #
  5384.  
  5385.  
  5386.  
  5387.  
  5388.  
  5389.  
  5390.   8.8.  IPX ( AF_IPX )
  5391.  
  5392.   The IPX protocol is most commonly utilized in Novell NetWare(tm) local
  5393.   area network environments. Linux includes support for this protocol
  5394.   and may be configured to act as a network endpoint, or as a router for
  5395.   IPX.
  5396.  
  5397.   Kernel Compile Options:
  5398.  
  5399.  
  5400.                Networking options  --->
  5401.                    [*] The IPX protocol
  5402.                    [ ] Full internal IPX network
  5403.  
  5404.  
  5405.  
  5406.  
  5407.  
  5408.  
  5409.   The IPX protocol and the NCPFS are covered in greater depth in the
  5410.   IPX-HOWTO <IPX-HOWTO.html>.
  5411.  
  5412.  
  5413.   8.9.  NetRom ( AF_NETROM )
  5414.  
  5415.   NetRom device names are `nr0', `nr1', etc.
  5416.  
  5417.   Kernel Compile Options:
  5418.  
  5419.  
  5420.                Networking options  --->
  5421.                    [*] Amateur Radio AX.25 Level 2
  5422.                    [*] Amateur Radio NET/ROM
  5423.  
  5424.  
  5425.  
  5426.  
  5427.  
  5428.  
  5429.   The AX25, Netrom and Rose protocols are covered by the AX25-HOWTO
  5430.   <AX25-HOWTO.html>.  These protocols are used by Amateur Radio
  5431.   Operators world wide in packet radio experimentation.
  5432.  
  5433.   Most of the work for implementation of these protocols has been done
  5434.   by Jonathon Naylor, jsn@cs.nott.ac.uk.
  5435.  
  5436.   8.10.  Rose protocol ( AF_ROSE )
  5437.  
  5438.   Rose device names are `rs0', `rs1', etc. in 2.1.* kernels.  Rose is
  5439.   available in the 2.1.* kernels.
  5440.  
  5441.   Kernel Compile Options:
  5442.  
  5443.  
  5444.                Networking options  --->
  5445.                    [*] Amateur Radio AX.25 Level 2
  5446.                    <*> Amateur Radio X.25 PLP (Rose)
  5447.  
  5448.  
  5449.  
  5450.  
  5451.  
  5452.  
  5453.   The AX25, Netrom and Rose protocols are covered by the AX25-HOWTO
  5454.   <AX25-HOWTO.html>.  These protocols are used by Amateur Radio
  5455.   Operators world wide in packet radio experimentation.
  5456.  
  5457.   Most of the work for implementation of these protocols has been done
  5458.   by Jonathon Naylor, jsn@cs.nott.ac.uk.
  5459.  
  5460.   8.11.  SAMBA - `NetBEUI', `NetBios' support.
  5461.  
  5462.   SAMBA is an implementation of the Session Management Block protocol.
  5463.   Samba allows Microsoft and other systems to mount and use your disks
  5464.   and printers.
  5465.  
  5466.   SAMBA and its configuration are covered in detail in the SMB-HOWTO
  5467.   <SMB-HOWTO.html>.
  5468.  
  5469.   8.12.  STRIP support (Starmode Radio IP)
  5470.  
  5471.   STRIP device names are `st0', `st1', etc.
  5472.  
  5473.   Kernel Compile Options:
  5474.  
  5475.  
  5476.  
  5477.  
  5478.  
  5479.           Network device support  --->
  5480.                   [*] Network device support
  5481.                   ....
  5482.                   [*] Radio network interfaces
  5483.                   < > STRIP (Metricom starmode radio IP)
  5484.  
  5485.  
  5486.  
  5487.  
  5488.  
  5489.  
  5490.   STRIP is a protocol designed specifically for a range of Metricom
  5491.   radio modems for a research project being conducted by Stanford
  5492.   University called the MosquitoNet Project
  5493.   <http://mosquitonet.Stanford.EDU/mosquitonet.html>.  There is a lot of
  5494.   interesting reading here, even if you aren't directly interested in
  5495.   the project.
  5496.  
  5497.   The Metricom radios connect to a serial port, employ spread spectrum
  5498.   technology and are typically capable of about 100kbps.  Information on
  5499.   the Metricom radios is available from the: Metricom Web Server
  5500.   <http://www.metricom.com/>.
  5501.  
  5502.   At present the standard network tools and utilities do not support the
  5503.   STRIP driver, so you will have to download some customized tools from
  5504.   the MosquitoNet web server. Details on what software you need is
  5505.   available at the: MosquitoNet STRIP Page
  5506.   <http://mosquitonet.Stanford.EDU/strip.html>.
  5507.  
  5508.   A summary of configuration is that you use a modified slattach program
  5509.   to set the line discipline of a serial tty device to STRIP and then
  5510.   configure the resulting `st[0-9]' device as you would for ethernet
  5511.   with one important exception, for technical reasons STRIP does not
  5512.   support the ARP protocol, so you must manually configure the ARP
  5513.   entries for each of the hosts on your subnet. This shouldn't prove too
  5514.   onerous.
  5515.  
  5516.   8.13.  Token Ring
  5517.  
  5518.   Token ring device names are `tr0', `tr1' etc. Token Ring is an IBM
  5519.   standard LAN protocol that avoids collisions by providing a mechanism
  5520.   that allows only one station on the LAN the right to transmit at a
  5521.   time.  A `token' is held by one station at a time and the station
  5522.   holding the token is the only station allowed to transmit. When it has
  5523.   transmitted its data it passes the token onto the next station. The
  5524.   token loops amongst all active stations, hence the name `Token Ring'.
  5525.  
  5526.   Kernel Compile Options:
  5527.  
  5528.  
  5529.                Network device support  --->
  5530.                        [*] Network device support
  5531.                        ....
  5532.                        [*] Token Ring driver support
  5533.                        < > IBM Tropic chipset based adaptor support
  5534.  
  5535.  
  5536.  
  5537.  
  5538.  
  5539.  
  5540.   Configuration of token ring is identical to that of ethernet with the
  5541.   exception of the network device name to configure.
  5542.  
  5543.  
  5544.  
  5545.   8.14.  X.25
  5546.  
  5547.   X.25 is a circuit based packet switching protocol defined by the
  5548.   C.C.I.T.T. (a standards body recognized by Telecommunications
  5549.   companies in most parts of the world). An implementation of X.25 and
  5550.   LAPB are being worked on and recent 2.1.* kernels include the work in
  5551.   progress.
  5552.  
  5553.   Jonathon Naylor jsn@cs.nott.ac.uk is leading the development and a
  5554.   mailing list has been established to discuss Linux X.25 related
  5555.   matters.  To subscribe send a message to: majordomo@vger.rutgers.edu
  5556.   with the text "subscribe linux-x25" in the body of the message.
  5557.  
  5558.   Early versions of the configuration tools may be obtained from
  5559.   Jonathon's ftp site at ftp.cs.nott.ac.uk
  5560.   <ftp://ftp.cs.nott.ac.uk/jsn/>.
  5561.  
  5562.   8.15.  WaveLan Card
  5563.  
  5564.   Wavelan device names are `eth0', `eth1', etc.
  5565.  
  5566.   Kernel Compile Options:
  5567.  
  5568.  
  5569.        Network device support  --->
  5570.                [*] Network device support
  5571.                ....
  5572.                [*] Radio network interfaces
  5573.                ....
  5574.                <*> WaveLAN support
  5575.  
  5576.  
  5577.  
  5578.  
  5579.  
  5580.   The WaveLAN card is a spread spectrum wireless lan card. The card
  5581.   looks very like an ethernet card in practice and is configured in much
  5582.   the same way.
  5583.  
  5584.   You can get information on the Wavelan card from Wavelan.com
  5585.   <http://www.wavelan.com/>.
  5586.  
  5587.   9.  Cables and Cabling
  5588.  
  5589.   Those of you handy with a soldering iron may want to build your own
  5590.   cables to interconnect two linux machines. The following cabling
  5591.   diagrams should assist you in this.
  5592.  
  5593.   9.1.  Serial NULL Modem cable
  5594.  
  5595.   Not all NULL modem cables are alike. Many null modem cables do little
  5596.   more than trick your computer into thinking all the appropriate
  5597.   signals are present and swap transmit and receive data. This is ok but
  5598.   means that you must use software flow control (XON/XOFF) which is less
  5599.   efficient than hardware flow control. The following cable provides the
  5600.   best possible signalling between machines and allows you to use
  5601.   hardware (RTS/CTS) flow control.
  5602.  
  5603.  
  5604.  
  5605.  
  5606.  
  5607.  
  5608.  
  5609.  
  5610.  
  5611.   Pin Name  Pin                               Pin
  5612.   Tx Data    2  -----------------------------  3
  5613.   Rx Data    3  -----------------------------  2
  5614.   RTS        4  -----------------------------  5
  5615.   CTS        5  -----------------------------  4
  5616.   Ground     7  -----------------------------  7
  5617.   DTR        20 -\---------------------------  8
  5618.   DSR        6  -/
  5619.   RLSD/DCD   8  ---------------------------/-  20
  5620.                                            \-  6
  5621.  
  5622.  
  5623.  
  5624.  
  5625.  
  5626.   9.2.  Parallel port cable (PLIP cable)
  5627.  
  5628.   If you intend to use the PLIP protocol between two machines then this
  5629.   cable will work for you irrespective of what sort of parallel ports
  5630.   you have installed.
  5631.  
  5632.  
  5633.        Pin Name    pin            pin
  5634.        STROBE      1*
  5635.        D0->ERROR   2  ----------- 15
  5636.        D1->SLCT    3  ----------- 13
  5637.        D2->PAPOUT  4  ----------- 12
  5638.        D3->ACK     5  ----------- 10
  5639.        D4->BUSY    6  ----------- 11
  5640.        D5          7*
  5641.        D6          8*
  5642.        D7          9*
  5643.        ACK->D3     10 ----------- 5
  5644.        BUSY->D4    11 ----------- 6
  5645.        PAPOUT->D2  12 ----------- 4
  5646.        SLCT->D1    13 ----------- 3
  5647.        FEED        14*
  5648.        ERROR->D0   15 ----------- 2
  5649.        INIT        16*
  5650.        SLCTIN      17*
  5651.        GROUND      25 ----------- 25
  5652.  
  5653.  
  5654.  
  5655.  
  5656.  
  5657.   Notes:
  5658.  
  5659.   ╖  Do not connect the pins marked with an asterisk `*'.
  5660.  
  5661.   ╖  Extra grounds are 18,19,20,21,22,23 and 24.
  5662.  
  5663.   ╖  If the cable you are using has a metallic shield, it should be
  5664.      connected to the metallic DB-25 shell at one end only.
  5665.  
  5666.      Warning: A miswired PLIP cable can destroy your controller card. Be
  5667.      very careful and double check every connection to ensure you don't
  5668.      cause yourself any unnecessary work or heartache.
  5669.  
  5670.   While you may be able to run PLIP cables for long distances, you
  5671.   should avoid it if you can. The specifications for the cable allow for
  5672.   a cable length of about 1 metre or so. Please be very careful when
  5673.   running long plip cables as sources of strong electromagnetic fields
  5674.   such as lightning, power lines and radio transmitters can interfere
  5675.   with and sometimes even damage your controller. If you really want to
  5676.   connect two of your computers over a large distance you really should
  5677.   be looking at obtaining a pair of thin-net ethernet cards and running
  5678.   some coaxial cable.
  5679.  
  5680.   9.3.  10base2 (thin coax) Ethernet Cabling
  5681.  
  5682.   10base2 is an ethernet cabling standard that specifies the use of 52
  5683.   ohm coaxial cable with a diameter of about 5 millimeters. There are a
  5684.   couple of important rules to remember when interconnecting machines
  5685.   with 10base2 cabling.  The first is that you must use terminators at
  5686.   both ends of the cabling.  A terminator is a 52 ohm resistor that
  5687.   helps to ensure that the signal is absorbed and not reflected when it
  5688.   reaches the end of the cable. Without a terminator at each end of the
  5689.   cabling you may find that the ethernet is unreliable or doesn't work
  5690.   at all. Normally you'd use `T pieces' to interconnect the machines, so
  5691.   that you end up with something that looks like:
  5692.  
  5693.  
  5694.         |==========T=============T=============T==========T==========|
  5695.                    |             |             |          |
  5696.                    |             |             |          |
  5697.                  -----         -----         -----      -----
  5698.                  |   |         |   |         |   |      |   |
  5699.                  -----         -----         -----      -----
  5700.  
  5701.  
  5702.  
  5703.  
  5704.   where the `|' at either end represents a terminator, the `======' rep¡
  5705.   resents a length of coaxial cable with BNC plugs at either end and the
  5706.   `T' represents a `T piece' connector. You should keep the length of
  5707.   cable between the `T piece' and the actual ethernet card in the PC as
  5708.   short as possible, ideally the `T piece' will be plugged directly into
  5709.   the ethernet card.
  5710.  
  5711.   9.4.  Twisted Pair Ethernet Cable
  5712.  
  5713.   If you have only two twisted pair ethernet cards and you wish to
  5714.   connect them you do not require a hub. You can cable the two cards
  5715.   directly together.  A diagram showing how to do this is included in
  5716.   the Ethernet-HOWTO <Ethernet-HOWTO.html>
  5717.  
  5718.   10.  Glossary of Terms used in this document.
  5719.  
  5720.   The following is a list of some of the most important terms used in
  5721.   this document.
  5722.  
  5723.  
  5724.  
  5725.      ARP
  5726.         This is an acronym for the Address Resolution Protocol and this
  5727.         is how a network machine associates an IP Address with a
  5728.         hardware address.
  5729.  
  5730.  
  5731.      ATM
  5732.         This is an acronym for Asynchronous Transfer Mode.  An ATM
  5733.         network packages data into standard size blocks which it can
  5734.         convey efficiently from point to point. ATM is a circuit
  5735.         switched packet network technology.
  5736.  
  5737.  
  5738.      client
  5739.         This is usually the piece of software at the end of a system
  5740.         where the user is. There are exceptions to this, for example, in
  5741.         the X11 window system it is actually the server with the user
  5742.         and the client runs on the remote machine. The client is the
  5743.         program or end of a system that is receiving the service
  5744.         provided by the server. In the case of peer to peer systems such
  5745.         as slip or ppp the client is taken to be the end that initiates
  5746.         the connection and the remote end, being called, is taken to be
  5747.         the server.
  5748.  
  5749.  
  5750.      datagram
  5751.         A datagram is a discrete package of data and headers which
  5752.         contain addresses, which is the basic unit of transmission
  5753.         across an IP network. You might also hear this called a
  5754.         `packet'.
  5755.  
  5756.  
  5757.      DLCI
  5758.         The DLCI is the Data Link Connection Identifier and is used to
  5759.         identify a unique virtual point to point connection via a Frame
  5760.         Relay network. The DLCI's are normally assigned by the Frame
  5761.         Relay network provider.
  5762.  
  5763.  
  5764.      Frame Relay
  5765.         Frame Relay is a network technology ideally suited to carrying
  5766.         traffic that is of bursty or sporadic nature. Network costs are
  5767.         reduced by having many Frame Relay customer sharing the same
  5768.         network capacity and relying on them wanting to make use of the
  5769.         network at slightly different times.
  5770.  
  5771.  
  5772.      Hardware address
  5773.         This is a number that uniquely identifies a host in a physical
  5774.         network at the media access layer. Examples of this are Ethernet
  5775.         Addresses and AX.25 Addresses.
  5776.  
  5777.  
  5778.      ISDN
  5779.         This is an acronym for Integrated Services Digital Network. ISDN
  5780.         provides a standardized means by which Telecommunications
  5781.         companies may deliver either voice or data information to a
  5782.         customers premises.  Technically ISDN is a circuit switched data
  5783.         network.
  5784.  
  5785.  
  5786.      ISP
  5787.         This is an acronym of Internet Service Provider. These are
  5788.         organizations or companies that provide people with network
  5789.         connectivity to the Internet.
  5790.  
  5791.  
  5792.      IP address
  5793.         This is a number that uniquely identifies a TCP/IP host on the
  5794.         network. The address is 4 bytes long and is usually represented
  5795.         in what is called the "dotted decimal notation", where each byte
  5796.         is represented in decimal from with dots `.' between them.
  5797.  
  5798.  
  5799.      MSS
  5800.         The Maximum Segment Size (MSS) is the largest quantity of data
  5801.         that can be transmitted at one time. If you want to prevent
  5802.         local fragmentation MSS would equal MTU-IP header.
  5803.  
  5804.  
  5805.      MTU
  5806.         The Maximum Transmission Unit (MTU) is a parameter that
  5807.         determines the largest datagram than can be transmitted by an IP
  5808.         interface without it needing to be broken down into smaller
  5809.         units. The MTU should be larger than the largest datagram you
  5810.         wish to transmit unfragmented. Note, this only prevents
  5811.         fragmentation locally, some other link in the path may have a
  5812.         smaller MTU and the datagram will be fragmented there. Typical
  5813.         values are 1500 bytes for an ethernet interface, or 576 bytes
  5814.         for a SLIP interface.
  5815.  
  5816.  
  5817.      route
  5818.         The route is the path that your datagrams take through the
  5819.         network to reach their destination.
  5820.  
  5821.  
  5822.      server
  5823.         This is usually the piece of software or end of a system remote
  5824.         from the user. The server provides some service to one or many
  5825.         clients.  Examples of servers include ftp, Networked File
  5826.         System, or Domain Name Server. In the case of peer to peer
  5827.         systems such as slip or ppp the server is taken to be the end of
  5828.         the link that is called and the end calling is taken to be the
  5829.         client.
  5830.  
  5831.  
  5832.      window
  5833.         The window is the largest amount of data that the receiving end
  5834.         can accept at a given point in time.
  5835.  
  5836.  
  5837.   11.  Linux for an ISP ?
  5838.  
  5839.   If you are interested in using Linux for ISP purposes the I recommend
  5840.   you take a look at the Linux ISP homepage
  5841.   <http://www.anime.net/linuxisp/> for a good list of pointers to
  5842.   information you might need and use.
  5843.  
  5844.   12.  Acknowledgements
  5845.  
  5846.   I'd like to thank the following people for their contributions to this
  5847.   document (in no particular order): Terry Dawson, Axel Boldt, Arnt
  5848.   Gulbrandsen, Gary Allpike, Cees de Groot, Alan Cox, Jonathon Naylor,
  5849.   Claes Ensson, Ron Nessim, John Minack, Jean-Pierre Cocatrix, Erez
  5850.   Strauss.
  5851.  
  5852.   13.  Copyright.
  5853.  
  5854.   The NET-3-HOWTO, information on how to install and configure
  5855.   networking support for Linux. Copyright (c) 1997 Terry Dawson, 1998
  5856.   Alessandro Rubini
  5857.  
  5858.   This program is free software; you can redistribute it and/or modify
  5859.   it under the terms of the GNU General Public License as published by
  5860.   the Free Software Foundation; either version 2 of the License, or (at
  5861.   your option) any later version.
  5862.  
  5863.   This program is distributed in the hope that it will be useful, but
  5864.   WITHOUT ANY WARRANTY; without even the implied warranty of
  5865.   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  5866.   General Public License for more details.
  5867.  
  5868.   You should have received a copy of the GNU General Public License
  5869.   along with this program; if not, write to the:
  5870.  
  5871.   Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
  5872.   USA.
  5873.  
  5874.  
  5875.