Mirrored from: http://www.applied-synergetics.com/ashp/html/disklessboot.html
on: 19 Dec 2002

 

Linux Diskless Booting

 

These instructions outline the procedure required to set-up linux diskless boot using Redhat 6.0, bootp & etherboot on a system using an NE2000 clone Network Interface Cards (NICs). The diskless workstation will be able to boot from a master server and mount remote filesystems. Adapting to other NIC's will not be very difficult to do.

First you will need to download the bootp server package. I chose the RPM package for Redhat. Then download Ken Yap's etherboot package.

  1. As root, install bootp with the rpm -i bootp-2_4_3_7_i386.rpm command.
  2. Uncompress the etherboot package with tar -zxvf etherboot-4.2.tar.gz.
  3. Read the Etherboot User Manual for a general overview of the installation process.
  4. Change directory as follows: cd etherboot-4.2/src-32.
  5. Edit the Config file to adding the -DNO_DHCP_SUPPORT option to use bootp instead of DHCP.
  6. Run make in the /etherboot-4.2/src-32 directory to make the 32-bit rom images.
  7. Test the ROM images by creating a boot floppy. Insert a floppy into the fd0 drive then create the boot disk for the ne2000 card using make ne.fd0. Other NIC's can be substituted with the appropriate name. This disk will act like the boot rom is loaded on your card.
  8. Test the boot floppy. It should boot and indicate that it is looking for a bootp server. Record hardware address of the NIC as displayed on the boot screen.
  9. This completes the initial client side preparation. Next comes the server side preparation. First we enable some services, and set configuration files which will identify the client machine. For this example, the client machine will be called testbed.synergetics.org and will be configured for IP address 192.168.0.100. The NIC's hardware address from step 8 above was 00409513C48F. We will compile a custom kernel for the client machine and it will be named vmlinuz.embedded.

  10. Edit the /etc/inet.conf file to remove comments on the tftp and bootp lines. Add /tftpboot to then end of the tftp line. Save the file changes.
  11. Allow the diskless machine to use the tftp service on the host by editing the /etc/hosts.allow file. Add the line tftp:ALL to this file. Note that this command gives all machines access to the tftp service. This may not be what you want security-wise. Consult the hosts.allow man file for more options.
  12. As root, create the /etc/bootptab file. Here is a sample for our client:
  13. .default:\

    :ht=ethernet:\

    :hd=/tftpboot:sm=255.255.255.0:bf=null\

    :hn:to=36000:

    testbed.synergetics.org:tc=.default:ha=00409513C48F:ip=192.168.0.100:bf=vmlinuz.embedded

    Consult the etherboot readme for more info on the format of this file.

  14. Make sure either DNS or the hosts file has an entry for the diskless machine. Here is a sample entry:
  15. 192.168.0.100 testbed.synergetics.org testbed

  16. As root, create a directory called tftpboot off of the root directory. Make it world-writable using chmod a+w /tftpboot.
  17. Now you must compile a custom kernel. This kernel must contain support for all the devices and features your client must support. It must enable features that allow the root file system to be on nfs and untilize bootp. In addition you must hardcode the driver for the ethernet card you will use. See the etherboot README.txt for more info.
  18. Once the kernal is configured, do make dep followed by make clean and make bzImage.
  19. Compile the netboot files in /etherboot-4.2/netboot-0.8.1 by running ./configure followed by make and make install. This will vreate the file needed to convert the kernel image into a tagged image file.
  20. Copy the new kernel from /usr/src/linux/arch/i385/boot/bzImage to a temporary area.
  21. Use the mknbi file in the netboot-0.8.1/mknbi-linux subdirectory to create a tagged image file using:
  22. mknbi -x -k bzImage -o /tftpboot/vmlinuz.embedded

    Make sure that mkbni is in your executable path. There should now be a tagged image file called vmlinuz.embedded in the /tftpboot directory.

  23. Restart inet services. I usually just reboot the server at this point.
  24. Once the bootp server is restarted, try rebooting the diskless machine. It should load the kernel and configure the IP address you specified before it stops because it can't find a root directory. If this is working thus far, you are ready to start the NFS configuration.
  25. Now setup nfs file access for the diskless machine. First edit the /etc/exports file on the bootp server machine:
  26. /tftpboot/testbed.synergetics.org testbed.synergetics.org(rw, no_root_squash)

  27. Register the NFS exports using exportfs -a.
  28. Do the following as root:
  29. cd /

    umask 022

    mkdir -p /tftpboot/testbed.synergetics.org

    mkdir -p /tftpboot/ testbed.synergetics.org/bin

    mkdir -p /tftpboot/ testbed.synergetics.org/mnt

    mkdir -p /tftpboot/ testbed.synergetics.org/proc

    mkdir -p /tftpboot/ testbed.synergetics.org/tmp

    mkdir -p /tftpboot/ testbed.synergetics.org/usr

    chmod 1777 /tftpboot/ testbed.synergetics.org/tmp

    touch /tftpboot/ testbed.synergetics.org/fastboot

    chattr +i /tftpboot/ testbed.synergetics.org/fastboot

    cp -a bin lib sbin dev etc root var /tftpboot/ testbed.synergetics.org

    These commands make copies of the filesystem files that will be used by the client. When proceeding be sure you are working on the COPIES not the originals. This is very easy to do if you are not careful.

  30. Now very carefully modify some of the key start-up files
  31. /etc/sysconfig/network

    NETWORKING=yes

    FORWARD_IPV4=false

    HOSTNAME=testbed.synergetics.org

    DOMAINNAME=synergetics.org

    GATEWAY=0.0.0.0

    GATEWAYDEV=eth0

    sysconfig/network-scripts/ifcfg-eth0

    NETWORKING=yes

    FORWARD_IPV4=false

    HOSTNAME=testbed.synergetics.org

    DOMAINNAME=synergetics.org

    GATEWAY=0.0.0.0

    GATEWAYDEV=eth0

    /etc/fstab

    googleplex:/tftpboot/testbed.synergetics.org / nfs defaults 0 0

    googleplex:/usr /usr nfs defaults 0 0

    /dev/fd0 /mnt/floppy ext2 noauto 0 0

    none /proc proc defaults 0 0

    none /dev/pts devpts mode=0622 0 0

    Note: googleplex is the name of my bootp server. Root and /usr are setup to be accessed via nfs. /usr access should be read-only.

    /etc/hosts

    127.0.0.1 localhost localhost.localdomain

    192.168.0.4 googleplex.synergetics.org googleplex

    192.168.0.100 testbed.synergetics.org testbed

    conf.modules

    alias eth0 ne

    options ne io=0x300 irq=3

    alias parport_lowlevel parport_pc

  32. Now the moment of truth. Reboot the client machine. If all goes well you'll end up at a login prompt. At this point all logins are the same as those on the server machine. These can now be modified. You may have notcied that some services didn't start up. You can now edit the services you want started on the client machine.

Contact Rick Bono at: rjbono@applied-synergetics.com 

Copyright (c) 2002 - Applied Synergetics. All Rights Reserved