Setting up diskless boot

How diskless boot works

Some computers support loading a boot image from the network. Older computers like Sun and HP Unix systems have a firmware (not really a BIOS, much more sophisticated, but that's the terminology we've inherited from the IBM PC) that supports net boot. These use BOOTP and TFTP or RARP and TFTP to configure the network interface and get the boot image.

On these older computers the install media was often floppies, tape, or maybe a CDROM. Getting usable boot media can be a problem these days, so being able to boot and install over the network can be very handy.

I have a Hewlett Packard 9000 serverr, Model A180C from 1988. It is a 2U rack server. Serial console. Not floppy or CD. 10/100 Base T network interface. This has a PA RISC CPU and 512M RAM. Internal disk is SCSI.

The HP firmware supports network configuration via BOOTP and uses TFTP to load the boot image that the BOOTP server told it about.

To simplify the netbooting process I prefer to use a spare interface on my server to create a seperate network to configure and boot the target system. The DHCP, BOOTP, and RARP protocols use broadcast and may conflict with existing network services, so using a seperate network keeps potential problems to a minimum.

It also means that troubleshooting is easy. You can just use tcpdump on the boot network which should only have the boot server and the target system. You can see all the traffic on the network and get a good idea of what is happenning.

This example shows installing OpenBSD 7.0 from an OpenBSD server using only the base system.

Most of these instructions require root permissions. You'll need to be logged in as root or (preferably) use doas to run these commands.

Network

Set up a network interface for the diskless install.

The address space reserved for private IPv4 networks is:

CIDRAddress range
192.168.0.0/16192.168.0.0 - 192.168.255.255
172.16.0.0/12172.16.0.0 - 172.31.255.255
10.0.0.0/810.0.0.0 - 10.255.255.255

Most home network routers user the 192.168 address space. So I'll use 172.18.3.0/24 to stay well clear of normally used address space so I'm unlikely to have any conflicts.

My server has a spare ethernet interface at bge1.

ifconfig bge1 inet 172.18.3.1 netmask 255.255.255.0

If you want this to be persistent, create /etc/hostname.bge1 with this line:

inet 172.18.3.1 255.255.255.0 172.18.3.255 description "V240"

DNS

Use unbound to set up a caching DNS server and authorative for .home.arpa. (RFC 8375).

Add these lines in /var/unbound/etc/unbound.conf:

        interface: 172.18.3.1
        access-control: 172.18.3.0/24 allow

        local-zone: "home.arpa." static
        local-data: "v240.home.arpa. IN A 172.18.3.1"
        local-zone: "3.18.172.in-addr.arpa." static
        local-data-ptr: "172.18.3.1 v240.home.arpa"

Now start unbound:

rcctl enable unbound
rcctl start unbound

DHCP

Set up dhcp to allocate an IP address, configure DNS, and set where to get the boot image. I'm booting a Hewlet Packard 9000 A180C server with a PA-RISC PA7300-LC processor so I need the lif70.img boot file.

The HP 9000 A180C is an old school server and netboots using bootp, not dhcp. The OpenBSD dhcp daemon supports bootp but to make this work we need to set a fixed address. To do that we need to know the ethernet MAC address. The MAC address is on a label on the back of the computer.

Create file /etc/dhcpd.conf:

option  domain-name "home.arpa";
option  domain-name-servers 172.18.3.1;

subnet 172.18.3.0 netmask 255.255.255.0 {
 option routers 172.18.3.1;
 range 172.18.3.32 172.18.3.127;
 host bootp-client {
  hardware ethernet 00:10:83:b9:73:01;
  filename "lif70.img";
  next-server 172.18.3.1;
  fixed-address 172.18.3.2;
 }
}

Enable dhcpd:

rcctl enable dhcpd
rcctl set dhcpd flags bge1
rcctl start dhcpd

TFTP

Set up anonymous TFTP to allow the installer to be loaded onto the target system.

mkdir /tftpboot
chown _tftpd:_tftpd /tftpboot
chmod 555 /tftpboot
rcctl enable tftpd
rcctl set tftpd flags -l 172.18.3.1 /tftpboot
rcctl start tftpd

HTTP server

To provide the install files the simplist way is to copy the files to a local server and run a webserver.

Create a config file /etc/httpd.conf.

server "v240.home.arpa" {
        listen on * port 80
        root "/htdocs"
        directory auto index
        log style combined
}

Create the default directory structure.

doas mkdir -p /var/www/htdocs/pub/OpenBSD/7.0/hppa

Populate this directory with the install files. This shell script will populate the directory, skipping the ISO images because we don't need them and they're large. Also skip the txt file and copy the diskless boot image to /tftpboot.

#! /bin/sh

cd /var/www/htdocs/pub/OpenBSD/7.0/hppa

INSTALLFILES=`ftp -Mo - http://ftp.openbsd.org/pub/OpenBSD/7.0/hppa/index.txt | grep 2021 | grep -v iso | grep -v txt | cut -c 55- `

for FILE in ${INSTALLFILES}
do
 ftp http://ftp.openbsd.org/pub/OpenBSD/7.0/hppa/${FILE}
done

# copy the diskless boot image to /tftpboot
cp lif70.img /tftpboot

Start the webserver.

rcctl enable httpd
rcctl start httpd

Boot

At this stage we need to get hooked up to the console. This server only has serial console. It defaults to 9600 bps. We need a null modem cable and some sort of serial port. I use a USB serial adapter and a null modem cable made from an old serial mouse cord. It has a D9 female connector at each end, pin 5 straight through, pins 2 and 3 connected to pins 3 and 2 (swapped).

To connect to the console:

cu -l /dev/cuaU0 -s 9600

Power on the target server and wait for the firmware. This has a simple menu structure. Search for available boot devices. You should see any internal disks, and the network interface.

search

To boot from the network, use a command like:

boot 8/0/20/0.0

That should use BOOTP to configure the network and TFTP to load the OpenBSD install image. Now you just do a normal install, using the files on the local server (http://172.18.3.1 or http://v240).