I have tried to configure a network boot environment for FreeBSD some years ago. Well, my trying stopped immediately after reading the documentation for this. If I remember correctly it requires a bunch of files on a TFTP server, a NFS share as root file system and settings in the DHCP server. While TFTP and DHCP are rather trivial to configure I wasn’t amused by the idea to create a NFS share for the whole root file system. Disk space has been tight at home back in those days. Why I need to boot an installation of an OS over the network? I thnik it is the easiest way to setup one of the PC Engines boxes if you can start the OS installation over the network.

As on countless other occassions OpenBSD comes along with an easy to use solution for network booting the installation. All I need for this is a TFTP server providing three files and a DHCP server with the correct settings. No NFS share, no waste of disk space. The man page for pxeboot(8) describes the requirements. The rest of this post shows the practical implementation of this.

TFTP server

OpenBSD comes along with tftpd(8) to provide the trivial file transfer protocol service to the network. First, I have to create a folder for tftpd(8). In most documentation you see it as /tftpboot or something similar. I choose to name my folder /home/tftp. With the following commands I create the folder, configure tftpd(8) and start it:

$ doas mkdir /home/tftp
$ doas rcctl enable tftpd
$ doas rcctl set tftpd flags /home/tftp
$ doas rcctl start tftpd

DHCP server

The DCHP server dhcpd(8) of OpenBSD supports all the required options for network boot. In my existing config file dhcpd.conf(5) I have just to add two lines:

filename "pxeboot";
next-server 192.0.2.42;

The complete example file looks like this:

dhcpd.conf

authoritative;

subnet 192.0.2.0 netmask 255.255.255.0 {
	default-lease-time 86400;
	filename "pxeboot";
	max-lease-time 604800;
	next-server 192.0.2.42;
	option domain-name "example.com";
	option domain-name-servers 192.0.2.11, 192.0.2.12;
	option routers 192.0.2.1;
	option subnet-mask 255.255.255.0;
	range 192.0.2.100 192.0.2.254;
}

Required files

This part is the one I like most about netbooting the installation of OpenBSD. I just need to place three files in /home/tftp:

$ doas cp /bsd.rd /home/tftp/
$ doas cp /usr/mdec/pxeboot /home/tftp/
$ doas mkdir /home/tftp/etc
$ doas ksh -c 'echo "boot tftp:bsd.rd" > /home/tftp/etc/boot.conf'

The last command creates the required boot.conf(8) file which tells pxeboot(8) which kernel file it must boot on the system. If the system only has a serial port as console – like e. g. the apu2 boxes of PC Engines – the file /home/tftp/boot.conf must look like this:

boot.conf

stty com0 115200
set tty com0
boot tftp:bsd.rd

These settings set the speed of the serial port to 115’200 bps and configures the first serial port as the default console of the system.

Now everything is ready to boot the first system and install OpenBSD on it.