home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 13 / CDA13.ISO / DOC / HOWTO / MINI / DISKLESS < prev    next >
Encoding:
Text File  |  1996-06-05  |  14.2 KB  |  366 lines

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