Diskless VMs with bhyve(8) and iPXE

Here’s a quick writeup of how I got iPXE to work nearly out-of-the-box with bhyve.


Configuring inetd can be a PITA, so I just installed tftpd-hpa. Feel free not to be lazy.

pkg install tftpd-hpa
sysrc tftpd_enable=YES
service tftpd start
mkdir /usr/local/tftp/

Installing iPXE

I installed the iPXE packages built with the iPXE port and linked them into the tftp root:

pkg install ipxe
ln -s /usr/local/share/ipxe/{undionly.kpxe,ipxe.efi-x86_64} /usr/local/tftp/

Or you can just use this useful site, if you can live with not knowing what it gives you


I’m using the ISC DHCP server, installed via pkg install isc-dhcp44-server. Version 4.4 was current at the time of writing, it may not be anymore when you read this.

This snippet might be useful in your /usr/local/etc/dhcpd.conf:

option client-arch code 93 = unsigned integer 16;

if exists user-class and option user-class = "iPXE" {
  filename "http://my.web.server/real_boot_script";
} else {
  if exists client-arch {
     if option client-arch = 00:00 {
       filename "undionly.kpxe";
     } elsif option client-arch = 00:07 {
       filename "ipxe.efi-x86_64";
     } elsif option client-arch = 00:09 {
       filename "ipxe.efi-x86_64";

Otherwise, just read the isc-dhcp sample configuration, it’s pretty self-explanatory. The client VM has to get an IP address and be on a bridge with the host. Your bhyve management frontend will most likely take care of this, and bringing up the tap device for the VM.

Use whatever you may find here at your own risk. This is my personal collection of things I feel may be useful to others but there are no guarantees, no warranties nor any form of support. See the FAQ for details.