Home OpenBSD OpenBSD: PXE boot with ISC DHCP Server

OpenBSD: PXE boot with ISC DHCP Server

by Kliment Andreev

The original DHCP server that is provided with OpenBSD is a custom build based on ISC DHCP v2. I was having problems running PXE Boot on the original DHCP server, mentioned in my previous article, so this article will describe how to setup ISC DHCP that works with PXE and TFTP.
First, we have to stop the old server running. The easiest way of doing that is to kill the dhcpd process.

kill -9 `cat /var/run/dhcpd.pid`

In addition, we have to edit /etc/rc.conf and change the line dhcpd_flags=”” to dhcpd_flags=NO, so the original server won’t start after the computer restart. Then, we have to download and install ISC DHCP server from OpenBSD ftp site.

export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/i386/
pkg_add isc-dhcp-server-3.0.4p0.tgz

The old dhcp program is /usr/sbin/dhcpd and the new one is /usr/local/sbin/dhcpd. Edit /etc/rc.local and add the following line:

if [ -x /usr/local/sbin/dhcpd ]; then
   echo -n ' ISC DHCP Server starting...'

This is a simple startup. If you need to use multiple startup configuration files, consider using variables in /etc/rc.local and /etc/rc.local.conf.

Now, let’s configure the dhcp server. First make a copy of the original /etc/dhcpd.conf and replace it with this one.

ddns-update-style none;   

# Definition of PXE-specific options
# Code 1: Multicast IP address of bootfile
# Code 2: UDP port that client should monitor for MTFTP responses
# Code 3: UDP port that MTFTP servers are using to listen for MTFTP requests
# Code 4: Number of seconds a client must listen for activity before trying
#         to start a new MTFTP transfer
# Code 5: Number of seconds a client must listen before trying to restart
#         a MTFTP transfer   

option space PXE;
option PXE.mtftp-ip               code 1 = ip-address;
option PXE.mtftp-cport            code 2 = unsigned integer 16;
option PXE.mtftp-sport            code 3 = unsigned integer 16;
option PXE.mtftp-tmout            code 4 = unsigned integer 8;
option PXE.mtftp-delay            code 5 = unsigned integer 8;
option PXE.discovery-control      code 6 = unsigned integer 8;
option PXE.discovery-mcast-addr   code 7 = ip-address;   

# PXE specific options
class "pxeclients" {   

  match if substring (option vendor-class-identifier, 0, 9) =
  option vendor-class-identifier "PXEClient";
  vendor-option-space PXE;
  # At least one of the vendor-specific options must be set in order
  # for the boot ROM on the client to recognize us as a PXE
  # compliant server. We set the MCAST IP address to to tell
  # the boot ROM we can't provide multicast TFTP, so it will have to
  # use just plain ol' TFTP instead (address is considered
  # as "no address").
  option PXE.mtftp-ip;

  subnet netmask {   

  option subnet-mask;
  option routers;
  option domain-name "chombe.org";
  option domain-name-servers,;   

  pool {

  # cluster nodes
  group {
     filename "pxelinux.0";
     host node1 {
        hardware ethernet 00:11:43:47:38:9c;

Line 37 is your network. From line 39 to line 42, you specify the “options”, parameters that each DHCP client will get, such as subnet mask, the gateway, the domain name suffix and the DNS server(s).
Specify the DHCP range in line 45. Explanation of every line of this configuration file will require another article and if you are interested, you can visit the ISC site and read the instructions. What is important is the last part where filename “pxelinux.0” specifies the boot file, hardware ethernet specifies the MAC address of the client that will be assigned (out of the DHCP scope) and next-server is the TFTP server’s IP address. See the next article on how to configure a tftp server.

Related Articles

Leave a Comment

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More