After basic configuration of "Diskless Operation with PXE" on FreeBSD (https://www.freebsd.org/doc/handbook/network-diskless.html), I wanted to build config, so that specific machines get specific IPv4 address, and specific rootfs location on tftp server, so that I can have multiple root's on one hard-drive. After a couple of hours (two days really) reading manpage, searching internet and testing random configuration methods, I finally got it. Here's how to.
isc-dhcp44-server
package instead of isc-dhcp43-server
/usr/local/etc/dhcpd.conf
isc-dhcpd
option domain-name "example.org";
option domain-name-servers ns1.example.org, ns2.example.org;
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet 192.168.0.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
option routers 192.168.0.1;
option broadcast-address 192.168.0.255;
option domain-name-servers 192.168.0.1;
option domain-name "example.com";
next-server 192.168.0.1;
host server01 {
hardware ethernet 08:00:27:13:6B:19;
fixed-address 192.168.0.20;
filename "FreeBSD/server01/boot/pxeboot";
option root-path "192.168.0.1:/b/tftpboot/FreeBSD/server01/";
}
host server02 {
hardware ethernet 08:00:27:13:6B:1A;
fixed-address 192.168.0.21;
filename "FreeBSD/server02/boot/pxeboot";
option root-path "192.168.0.1:/b/tftpboot/FreeBSD/server02/";
}
}
host
needs to be in subnet
, else isc-dhcpd will throw "Not configured to listen on any interfaces" errorsubnet
, and is upbase/conf
after modifying rootfs. (look FreeBSD Handbook, after step 13)
# mount cdrom
mount_cd9660 /dev/cd0 /mnt
# copy needed sets
cp /mnt/usr/freebsd-dist/{base,kernel,lib32}.txz /b
# create root directory
mkdir /b/tftpboot/FreeBSD/install
cd /b/tftpboot/FreeBSD/install
# untar them
tar xvf /b/base.txz
tar xvf /b/kernel.txz
tar xvf /b/lib32.txz
# unmount cd
umount /mnt