For
balanga
As suggested by
covacat, I use 10.1.1.1 as the tftpd, nfs, and dhcpd server in a /24 subnet. This falls onto the re0 ethernet interface. Unless stated otherwise, all configuration files refer to this 10.1.1.1 host (not the clients).
I have a zfs dataset named zroot/diskless with a mountpoint of /
I have FreeBSD 15.0-RELEASE boot imaged installed there as /diskless/15.0-RELEASE/
Note that the pxeboot file appears as /diskless/15.0-RELEASE/boot/pxeboot
I purposely choose to have tftpd and nfs share an overlapping directory. The pxeboot image might change from one release to the next so the overlap makes life a little is easier to keep the two in sync. Two config changes are required if, for example, I want to switch to 14.3-RELEASE. This also means I can configure isc-dhcpd to dish out different releases to difference MAC addresses.
$ cat /etc/rc.conf
sh:
inetd_enabled="YES"
# isc-dhcpd
dhcpd_enable="YES"
dhcpd_faces="re0"
# nfs
nfs_server_enable="YES"
rcpbind_enable="YES"
mountd_enable="YES"
rpc_lockd_enable="YES"
rcp_statd_enable="YES"
nfs_server_flags="-b 10.1.1.1 -a 10.1.1.0/24"
I have isc-dhcpd limited to the re0 ethernet interface so that it does not touch wlan0. Likewise, I have nfs limited to to same ip and serving only the /24 subnet
$ grep 'tftp' /etc/inetd.conf
sh:
tftp dgram udp wait root /usr/libexec/tftpd tftpd blocksize 1468 -l -s /diskless/15.0-RELEASE
tftp dgram udp6 wait root /usr/libexec/tftpd tftpd blocksize 1468 -l -s /diskless/15.0-RELEASE
One of the man pages suggest the above blocksize. I don't think it helps but neither does it hurt.
For nfs, I have the following /etc/exports file:
sh:
/diskless/15.0-RELEASE -ro -maproot=0 -alldirs -network 10.1.1.0 -mask 255.255.255.0
Here are the relevant bits of /usr/local/etc/dhcpd.conf:
sh:
subnet 10.1.1.0 netmask 255.255.255.0 {
}
group diskless {
next-server 10.1.1.1;
filename "boot/pxeboot";
option root-path "10.1.1.1:/diskless/15.0-RELEASE";
host xxxx {
hardware ethernet xx.xx.xx.xx.xx.xx;
fixed-address 10.1.1.11;
}
host yyyy {
hardware ethernet yy.yy.yy.yy.yy.yy;
fixed-address 10.1.1.12;
}
}
Some minor details on the above configuration file.
(tftp) next-server points to the tftpd server.
(tftp) filename includes a "boot/" prefix so that the tftp clients can request it properly.
(nfs) option root-path includes the IP address prefix.
If I don't want to boot from nfs, I can add a "tftp:" prefix but then I must provide a vfs.root.mountfrom to mount a root file system after the kernel has loaded.
As the last config file to show in this post, I have this in /diskless/15.0-RELEASE/etc/fstab:
sh:
# Device Mountpoint FStype Options Dump Pass#
10.1.1.1:/diskless/15.0-RELEASE / nfs ro 0 0