FreeBSD PXE Install Server (HOWTO)


2009/04/06

Howto document that describes how to setup a PXE install environment on FreeBSD.
There are multiple documents around but we didn't find one which had all
the information. This is basically a combined document based on all the
information that we could find. It has been tested on FreeBSD 7.1, booting
multiple servers as well as a Soekris 4801.

Howto document that describes how to setup a PXE install environment on FreeBSD.
There are multiple documents around but we didn't find one which had all the information. This is basically a combined document based on all the information that we could find. It has been tested on FreeBSD 7.1, booting multiple servers as well as a Soekris 4801.

# Fetch the bootonly iso from your FreeBSD local mirror.
fetch ftp://ftp.freebsd.org/pub/FreeBSD/ISO-IMAGES-i386/7.1/7.1-RELEASE-i386-bootonly.iso

# Install the isc-dhcpd.
pkg_add -r isc-dhcp3-server

# Mount the FreeBSD bootonly iso.
mdconfig -a -t vnode -f 7.1-RELEASE-i386-bootonly.iso
mount -t cd9660 /dev/md0 /mnt

# Create a /pxeboot directory and copy the relevant files from the iso.
mkdir -p /pxeboot/boot
cp -rf /mnt/boot/* /pxeboot/boot

# Umount the iso.
umount /mnt
mdconfig -d -u md0

# Insert lines into /etc/rc.conf.
echo 'inetd_enable="YES"' >> /etc/rc.conf
echo 'nfs_server_enable="YES"' >> /etc/rc.conf
echo 'rpcbind_enable="YES"' >> /etc/rc.conf
echo 'dhcpd_enable="YES"' >> /etc/rc.conf

# NFS export for /pxeboot.
echo '/pxeboot -alldirs -maproot=root -ro' >> /etc/exports

# Edit /etc/inetd.conf so that it has a line like:
tftp dgram udp wait root /usr/libexec/tftpd tftpd -l -s /pxeboot

# Create /usr/local/etc/dhcpd.conf with the following config.
allow booting;
allow bootp;
default-lease-time 600;
max-lease-time 7200;
authoritative;
ddns-update-style ad-hoc;
log-facility local7;

option domain-name "example.tld";
option domain-name-servers 192.168.1.2;
server-name "192.168.1.2";
server-identifier 192.168.1.2;
next-server 192.168.1.2;
option routers 192.168.1.2;
option root-path "192.168.1.2:/pxeboot";
filename "boot/pxeboot";

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.11;
}

# Add the following to /pxeboot/boot/loader.conf.
echo 'vfs.root.mountfrom="ufs:/dev/md0c"' >> /pxeboot/boot/loader.conf

# Optionally you can also add the following lines when you want to do a headless install as well.
echo 'console="comconsole,vidconsole"' >> /pxeboot/boot/loader.conf
echo 'comconsole_speed="19200"' >> /pxeboot/boot/loader.conf

# When the headless install is for Soekris you might want to add the following to /pxeboot/boot/device.hints.
echo 'hw.ata.ata_dma="0"' >> /pxeboot/boot/device.hints

# Just to prevent failures when loading mfsroot.
gunzip -d /pxeboot/boot/mfsroot.gz

# Start / Restart all the daemons.
/etc/rc.d/inetd restart
/etc/rc.d/nfsd restart
/usr/local/etc/rc.d/isc-dhcpd restart

WORLD IPV6 LAUNCH is 6 June 2012 - The Future is Forever