Diskless Installation

Booting a blank system into the OpenBSD installer without using local media can save you time and energy. A lot of modern hardware doesn’t come with CD or floppy drives. Of course, you could temporarily add a CD drive, but if you have a whole bunch of OpenBSD machines to install, that’s just an annoyance.

You can also use network booting to boot OpenBSD on hardware that lacks an installed operating system, or with a different operating system that you plan to overwrite. This process is called pxebooting, or diskless, operation. Diskless systems can have disks—they just don’t use them to boot the operating system.

If you’ve never worked with diskless systems before, your first attempts will probably give you a headache. Setting up your first diskless environment can be tricky, and will teach you all sorts of things you didn’t know about your operating system and hardware. But test everything along the way, read the error messages carefully, and soon you’ll wonder why you thought this was hard.

Note

I’ll cover diskless installations on amd64 and i386 hardware. Other platforms have different requirements that may be very different. Read the diskless(8) man page for your particular architecture to get an overview of your platform.

Diskless systems work because a computer doesn’t need a hard disk to run. It needs an operating system. The easiest way to store a computer’s operating system is on the local hard drive, but a sufficiently smart network card can use information provided by DHCP to find an initial boot loader.

All amd64 and modern i386 hardware use Intel’s Preboot Execution Environment (PXE, pronounced “pixie”). The DHCP server tells the network card the name of a file and the IP address where the file can be found, and the server fetches the file via TFTP. This file is usually called pxeboot, but pxeboot files can vary widely among operating systems. A pxeboot file for OpenBSD probably won’t boot a FreeBSD system, let alone anything from Microsoft. It’s specific to each operating system.

Once the computer has loaded pxeboot, it goes back to the TFTP server to look for the appropriate kernel. An OpenBSD pxeboot looks for a file called bsd, assumes that it’s a kernel, loads the kernel into memory, and boots it. To install OpenBSD, you’ll load the install kernel file bsd.rd instead, which you can do automatically.

Diskless Hardware

OpenBSD systems installed over diskless systems must have enough smarts to find their boot loader and operating system over the network or they won’t boot. Any machine built in the past several years uses PXE.

You’ve probably seen a computer try to boot from the network more than once, and for most people, those BIOS messages are just an annoyance that they keep forgetting to disable. For diskless installation, you need to make sure that feature is on.

To enable PXE, boot the hardware and go into the BIOS setup. Somewhere in the BIOS, you should find an option to set the device boot order. If the machine supports PXE, one of those options will be to boot over a network. Enable that option and see if it works. While you’re in the BIOS, make a note of the MAC address of your network card. Your DHCP server will need it. If your BIOS uses the Unified Extensible Firmware Interface (UEFI) by default, disable that.

Save your changes and exit. Your hardware should now be prepared. Let’s ready the server.

DHCP Server Setup

DHCP is not just a way to hand out IP addresses and network configurations. A DHCP server can tell network-aware phones where to find their configuration, server hardware where to find its operating system, printers where to find their print server, and so on. Diskless installations use DHCP to feed diskless servers the location of the pxeboot file.

Per-Host or Per-Network Configuration

DHCP expects to configure hosts either by the network or by the host. When a DHCP server receives a DHCP request, it knows the address of the network that the host is on and the host’s MAC address. The DHCP server must decide which configuration to give the host based on this information. This means you can configure your DHCP server so that any host on a given network is told to install OpenBSD, or you can give it the MAC address of the machine you’re going to install and tell the DHCP server to start the installation only on that machine.

Because I install machines frequently, I usually set up a small VLAN where any machine plugged onto the network is told to install OpenBSD. That way, workers who plug their laptops into random Ethernet cables in my office get a free operating system upgrade. If you only occasionally install machines, and have control over the DHCP server, it’s pretty easy to configure the DHCP server to tell a host with a specific MAC address to install OpenBSD.

The DHCP server needs to tell the client the location of a PXE boot file, which gives the client just enough brains to find a bootable kernel. This is just like the on-disk boot loader, except that the PXE boot file talks to the network. OpenBSD’s i386 and amd64 platforms include the file /usr/mdec/pxeboot for just this purpose.

Give the name of the PXE boot file with the filename option, and then use the next-server option to specify the IP address of the TFTP server where the client can get the file. This example tells DHCP clients to load the file pxeboot from the server at 192.0.2.34:

filename "pxeboot";
next-server 192.0.2.34;

Place these statements according to whether you have an installation network or your DHCP server is set for a specific MAC address.

Per-Network Configuration

If you want all the hosts on your network to receive the OpenBSD installation PXE boot file, put the filename and next-server options in the subnet stanza, like this:

option  domain-name "michaelwlucas.com";
option  domain-name-servers 192.0.2.1;
subnet 192.0.2.0 netmask 255.255.255.0 {
        option routers 192.0.2.1;
        range 192.0.2.10 192.0.2.15;
        filename "pxeboot";
        next-server 192.0.2.34;
}

Any host on this network that makes a DHCP request at boot will learn where to get the PXE boot file.

Per-Machine Configuration

If you’ve hard-coded a machine’s MAC address into your DHCP configuration, as discussed in Chapter 16, you can feed the PXE boot information to that host.

subnet 192.0.2.0 netmask 255.255.255.0 {
…
    host installationtarget {
        hardware ethernet 02:03:04:05:06:07;
        filename "pxeboot";
        next-server 192.0.2.34; }
    }

Machines on this subnet that make a PXE request at boot will get the location of the PXE boot file only if they have MAC address 02:03:04:05:06:07.

Decide how you want your DHCP server to behave and make similar configuration changes.

Now let’s look at the TFTP server.

TFTP Server Setup

The next task is to make the OpenBSD-specific boot files available on your TFTP server. As a minimum, you need the pxeboot file and a kernel, but adding a boot.conf file will simplify your life.

OpenBSD includes an architecture-specific pxeboot file in /usr/mdec/. If you’re installing an i386 machine, grab this file and /bsd.rd from an existing i386 installation. If you’re installing amd64 hardware, get pxeboot and /bsd.rd from an existing amd64 system. Copy them to the TFTP server root directory, and verify that they’re world-readable.

pxeboot tells the machine to look for the standard kernel /bsd, not the installation kernel /bsd.rd. When pxeboot finishes loading, it looks exactly like the standard OpenBSD boot loader. You could interrupt the boot, as described in Chapter 5, and choose a different kernel, but pxeboot also recognizes /etc/boot.conf.

To tell pxeboot to load a different kernel, create an etc directory in your TFTP server’s root directory, and then create the file boot.conf inside that. This new boot.conf file has exactly the same syntax as /etc/boot.conf, so you can do a one-line entry like this:

boot bsd.rd

You can include additional boot options, such as setting a serial console.

Completing Diskless Installation

Once you have DHCP and TFTP, power on the installation target. You should see the network card make a DHCP request, get an IP address, and grab pxeboot via TFTP. You should then see the OpenBSD boot loader load the installation bsd.rd. Finally, you should get the OpenBSD install script.

If you don’t get the installer, take a step back. Does the network card get an address from DHCP? If not, check your wiring and DHCP server configuration. If you get an IP address, but can’t fetch pxeboot, check that you put the filename and next-server statements in the correct part of your DHCP configuration, and verify that you don’t have a packet filter blocking access to the TFTP server. Try to fetch those files from a different TFTP client to make sure that the TFTP server works. If the installation target partially boots OpenBSD, but doesn’t activate the installer, make sure you have an etc/boot.conf entry pointing the client at bsd.rd rather than bsd.

At this point, you should be able to install OpenBSD normally, as described in Chapter 2 and Chapter 3. But what if you want to run a full OpenBSD system without a hard drive? That’s where diskless operation comes in.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.0.85