DHCP Server/PXE Boot

A DHCP server (Dynamic Host Configuration Protocol) automatically configures devices in a network, including the assignment of IP address, netmask, gateway, domain name server (DNS), and also the setup for network boot (PXE). Preboot Execution Environment (PXE) enables computers to boot through the network and load an operating system. Devices with PXE-capable network adapters can retrieve a boot image over the network containing the operating system or other necessary boot files.

PXE is compatible with both BIOS (Basic Input/Output System) and UEFI (Unified Extensible Firmware Interface). PXE itself is independent of the computer’s firmware, although the boot loaders used for BIOS and UEFI are different.

In this context, the opsi depot server functions as a boot server, allowing opsi to execute automated processes independent of an operating system installed on the client.

To enable PXE boot, a DHCP server must provide additional information to the network device. When using the Trivial File Transfer Protocol (TFTP) for this purpose, the necessary configurations are:

  • Boot server (DHCP option 66): The IP address of the TFTP server (also known as the next server).

  • Boot filename (DHCP option 67): The path to the bootloader on the TFTP server. This option requires different configurations for UEFI and BIOS devices.

You can find more detailed information about TFTP in the chapter TFTP Server.

DHCP on the opsi Depot Server

An opsi depot server can also function as a DHCP server, and it’s possible to manage the DHCP server configuration automatically with opsi.

To set this up, you need to install the ISC DHCP server on the opsi server. The specific name of the package varies depending on the Linux distribution you are using; it is typically labeled as isc-dhcp-server or dhcp-server. If you’re unsure, consult the documentation or the repositories of your Linux system for clarity.

The preconfigured virtual machine (as detailed in the chapter Preconfigured Virtual Machine) already includes a DHCP server. This server is configured to assign IP addresses exclusively to known clients, meaning it does not offer free leases.

Automatic DHCP Configuration

If the DHCP server is installed on the opsi server, opsi can automatically configure it. In this scenario, opsi also takes care of creating and updating client entries. The only requirement from your end is to input the MAC address and, if necessary, the IP address of the client. This can be done through the management interface opsi-configed (for more details, refer to the chapter Management Interface opsi-configed).

The configuration for the automatic DHCP setup via opsi is managed in the file /etc/opsi/backends/dhcpd.conf on the opsi config server. An example configuration might look like this:

# -*- coding: utf-8 -*-

module = 'DHCPD'

config = {
    "enabled":                 True,
    "dhcpdOnDepot":            True,
    "fixedAddressFormat":      "FQDN", # or IP
    "dhcpdConfigFile":         "/etc/dhcp/dhcpd.conf",
    "reloadConfigCommand":     "sudo service isc-dhcp-server restart",
    "defaultClientParameters": { "next-server": "10.11.12.13" }
}

The configuration parameters have the following meaning:

  • enabled:

    • True: The automatic configuration is enabled.

    • False: The automatic configuration is deactivated.

  • dhcpdOnDepot:

    • False: The DHCP server on the opsi config server manages all clients.

    • True: The clients are managed in the DHCP configuration of the assigned depot.

  • fixedAddressFormat:

    • FQDN: The FQDN is used as the address for the client entries.

    • IP: The IP address is used for the client entries.

  • dhcpdConfigFile: The path to the ISC DHCP configuration file; if this entry is missing, the path is determined automatically (recommended and default).

  • reloadConfigCommand: The command that is executed after changes to the configuration file in order to activate it. If this entry is missing, the command is determined automatically (recommended and default).

  • defaultClientParameters: Client configuration parameters to be set for each client; if this entry is missing, they are determined automatically (recommended and default).

External DHCP Server

If you want to use the PXE boot functionality of the opsi server and there’s already an existing DHCP server in your network that is intended to manage the opsi clients, you will need to modify the configuration of this existing DHCP server as follows:

  • Boot server (DHCP option 66): Specify the IP address of your opsi depot server as the boot server.

  • Boot filename (DHCP option 67): Adjust your DHCP server’s settings to assign opsi/opsi-linux-bootimage/loader/shimx64.efi.signed as the boot filename for UEFI devices, and opsi/opsi-linux-bootimage/loader/opsi-netboot.bios for legacy BIOS devices.

Here’s an example showing the configuration for an ISC DHCP server:

next-server 10.10.1.2;
if substring (option vendor-class-identifier, 19, 1) = "0" {
	filename "opsi/opsi-linux-bootimage/loader/opsi-netboot.bios";
}
else if substring (option vendor-class-identifier, 19, 1) = "7" {
	filename "opsi/opsi-linux-bootimage/loader/shimx64.efi.signed";
}