home *** CD-ROM | disk | FTP | other *** search
/ Freelog Special Edition 1: Linux / CD1.iso / doc / HOWTO / mini / Diskless < prev    next >
Text File  |  1998-10-14  |  15KB  |  529 lines

  1.   Diskless Linux Mini Howto
  2.   by Robert Nemkin buci@math.klte.hu
  3.   v0.0.3, 12 September 1996
  4.  
  5.   This document describes how to set up a diskless Linux box and copy¡
  6.   righted by Robert Nemkin. Copyright policy is GPL.  I whish to thank
  7.   to Bela Kis <bkis@cartan.math.klte.hu> for translating this document
  8.   to English.
  9.   ______________________________________________________________________
  10.  
  11.   Table of Contents
  12.  
  13.  
  14.   1. Changes
  15.  
  16.   2. How to set up a diskless Linux box
  17.  
  18.   3. Related documents
  19.  
  20.   4. Hardware
  21.  
  22.   5. Fundamental ideas
  23.  
  24.      5.1 Setting up the PC
  25.      5.2 Setting up a bootpd on the server
  26.      5.3 Configure the bootpd on the server.
  27.      5.4 Understanding tftp
  28.      5.5 Setting up a minimal Linux configuration on the remote server.
  29.      5.6 Configuring the tftp server
  30.      5.7 Final work
  31.  
  32.   6. Memory and diskspace requirements; speed
  33.  
  34.   7. Possible errors
  35.  
  36.   8. Errors and possible further expansions of this document
  37.  
  38.  
  39.  
  40.   ______________________________________________________________________
  41.  
  42.   1.  Changes
  43.  
  44.  
  45.   ╖  v0.0.3 12 Sep 1996: Some minor error fixes
  46.  
  47.  
  48.   2.  How to set up a diskless Linux box
  49.  
  50.   This document is about setting up a diskless Linux box. Sometimes it
  51.   might be necessary to run Linux on PC's which have neither hard disks
  52.   nor floppy drives. If a network, another Unix system with bootp, tftp,
  53.   an NFS server, and an eprom burner is available then it is possible to
  54.   set up and operate Linux without hard/floppy disks.
  55.  
  56.  
  57.   3.  Related documents
  58.  
  59.  
  60.   ╖  NFS-root Mini Howto
  61.  
  62.   ╖  Linux NET-2/3-HOWTO by Terry Dawson, 94004531@postoffice.csu.edu.au
  63.  
  64.   ╖  /usr/src/linux/README about configuring and compiling new kernels
  65.  
  66.  
  67.   4.  Hardware
  68.  
  69.   Whatever is described here was checked on the following configuration
  70.  
  71.   ╖  Sun-OS 4.1.3 as boot server
  72.  
  73.   ╖  Slackware 2.3 + Linux 1.2.8 + wd 8013 ethercard.
  74.  
  75.   ╖  Working Ethernet lan
  76.  
  77.  
  78.   5.  Fundamental ideas
  79.  
  80.   The fundamental idea is as follows: the PC will get its IP address
  81.   from the boot server via the bootp protocol, using 0.0.0.0 as the
  82.   initial IP address and its kernel via the tftp protocol.  (-- Booting
  83.   across segments (via router) not a simple question, so either put both
  84.   the server and the diskless boxes on the same lan segment or configure
  85.   an UDP helper address in your router to the address of the server.
  86.   Refer to your router product manual for further info.--)
  87.  
  88.   For this follow the steps below.
  89.  
  90.  
  91.   5.1.  Setting up the PC
  92.  
  93.   Get the nfsboot package (the package is available from your favourite
  94.   linux mirror site in the /pub/Linux/system/Linux-boot directory). It
  95.   contains a booteprom image for the wd8013 card which can be directly
  96.   burned in.
  97.  
  98.   There are alternative ways to prepare the PC:
  99.  
  100.   ╖  if your machine is not quite diskless, then you may use the little
  101.      DOS program, or
  102.  
  103.   ╖  the binary floppy image contained in the same package.  If you
  104.      choose the latter option you must write the image onto a floppy by
  105.      the dd command.
  106.  
  107.   These images contain a bootp and tftp client.  You need to prepare a
  108.   linux kernel too, which contains the nfs-root option.
  109.  
  110.   ╖  If you are using the latest stable kernel, linux-1.2.13, then you
  111.      need to patch the kernel with the patchfile included in the nfsboot
  112.      package  (-- Refer to patch(1)--)
  113.  
  114.   ╖  If you try to use the latest, but unstable kernel from the
  115.      linux-1.3.x series, then you have to configure in the nfs-root
  116.      option.
  117.  
  118.      You may or may not configure block device (floppy or hard disk)
  119.      support, but you must configure tcp/ip support, wd ethernet card
  120.      support, nfs filesystem support. Then recompile the kernel as
  121.      usual.
  122.  
  123.  
  124.  
  125.   5.2.  Setting up a bootpd on the server
  126.  
  127.   It can be found in package bootpd-2.4.tar.gz (which can be found on
  128.   your favourite linux mirror site in the
  129.   /pub/Linux/system/Network/boot.net directory). Get the package,
  130.   compile and install it. If your other Unix box happens to be a
  131.   Slackware Linux then you may skip this step for the standard
  132.   distributions contain a bootpd. The daemon can be run either directly
  133.   by issuing command
  134.  
  135.  
  136.        ______________________________________________________________________
  137.                bootpd -s
  138.        ______________________________________________________________________
  139.  
  140.  
  141.  
  142.  
  143.   or by using inetd. In this case you need to edit:
  144.  
  145.   ╖  /etc/inetd.conf to remove the hashmark from the start of these
  146.      lines:
  147.  
  148.  
  149.  
  150.        ______________________________________________________________________
  151.        # tftp   dgram   udp     wait    root    /usr/sbin/in.tftpd     tftpd /export
  152.        # bootps dgram   udp     wait    root    /usr/sbin/in.bootpd    bootpd
  153.        ______________________________________________________________________
  154.  
  155.  
  156.  
  157.  
  158.  
  159.   ╖  insert or uncomment the following two lines in /etc/services:
  160.  
  161.  
  162.  
  163.        ______________________________________________________________________
  164.        bootps          67/tcp          # BOOTP server
  165.        tftp            69/udp          # TFTP server
  166.        ______________________________________________________________________
  167.  
  168.  
  169.  
  170.  
  171.  
  172.   ╖  restart inetd by
  173.  
  174.  
  175.  
  176.        ______________________________________________________________________
  177.                kill -HUP <process id of inetd>.
  178.        ______________________________________________________________________
  179.  
  180.  
  181.  
  182.  
  183.  
  184.   5.3.  Configure the bootpd on the server.
  185.  
  186.   First of all, bootpd have a config file called bootptab which usually
  187.   resides in /etc. You must modify it by inserting the IP addresses of
  188.   your gateway, dns server, and the ethernet address(es) of your
  189.   diskless machine(s).  An example /etc/bootptab:
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.   ______________________________________________________________________
  200.  
  201.   global.prof:\
  202.           :sm=255.255.255.0:\
  203.           :ds=192.168.1.5:\
  204.           :gw=192.168.1.19:\
  205.           :ht=ethernet:\
  206.           :bf=linux:
  207.   machine1:hd=/export/root/machine1:tc=global.prof:ha=0000c0863d7a:ip=192.168.1.140:
  208.   machine2:hd=/export/root/machine2:tc=global.prof:ha=0800110244e1:ip=192.168.1.141:
  209.   machine3:hd=/export/root/machine3:tc=global.prof:ha=0800110244de:ip=192.168.1.142:
  210.   ______________________________________________________________________
  211.  
  212.  
  213.  
  214.  
  215.   global.prof is a general template for host entries, where
  216.  
  217.   ╖  sm field contains the subnet mask
  218.  
  219.   ╖  ds field contains the address of the Domain Name Server
  220.  
  221.   ╖  gw field contains the default gateway address
  222.  
  223.   ╖  ht field contains the lan media hardware type
  224.  
  225.   ╖  bf field contains the name of the boot file
  226.  
  227.   After this, every machine must have a line:
  228.  
  229.   ╖  the first field contains the host name,
  230.  
  231.   ╖  hd field contains the directory of the bootfile,
  232.  
  233.   ╖  the global template can be included with the tc field,
  234.  
  235.   ╖  ha field contains the hardvare address of the ethernet card,
  236.  
  237.   ╖  ip field contains the assigned ip address.
  238.  
  239.  
  240.  
  241.   5.4.  Understanding tftp
  242.  
  243.   TFTP (Trivial File Transfer Protocol) is a file transfer protocol,
  244.   such as ftp, but it's much simpler to help coding it in EPROMs. TFTP
  245.   can be used in two ways:
  246.  
  247.   ╖  simple tftp: means that the client can acces to your whole file
  248.      system. It's simpler but it's a big security hole (anyone can get
  249.      your password file via tftp).
  250.  
  251.   ╖  secure tftp: the tftp server uses a chroot.2 system call to change
  252.      it's own root directory. Anything outside the new root directory
  253.      will be completelly inaccessible. Because of the chroot dir becomes
  254.      the new root dir, the hd filed in the bootptab must reflect the new
  255.      situation. For example: when using insecure tftp, the hd field
  256.      contains the full path to the boot directory:
  257.      /export/root/machine1.  When using secure tftp whith /export as
  258.      root dir, then /export becomes / and the hd field must be
  259.      /root/machine1.
  260.  
  261.      Almost every Unix implementation contains tfpt server, probably you
  262.      don't need to install your own one.
  263.  
  264.  
  265.   5.5.  server.  Setting up a minimal Linux configuration on the remote
  266.  
  267.   This may contain packages a, ap, n, and x of the Slackware
  268.   distribution. To install more is OK; however the above packages
  269.   suffice for the purposes of a diskless X terminal. For the
  270.   installation you need a working Linux system. Find some disk space on
  271.   the remote machine and export it read-write. Mount the exported
  272.   directory onto somewhere (e.g. /mnt) on the file system of the Linux
  273.   box. Start Linux setup and change the root option in the setup from /
  274.   to /mnt. Then setup the above packages as usual. If you want to run no
  275.   more than one diskless Linux then no changes are needed. On the other
  276.   hand, if you plan to use more than one diskless machine then the above
  277.   setup will not work because some files and directories must be private
  278.   to the machines. The problem can be bypassed by moving the /usr (it
  279.   contains no private data) and then create a separate subdir for each
  280.   diskless machine. For example, if /export/linux/machine1 were mounted
  281.   to /mnt then the directory structure after the initial setup will look
  282.   like
  283.  
  284.  
  285.        ______________________________________________________________________
  286.        /export/linux/machine1/bin
  287.        /export/linux/machine1/sbin
  288.        /export/linux/machine1/lib
  289.        /export/linux/machine1/etc
  290.        /export/linux/machine1/var
  291.        /export/linux/machine1/usr
  292.        ______________________________________________________________________
  293.  
  294.  
  295.  
  296.  
  297.   After the changes you will have
  298.  
  299.  
  300.        ______________________________________________________________________
  301.        /export/linux/machine1/bin
  302.        /export/linux/machine1/sbin
  303.        /export/linux/machine1/lib
  304.        /export/linux/machine1/etc
  305.        /export/linux/machine1/var
  306.        /export/linux/usr
  307.        ______________________________________________________________________
  308.  
  309.  
  310.  
  311.  
  312.   Now create the subdirectories for the other machines. Assume for now
  313.   that your diskless machines are called machine1, machine2, machine3,
  314.   etc.; then you may use the following bash script to setup the other
  315.   directories
  316.  
  317.  
  318.        ______________________________________________________________________
  319.  
  320.                cd /export/linux
  321.                for x in machine2 machine3 ; do
  322.                        mkdir $x; cd $x
  323.                        (cd ../machine1; tar cf - *) | tar xvf -
  324.                done
  325.        ______________________________________________________________________
  326.  
  327.  
  328.  
  329.  
  330.  
  331.   Then do the following export:
  332.  
  333.   ╖  /export/linux/usr                       readonly for everyone.
  334.  
  335.   ╖  /export/liunx/machine1          only to machine1 with rw,root
  336.      rights.
  337.  
  338.   ╖  /export/liunx/machine2          only to machine2 with rw,root
  339.      rights.
  340.  
  341.   ╖  /export/liunx/machine3          only to machine3 with rw,root
  342.      rights.
  343.  
  344.      as follows (-- the format of this example follows the SunOs 4.1.3
  345.      exports file syntax--) :
  346.  
  347.  
  348.        ______________________________________________________________________
  349.  
  350.        # This file is /etc/export
  351.        # for remote linux X terminals by Buci
  352.        # this line is only once
  353.        /export/root/usr             -access=linuxnet
  354.        # these lines once for every host
  355.        /export/root/machine1       rw=machine1,root=machine1
  356.        /export/root/machine2       rw=machine2,root=machine2
  357.        /export/root/machine3       rw=machine3,root=machine3
  358.        ______________________________________________________________________
  359.  
  360.  
  361.  
  362.  
  363.   Don't forget to run exportfs -a.
  364.  
  365.  
  366.   5.6.  Configuring the tftp server
  367.  
  368.  
  369.   Now it is time to configure the tftp server. If you do not need secure
  370.   tftp then everything is quite simple for your clients can be booted
  371.   from the /export directory.
  372.  
  373.   If a secure tftp is used then you can either make a full /export/linux
  374.   directory structure under /tftpboot (with a single real kernel and
  375.   symbolic links for the other machines), or let the /export directory
  376.   be the boot directory of the secure tftpd. Or, if you have a separate
  377.   tftpboot directory then, similarly, you need only the original
  378.   directory structure with a single kernel and symbolic links for the
  379.   others. You can achieve this setup by typing the following:
  380.  
  381.  
  382.        ______________________________________________________________________
  383.              mkdir -p /tftpboot/export/linux/machine1
  384.              cd /tftpboot/export/linux/machine1
  385.              cp /export/linux/machine1/<name of the kernel> .
  386.        ______________________________________________________________________
  387.  
  388.  
  389.  
  390.  
  391.   Then type the following:
  392.  
  393.  
  394.  
  395.  
  396.  
  397.   ______________________________________________________________________
  398.         mkdir -p /tftpboot/export/linux/machine2
  399.         cd ../machine2
  400.         ln -s ../machine2/<name of the kernel>
  401.   ______________________________________________________________________
  402.  
  403.  
  404.  
  405.  
  406.  
  407.   5.7.  Final work
  408.  
  409.  
  410.   Finally, you must insert
  411.  
  412.  
  413.        ______________________________________________________________________
  414.           /sbin/mount nfs_server:/export/linux/usr /usr
  415.        ______________________________________________________________________
  416.  
  417.  
  418.  
  419.  
  420.   as the first line of
  421.  
  422.  
  423.  
  424.        ______________________________________________________________________
  425.           /export/linux/<machinex>/etc/rc.d/rc.S
  426.        ______________________________________________________________________
  427.  
  428.  
  429.  
  430.  
  431.   where <machinex> stands for machine1, machine2, etc.
  432.  
  433.  
  434.   6.  Memory and diskspace requirements; speed
  435.  
  436.   . I tested this for only Slackware 2.3; for other
  437.   distributions/versions the following numbers may vary.
  438.  
  439.   ╖  Diskspace: 28MB + 6.5MB/machine
  440.  
  441.   ╖  RAM: I am using X on 8 MB. For only 4MB swap is needed, I guess,
  442.      which can be created -- separately for each machine -- in /tmp. Do
  443.      not forget to run mkswap.
  444.  
  445.   ╖  Speed: I had no problems on a 486 DX2/66 with 8 Megs.
  446.  
  447.  
  448.   7.  Possible errors
  449.  
  450.  
  451.  
  452.   ╖  I found a strange error: in the /dev subdirectory SunOS corrupted
  453.      the device entries so I needed to rerun MAKEDEV by mounting the
  454.      subdirectory onto a disk based Linux box.  (The reason was the
  455.      differences between the linux nfs and the SunOs nfs: both use 32
  456.      bit for the Major and Minor device number, but linux uses 16 bit
  457.      wide fields for both, SunOs uses 14 bit wide field for Major and 18
  458.      bit wide filed for Minor device number.)
  459.  
  460.   ╖  When the diskless linux gets booted, there is only one route
  461.      included in the routing table to the tftp server, so you need to
  462.      set up correct routing tables. You have two choices here:
  463.   ╖  configure every rc.S for every machine by hand
  464.  
  465.   ╖  use a bootp client package and write a generalized setup script
  466.  
  467.  
  468.   8.  Errors and possible further expansions of this document
  469.  
  470.  
  471.   ╖  Correct citation of related documents.
  472.  
  473.   ╖  SunOs is BSD based. Need to include SVR4 (e.g. Solaris) based
  474.      server configuration.
  475.  
  476.   ╖  Although Linux is quite similar to SunOs as bootp/tftp server, a
  477.      linux based server example might be usefull.
  478.  
  479.   ╖  Update this document to the current etherboot package.
  480.  
  481.   ╖  Show the differences between the nfs root patched kernel version
  482.      1.2.13 and the newest 1.3.x kernel, which contains the nfs-root
  483.      patch.
  484.  
  485.   ╖  Need to try other ethercards than wd8013
  486.  
  487.   ╖  Include configuration information for bootpc, a bootp client for
  488.      linux to set up the correct rooting tables.
  489.  
  490.   ╖  Typos and other errors: please, report to buci@math.klte.hu Thank
  491.      you.
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.