Network: Diskless Booting I: Setting up the server

(last edit: 2001-05-01)

Introduction

This document will try to help you step by step with configuring diskless booting with FreeBSD. I have looked into this subject because I wanted to be able to install a machine with a default installation via the network and a bootfloppy. This document is devided in the following parts: The first to parts are offcourse the most important parts. The last part describes a case in which syslog is used to detect new machines and a perl script to add those new machines to the config files(s).

Setting up the server

The server needs to have a daemon which will supply the client of the necesary data like an ip address and one which will transferr a kernel to the client. 'tftp' is the protocol which is commenly used for transferring the kernel. You can see tftp as the little brother of ftp. It does the same but less secure, it sends its data via udp and without login authorization. This is normaly a 'bad' thing to do but for diskless booting it is perfect because of the lack of authorization. You must enable the tftp daemon by uncommenting the folloging line in '/etc/inetd.conf': tftp dgram udp wait nobody /usr/libexec/tftpd tfpd /tftboot The last option '/tftpboot' specifies the directory in which the client kernel is stored. I decided to place all diskless client files in the dir '/usr/diskless' so I changed the above line to: tftp dgram udp wait nobody /usr/libexec/tftpd tfpd /usr/diskless Don't forget to 'killall -HUP inetd' to make the changes active. Supplying the client with data can be done via 'bootp' of 'dhcp', i'll leave the choice up to you and I'll explain bootp first and then dhcp.

bootp

The bootp daemon 'bootpd' must be started from inetd and therefore you have to uncomment to following line: bootps dgram udp wait root /usr/libexec/bootpd bootpd Don't forget to 'killall -HUP inetd' to make the changes active. Bootpd used the config file '/etc/bootptab' for it's clients. Here is an example: --- .default:\ :ht=ethernet:\ :hd=/usr/diskless:\ :bf=kernel:\ :sm=255.255.255.0:\ :rp="192.168.1.5:/usr/diskless":\ :hn:\ :vm=rfc1048: diskless:ha=0040AF598E2B:ip=192.168.1.254:tc=.default: --- Lets first look at what all these options mean: ht Host hardware type (see Assigned Numbers RFC) hd Bootfile home directory bf Bootfile sm Host subnet mask rp Root path to mount as root hn Send client's hostname to client vm Vendor magic cookie selector ha Host hardware address ip Host IP address tc Table continuation (points to similar "template" host entry) And FYI here are a few options I haven't used but could be interesting: gw Gateway address list td TFTP root directory used by "secure" TFTP servers to Time offset in seconds from UTC ts Time server address list vm Vendor magic cookie selector yd YP (NIS) domain name ys YP (NIS) server address ds Domain name server address list And for more options you can allways check the 'man bootptab' page. So the first three lines of my example mean: use 'ethernet', see the dir '/usr/diskless' as the root, use the file 'kernel' as the kernel and use subnetmask '255.255.255.0'. Think twice before setting the 'rp' line: you must think from the client side so and it is the same as the mount command. So from which host would you like to mount and what dir would you like to mount. In this case the dir '/usr/diskless' will be mounted from the server 192.168.1.5 . I used an ip address here and you probaley can use a hostname but make sure the client can resolve that hostname. Don't break your head over the 'vm' line just leave it there (that's all I know). You might have noticed a few thing about the layout of the first block:
  • The name begins with a dot (.default),
  • All but the last line end with a '\',
  • There are allot of semicollons.
Names who begin with a dot are used as dummy names and will nog effect clients. They are used to set default values for a set of machines. Each client entry must me specified on one single line but that would be a long one in the case of this default entry. Bootpd will concatenate the lines if you add a slash to the end of the line and therefore the slash shouldn't be at the end of the last line. All fields are seperated by semicollons and therefore you see allot of them. Oke so now we have a default entry but what about clients? This is were the last line comes in: diskless:ha=0040AF598E2B:ip=192.168.1.254:tc=.default: This means: the client with soon to be hostname 'diskless' which has MAC address '00:40:AF:59:8E:2B' will get ipnumber '192.168.1.254' and all what is in the template '.default'. Notice the missing semicollons in the MAC address behind 'ha' this is for obvious reasons So if a request comes from a machine with that MAC address, it will get its information. If a request comes from a machine with an unlisted MAC address, it will not be served and an error message with the MAC address will be passed to syslog.

dchp

soon, be patient.

rc.diskless1/2

When your client finaly boots it will read the 'rc.diskless1' and 'rc.disless2' files from the '[rootfs]/etc' directory. In this case that would be: /usr/diskless/etc/rc.diskless1 /usr/diskless/etc/rc.diskless2 rc.diskless1 This file contains a mechanism for controlling various 'etc' dirs. It can be usefull when you boot allot of diskless clients with some common files and some private files. In my case I realy didn't need this functionality so I reduced the file to the following line: diskless_mount="/etc/rc.diskless2" Which means: load 'rc.diskless2' (again from the point of view of the client so it loads '/usr/diskless/etc/rc.diskless2'). rc.diskless2 This file loads the 'rc.conf' file and make a '/var' and 'dev' dir in the clients memory. The root partition isn't writable until the client is booted and therefor the dirs in memory are created because they are writeable. I'm not realy, realy sure about this statement but the fact remains that if you don't create these dirs then you client isn't able to boot properly. I left the rc.diskless2 file as it was and didn't change it. Make sure you have a propper kernel and rootfs set up!!! Well that's all for the server. Next up is Setting up the client.

Click here to go back to the index.