In the course of installing Debian Linux on an ALIX.2D3 system I needed to setup a Preboot eXecution Environment (PXE) and all I had to hand was a MacBook. This is how I did it.
There are two elements of the PXE boot, the DHCP server and the TFTP server. DHCP tells the client where to find the network bootstrap program and it then retrieves it using TFTP.
To configure the Mac OS DHCP server you will need to edit /etc/bootpd.plist
The options I used are below:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Subnets</key> <array> <dict> <key>allocate</key> <true/> <key>dhcp_option_128</key> <string>192.168.0.1</string> <key>dhcp_option_66</key> <string>192.168.0.1</string> <key>dhcp_option_67</key> <string>pxelinux.0</string> <key>name</key> <string>My subnet</string> <key>net_address</key> <string>192.168.0.0</string> <key>net_mask</key> <string>255.255.255.0</string> <key>net_range</key> <array> <string>192.168.0.100</string> <string>192.168.0.199</string> </array> </dict> </array> <key>bootp_enabled</key> <true/> <key>dhcp_enabled</key> <true/> <key>netboot_enable</key> <true/> </dict> </plist>
dhcp_option_66 is the TFTP Server Name
dhcp_option_67 is the Boot File Name
dhcp_option_128 is TFTP Server IP address
I’m not sure which of dhcp_option_66 or dhcp_option_128 is actually being used here, but since they are both the same it doesn’t harm to leave them both in there.
This DHCP server configuration will allocate an IP address to the connected client in the range 192.168.0.100 – 192.168.0.199.
For this to work you will also need to configure your ethernet interface (usually en0) with the static IP address 192.168.0.1.
To start the DHCP server I used ‘/usr/libexec/bootpd -d’ which tells bootp to stay in the foreground and output additional debug information.
Next we will need to configure and start the TFTP server.
For simplicity I used a neat Mac OS application called TftpServer, which is written by Fabrizio La Rosa.
The application lets you configure the TFTP server path as well as checking path permissions and managing the startup and shutdown of the daemon.
With the DHCP and TFTP servers running and the client connected I copied my Debian network bootstrap files to the TFTP path (in my case /private/tftpboot) and then created a few symbolic links:
cd /private/tftpboot ln -s ./debian-installer/i386/pxelinux.0 pxelinux. ln -s ./debian-installer/i386/pxelinux.0 pxelinux.0 ln -s ./debian-installer/i386/pxelinux.cfg pxelinux.cfg
The first symlink is not a typo, it is deliberate. After much trial and error (and ethereal packet sniffing) I discovered that for some reason the requested file kept dropping the trailing zero and so by simply adding the symlink everything worked.
With all this in place I was able to power-on the ALIX.2D3, watch it configure via DHCP and then retrieve and execute the installer.
Please leave a comment if you’ve found any of this useful, that way I won’t feel like I’ve wasted my time writing all this up 🙂