deploying iPXE server in a SmartOS zone

PXE Booting SmartOS from a SmartOS zone

Here's how to set up a simple PXE server in a SmartOS zone that will serve up SmartOS

imgadm update

imgadm import 62f148f8-6e84-11e4-82c5-efca60348b9f /* latest base64 14.3.0 image

create ipxe-server-14.3.0.json with following:

Zone Configuration

{ "brand": "joyent",
"zfs_root_compression": "lz4",
"image_uuid": "62f148f8-6e84-11e4-82c5-efca60348b9f",
"alias": "ipxe-server-14.3.0",
"hostname": "ipxe-server",
"max_physical_memory": 128,
"quota": 2,
"dns_domain": "",
"resolvers": ["", "", ""],
"maintain_resolvers": "true",
"nics": [
{ "nic_tag": "admin", "mac": e2:c5:75:a0:53:e7, "ip": "", "netmask": "", "gateway": "", "dhcp_server": "1", "allow_ip_spoofing": "true" }
"filesystems": [
{ "type": "lofs", "source": "/var/setup-v6", "target": "/opt/setup-v6" } ] }

vmadm validate create -f ipxe-server-14.3.0.json

vmadm create -f ipxe-server-14.3.0.json

Setting up TFTP

Use zlogin to log into the zone:

zlogin <uuid>

In the zone:

pkgin -y up pkgin -y in tftp-hpa

mkdir /tftpboot

echo "tftp dgram udp wait root /opt/local/sbin/in.tftpd in.tftpd -s /tftpboot" > /tmp/tftp.inetd

Check if inetd is already running, if not start it.

svcs inetd

STATE STIME FMRI online 23:21:29 svc:/network/inetd:default

inetconv -i /tmp/tftp.inetd -o /tmp

Setting up DHCP (using Dnsmasq)

pkgin -y in dnsmasq

Edit /opt/local/etc/dnsmasq.conf


svcadm enable dnsmasq

Setting up the tftpboot directory

Ben Rockwood provides a version of undionly.kpxe on his site. Run the following to get the PXE chainload binaries in place:

cd /tftpboot

curl > undionly.kpxe

At this point a generic PXE boot server is complete. iPXE will still expect smartos.ipxe, but that can be created with whatever content is needed. For those interested in booting SmartOS, what follows are the steps to provide SmartOS boot services on this server.

Providing SmartOS PXE Boot Services

A template iPXE config is useful both upfront and when updating to new platform releases. Create /tftpboot/smartos.ipxe.tpl with the following content (-B smartos=true is essential, otherwise logins will fail):



kernel /smartos/$release/platform/i86pc/kernel/amd64/unix -B smartos=true
initrd /smartos/$release/platform/i86pc/amd64/boot_archive

cd /tftpboot

mkdir smartos

Deploy/Update to the latest SmartOS platform release

The steps in this section work for both initial deployment and upgrades as Joyent releases them.

Next get the latest SmartOS platform and massage it into a workable shape for our iPXE config:

cd /tftpboot/smartos

curl > /var/tmp/platform-latest.tgz
(Just now URL is invalid, 404… )

cat /var/tmp/platform-latest.tgz | tar xz

directory=ls | grep platform- | sort | tail -n1


mv $directory $release

cd $release

mkdir platform

mv i86pc platform

cd /tftpboot

cat smartos.ipxe.tpl | sed -e"s/\$release/$release/g" > smartos.ipxe

Make sure PXE boot is enabled and that it is the first in the boot sequence.


Thanks to Alain O'Dea for his notes about his experience in setting up Ubuntu Server 12.04.1 LTS as a PXE server to boot SmartOS and big thanks to Ben Rockwood for creating and maintaining the PXE Booting SmartOS wiki page. Without their instructions I would not have done it.