DHCP Server/PXE Boot

A DHCP server (Dynamic Host Configuration Protocol) automatically configures devices on a network. This includes assigning IP addresses, subnet masks, gateways, and domain name servers (DNS). Additionally, the DHCP server can provide the necessary information for network booting (PXE).

The Preboot Execution Environment (PXE) allows computers to boot directly from the network and load an operating system or special tools.

PXE works with both BIOS (Basic Input/Output System) and UEFI (Unified Extensible Firmware Interface). The PXE specification is independent of the firmware, but the bootloaders used differ.

In the opsi environment, the opsi depot server acts as the boot server.

For PXE boot to work smoothly, the DHCP server must provide additional information to the network device:

  • Boot Server (DHCP Option 66): IP address of the boot server (also called next-server)

  • Boot Filename (DHCP Option 67): Path to the bootloader on the boot server. This option must be configured differently for UEFI and BIOS devices.

For detailed information about TFTP (Trivial File Transfer Protocol), see TFTP Server.

DHCP on the opsi Depot Server

An opsi depot server can also be used as a DHCP server. The automatic management of DHCP configuration by opsi is particularly convenient.

To do this, install the ISC DHCP server on the opsi depot server. The package name varies depending on the Linux distribution and is either isc-dhcp-server or dhcp-server. If in doubt, check your system’s package sources or manual.

The preconfigured virtual machine (see Preconfigured Virtual Machine) already includes a DHCP server. It is configured to assign IP addresses only to known clients. This increases security and prevents conflicts with other DHCP servers.

Automatic DHCP Configuration

If opsi is installed on an opsi depot server, DHCP configuration can be performed automatically. The settings are taken directly from the opsi database. You only need to provide the MAC address and, if necessary, the IP address—for example, when creating a client via the management interface opsi-configed (see Management Interface opsi-configed).

You control automatic DHCP configuration via the file /etc/opsi/backends/dhcpd.conf on the opsi config server. Example:

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 individual configuration parameters mean:

  • enabled:

    • True: Automatic configuration is enabled.

    • False: Automatic configuration is disabled.

  • dhcpdOnDepot:

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

    • True: Clients are managed in the DHCP configuration of the assigned opsi depot server.

  • fixedAddressFormat:

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

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

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

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

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

External DHCP Server

If you already use your own DHCP server in the network and want to use the PXE boot function of opsi, you must adjust your DHCP server configuration accordingly:

  • Boot Server (DHCP Option 66): Enter the IP address of your opsi depot server as the boot server.

  • Boot Filename (DHCP Option 67): Configure your DHCP server so that UEFI devices receive opsi/loader/opsi-netboot.x64.efi as the boot filename and legacy BIOS devices receive opsi/loader/opsi-netboot.x86.bios. For ARM64, use opsi/loader/opsi-netboot.arm64.efi accordingly.

The following example shows the configuration of an ISC DHCP server for different bootloaders:

next-server 10.10.1.2;
filename "opsi/loader/opsi-netboot.x64.efi";
if substring (option vendor-class-identifier, 19, 1) = "0" {
  filename "opsi/loader/opsi-netboot.x86.bios";
}
else if substring (option vendor-class-identifier, 19, 1) = "7" {
  filename "opsi/loader/opsi-netboot.x64.efi";
}
else if substring (option vendor-class-identifier, 15, 5) = "00011" {
  filename "opsi/loader/opsi-netboot.arm64.efi";
}

Troubleshooting DHCP

If PXE boot does not work as expected, first check your DHCP server configuration and make sure the service is running.

To analyze DHCP traffic in the network, use tools such as tcpdump or Wireshark. These programs allow you to capture and analyze transmitted packets in detail.

The following command shows all DHCP packets transmitted in the network:

tcpdump -s0 -vv port bootpc or port bootps

The output shows you what information the DHCP server transmits to the client — in particular, the configured boot server and boot filename. This allows you to quickly identify sources of error.