When you turn on your diskless node, it’ll broadcast a
request on the network for an IP address, along with its unique ID. Every Ethernet card
has a unique hexadecimal ID like 00:60:08:C7:A3:D8. The Linux server will check its
database for the ID and will then assign the corresponding IP address to the node.
It’ll then instruct the node to download its kernel. Once this is done, the node will
boot from the kernel and mount its file system from the server. If your node’s
network card doesn’t have a boot ROM, you can create a bootable floppy using a tool
called Etherboot. You’ll find it on this month’s PCQ CD at (/cdrom/source
code/linux).
Now let’s see how to create the network.
On the server side
I’ve created a custom package called The Diskless Linux Kit
that’ll help you get started quickly. It’s available on this month’s CD by
the filename diskless kit.tar.gz. Extract it to your server’s hard disk. Go to the
tools directory and copy all the files here to the /bin directory of your server.
You also need bootp and tftp servers installed and running on your Linux server. The bootp
server responds to requests for IP addresses, and the tftp server sends the kernel to a
node. These services are available in most Linux distributions and are also freely
downloadable from many Linux Websites. To check for these, type bootpd and
tftpd. If you
don’t get any error messages, they’re probably installed. You must also have the
nfs and portmap services running on your Linux server.
Ensure that your Linux server has a static IP address like
192.168.1.1. We shall henceforth refer to the server as Aqualine. Log into Aqualine as
root. First, you need to set up tftp and bootp to start up when the system boots. For
this, open the inetd.conf file in /etc directory using a text editor like Joe or Teddy,
and remove the hash mark from the following lines:
tftp dgram udp wait root /usr/sbin/in.ftpd
bootps dgram udp wait root /usr/sbin/in.bootpd
Next, open the services file in the same directory and remove the hash mark
from these lines:
bootps 67/tcp #BOOTP server
tftp 69/udp #TFTP server
Create the directory /tftpboot and make sure it’s world readable.
Diskless action
We’ll now create a bootable image on a floppy disk to start our
diskless node. Ensure that your nodes have at least 16 MB of RAM, and get a good graphics
card if you also plan to run X Window remotely.
Insert a blank floppy into the drive of your server, but don’t mount it. Change to
disklesskit/images directory. Here, you’ll find a file called list.txt, which
contains the names of all supported network cards. Use the generic NE2000 image if your
card isn’t listed. Find out the name of your card, and type the
following commands at the prompt:
make cardname.fd0 (where cardname is the name of the image
you’ve chosen)
cat floppyload.bin cardname.lzrom >fd0
this floppy into your node and boot up. This should correctly detect your network card. If
not, try a different image. It’ll also display the ID of your card, which you need to
note down. Now on Aqualine, insert the following into a file called /etc/bootptab:
machine1:ha=<(enter your Ethernet
ID):ip=192.168.1.10:bf=/tftpboot/vmlinuz.db
When you enter your Ethernet ID, don’t enter the separating colons. For example, if
it’s 0:60:08:C7:A3:D8, write it as 06008C7A3D8.
This file is used by bootp to correctly respond to a node’s request. So, if the
file’s not there, create it with a text editor.
Customized kernel
The next step is creating a custom kernel. This kernel should have
compiled-in support for nfs, root file system over nfs, bootp, and your network card. To
keep things simple, keep modules disabled. The Diskless Linux Kit that we’ve given on
the CD includes a sample kernel configuration file (kernel-config), which you can import
into your kernel configurator utility. We’ve also included a compiled version on the
CD. It contains support for the Intel EtherExpress Pro card(8255x), 3Com 509B card, and
generic NE 2000 cards. If your system matches these specs, you can simply use this kernel,
otherwise import the configuration file and make the necessary changes. You’ll find
the kernel– vmlinuz.db–in the disklesskit/kernel directory. If you enable
support for all the cards that your various nodes will use, you can simply share this
kernel amongst all nodes.
Any kernel you plan to use must be converted into a tagged
image (the kernel we’ve included has been tagged already). To do this, after
compiling your kernel change to /usr/src/linux/i386/boot and run the command mknbi zImage
vmlinuz.db. After you’ve obtained vmlinuz.db, copy it to the /tftpboot directory.
Reboot Aqualine and start the node once again. This time, it’ll download the kernel
and boot until the point when it’s mounted the file systems. It’ll crash after
this, as we haven’t configured nfs yet.
Now we need to create a basic Linux system for the node. There’s script in the kit
that’ll let you do this easily. Change to /tftpboot and type
first 192.168.1.10 This will create the directories and file
structure. Next go to /tftboot/192.168.1.10/etc/sysconfig, edit
network and modify the hostname field so that it reads machine1.
Open tftpboot/192.168.1.10/etc/sys config/network-scripts/ edit ifcfg-eth0 and
edit the IP address to match the nodes (192.168.1.10).
On Aqualine, add the following line to a file called /etc/exports:
/tftpboot/192.168.1.10 machine 1 (rw, no root_squash)
This tells Aqualine the directory that must be provided to 192.168.1.10 (the
node) when it requests its root file system.
On Aqualine, type exportfs —a (This should be run
whenever you make a change to /etc/exports).
You can now boot up the node and it should mount the root file system. You’ll get a
string of errors, but don’t worry about it. This happens because many configuration
settings expect to find a /usr directory, we’ll fix this a little later. You should
get to a login screen. As long as your root partition mounted fine, there’s no need
to worry.
The node has imported the entire password list of the
server, so all passwords will work. You should change the root password for security
reasons and remove all users that you don’t require. Now, to create the
/usr
directory, edit the file /tftboot/192.168.1.10/etc/fstab on
Aqualine.
Remove all entries in this except the ones that point to
/proc and /dev/pts and add the following line
192.168.1.1:/usr /usr nfs defaults 0 0
This will mount the /usr partition from the server. To enable Aqualine to export this,
edit the file exports in /etc and add
/usr (ro)
Run exportfs –a
Restart the node, login, and run the command that configures system services. In Red Hat,
simply type ntsysv and you’ll see a list of services that should run automatically at
startup. Selecting a service and pressing F1 will tell you what it does. You should
definitely keep nfs, and keep only other essential services, as it’ll save precious
RAM.
Running X
Now for the exciting part—getting X up and running remotely. There
are two options available here. You can set up the node to either run X independently
(where the node does the processing) getting its files over the network, or to be
an X terminal. An X terminal simply displays and takes in user input, while the processing is done on the server. For all practical purposes, it’s the same as using the server physically.
An X terminal can be an extremely low-end machine and is practical if you have a reasonably powerful server. But if you have a large number of users and power-hungry apps, it’s better to let the nodes run X on their own. Just make sure you put in a zippy hard disk in the server, and if possible, set up a 100 Mbps network.
Both methods get set up simultaneously, so you could test both and choose what suits you best. To begin with, you must install the correct X server for your node’s graphics card. This should be done on
Aqualine, and the X server will install into the /usr directory. Once you’ve done that, remote boot your node and run XF86Config to configure it. Ensure that /etc/X11/X points to the X server for your node’s graphics card. Your distribution should include most X servers. Otherwise, you can download them from www.xfree86.org. If all else fails, you could try the SVGA or VGA16 servers.
If you want to run X independently, simply type startx and the node will start up X Window.
If you plan to run the node as an X terminal, first edit the file /etc/X11/xdm/Xaccess on Aqualine, and insert the node’s IP address:
# To control Direct and Broadcast access:
192.168.1.10
Save the file and type xdm.
Now, at the node type X —quiet —query 192.168.1.1
Voila! You should see the login screen of the server. Your login name and password would be what it is on Aqualine and not what’s on the node. You can now set up the node to come directly to this screen straight after bootup. Put Aqualine’s default runlevel into 5 and ensure that the relevant entry in /etc/inittab points to xdm is
x:5:/respawn:xdm Next, put the node into runlevel 5 and edit the node’s /etc/inittab like this
x5:/respawn:X —quiet —query 192.168.1.1 The next time you start the node, you’ll get the login screen of the server automatically. You’ll need to reconfigure the system services on both server and node, as you’ve now switched the runlevels.
You can also add more nodes. The process for this is the same as for adding the first one, except when it comes to creating the filesystem. Here, you have to run another script for all subsequent nodes. Change to the /tftpboot directory and type
again 192.168.1.10 192.168.1.11 This basically creates filesystems based on the first node. Incidentally, it’s also possible to modify the setup to boot DOS. Visit Etherboot’s homepage at www.slug.org.au/etherboot for more information.