Setting up a Boot Server
Setting up a Boot Server
Ruben de Groot, 30-10-2003

This howto describes how we configure a FreeBSD server to act as a central Bootserver for our PXE compatible network clients.

1 Description of the bootserver:
The bootserver provides all services necessary to boot, install and configure clients over the network, even if no Operating System was pre-installed on those clients. These services include tftp, dhcp and nfs.
The server will need enough diskspace to hold boot-images for the various clients that will be supported, as well as all the software packages that will be installed on the clients.

2 Description of the netbooting process
After POST (Power On Self Test) the client machine will issue a dhcp or bootp request. For this, the client's BIOS will have to be configured to use the network (LAN) as its first boot device. The dhcp server on the bootserver will answer this request, providing an IP address for the client and a filename for the bootloader the client should download.
The client machine will now connect to the tftp server on the bootserver and download the bootloader. This bootloader, pxeboot on FreeBSD systems, will in turn load the kernel and memory filesystem (mfs) from the tftp server.
If the client machine does not have its own harddrive, we're finished here. the mfs image will contain scripts that will mount everything necessary from the bootserver. If it does have a hardrive and we want to install an operating system on it, we'll have to make sure a setup program is launched from the mfs image that will execute the installation.
We will now look at the configuration of dhcp, tftp and nfs.

3 Configuring DHCP
Here's a sample configuration file for isc-dhcp3:
   # isc-dhcpd startup configuration file.
   dhcpd_options="-q"                      # command option(s)
   dhcpd_ifaces="ed0"                      # ethernet interface(s)
   ddns-update-style none;
   ddns-updates off;
   allow unknown-clients;
   allow booting;
   allow bootp;
   option subnet-mask;
   option routers;
   filename "pxeboot";
   option domain-name "";
   option broadcast-address;
   option domain-name-servers;
   server-name "";
   default-lease-time 7200;
   max-lease-time 7200;
   subnet netmask {
These options are pretty self-explanatory. RTM dhcpd(8), dhcpd.conf(5) for further details.

4 Configuring TFTP
To configure tftp, make sure the following line is in your /etc/inetd.conf:
   tftp dgram udp wait nobody /usr/libexec/tftpd tftpd /tftpboot
and inetd is running. Now copy your versions of pxeboot, kernel and mfsroot (more about this later) to /tftpboot. You can see if the setup works by letting a test client boot and checking if it loads the kernel and mfs allright.

5 Configuring NFS
There are roughly two different ways to configure NFS , depending on the type of network clients that are supported : The second case is the easiest to set up. Just mount (an image of) the FreeBSD installation CD on a directory and export that directory. Example:
   # mount /dev/acd0c /export/4.7-RELEASE
   # cat /etc/exports
   /export/4.7-RELEASE -alldirs -ro -network 192.168.179 -mask
   # /usr/sbin/portmap -h
   # /usr/sbin/nfsd -u -t -h
   # /usr/sbin/mountd
This is assuming that nfs wasn't previously running. The /export/4.7-RELEASE directory is exported read-only to every host on the 192.168.179.x network. The "-h IP-address" options to portmap and nfsd are for security reasons. You can also make sure nfs is allways running by putting the following lines in /etc/rc.conf:
   nfs_server_flags="-u -t -h"
This will also start mountd. Every time something is changed in /etc/exports (which shouldn't happen very often) all that is needed is a "killall -HUP mountd" to re-read the exports file.
Now you can boot the client into the kernel and filesystem images provided by tftp, start /stand/sysinstall (happens automatically when using the default floppy images provided by FreeBSD) and walk through the installation process specifying nfs as installation medium.

6 NFS as a central fileserver for diskless clients
This chapter needs some more work. Please be patient.

7 Making the boot images

7.1 pxeboot
The pxe bootloader can be found in /boot/pxeboot. All you have to do is copy it to your tftpboot directory.

7.2 kernel
Any kernel that supports the clients hardware will do. The GENERIC kernel should be allright. When using a custom kernel, the following options need to be in the kernel configuration file:
   options    MFS           #Memory Filesystem
   options    MD_ROOT       #MD is a potential root device
   options    NFS           #Network Filesystem
   options    NFS_ROOT      #NFS usable as root device, NFS required
Again, just copy your kernel to your tftpboot directory.

7.3 mfsroot
We start with the mfsroot.flp installation floppy image:
   FREEBSD 4.x:

   vnconfig vn0 mfsroot.flp
   mount /dev/vn0c /mnt
   zcat /mnt/mfsroot.gz >/tftpboot/mfsroot
   umount /mnt
   vnconfig -u vn0

   FREEBSD 5.x:
   mdconfig -a -t vnode -u 0 mfsroot.flp
   mount /dev/md0c /mnt
   zcat /mnt/mfsroot.gz >/tftpboot/mfsroot
   umount /mnt
   mdconfig -d -u 0
Now we can allready boot our clients over the network. They will boot into sysinstall, as if they were booted from the installation floppies. This can be usefull on machines without a floppy or cdrom drive.

This howto is still a work in progress...