Skip to main content

Using your MacBookPro to PXEBoot OpenBSD

This post does not show a successful outcome in case that’s what you where hoping for.

I was trying to get OpenBSD bootstrapped using the PXEBoot NIC in a server. I decided to use my Mac which has tftp and bootpd installed. This post is quite in depth and technical so if you are game then read on.

The quick and short of it was I turned it all on, and copied my pxeboot image, like this from the Terminal:

sudo apachectl start<br /> sudo service tftp start<br /> sudo cp /Library/WebServer/Documents/pub/OpenBSD/4.4/i386/pxeboot /private/tftpboot/<br />

Then I neeed to setup the bootp server which comes with Internet Sharing. The idea was to add the pxeboot filename needed by OpenBSD (the file copied to tftpboot above) to the bootp (AKA dhcp) server options. The important file here is /etc/bootpd.plist. If this file doesn’t exist when Internet Sharing starts then bootpd will create it, removing it when it stops. But courtesy of Jules.FM “if the file already exists when it starts, the Mac will leave it alone and not overwrite or remove it”. So to add new dhcp options you perform these steps:

  1. Start Internet Sharing
  2. Copy the file somewhere safe: “cp /etc/bootpd.plist /tmp/
  3. Stop Internet Sharing
  4. Edit /tmp/bootpd.plist
  5. Add your required options
  6. Copy the file back in place: “sudo cp /tmp/bootpd.plist /etc/
  7. Start Internet Sharing

Since the Mac bootpd.plist file has no option for “filename” documented and since there appears to be a bug in the bootpd implementation with respect to supplying dhcp_options I added these data options to the bootpd.plist file:
<br /> <key>dhcp_option_66</key><br /> <data><br /> wKgCAQ==<br /> </data><br /> <key>dhcp_option_67</key><br /> <data><br /> cHhlYm9vdA==<br /> </data><br /> <key>dhcp_option_93</key><br /> <data><br /> AA==<br /> </data><br />

In RFC2132 (Paragraphs 9.4 and 9.5) it specifies that options 66 and 67 are for the tftp server and boot filename. However the bootpd bug meant I had to encode the string “pxeboot” to hexadecimal “0x707865626F6F74” then Base64 encode it being “cHhlYm9vdA==” and that is way too time consuming to stuff around and try something else everytime the tftp file retrieval fails.

Don’t try using the dhcp_option_66 I had either as it is an encoded IP of my tftp server, not yours.

I got it all going, and the MacBookPro worked as planned, but the bootp server offered a filename of “pxeboot” and the silly Intel 10/100 card decided to fail due to missing files on the tftp server. Many hours later and I figured I should use a network sniffer instead of trying to turn on tftpd logging.

A packet dump showed \377 or 0xff being appended to the filename by the boot client (intel Nic on remote server) when using tftp to request the file. This made the filename “pxeboot” look like “pxeboot\377” in Wireshark’s view of the packet, as discussed here by other pioneers in netbooting.

If I get a full working implementation of dhcpd/tftp/pxe using the Mac – and actually working independent of the intel nic problem on the server, I’ll update this entry or write a complete run down.

Don’t hold your breath though. I rebuilt the OpenBSD server using bsd.rd (being a ramdisk installation) so my need is no longer a driver.