this is obsolete doc -- see http://doc.nethence.com/ instead

NetBSD PXE install server 

 

http://pbraun.nethence.com/unix/sysutils_bsd/netbsd.html 

http://pbraun.nethence.com/unix/sysutils_bsd/netbsd-amazon-ec2.html 

http://pbraun.nethence.com/unix/sysutils_bsd/netbsd-pxe.html 

http://pbraun.nethence.com/unix/sysutils_bsd/netbsd-update.html 

 

introduction 

We are going to use both, SYSLINUX's PXELINUX, and NetBSD's pxeboot. 

 

Note. there's a 'pxe' package available for NetBSD but it has nothing to do with pxelinux nor netbsd's own pxeboot provided binary. 

 

dhcp configuration 

cd /etc/
cp -i /usr/share/examples/dhcp/dhcpd.conf .
cp dhcpd.conf dhcpd.conf.dist
chmod u+w dhcpd.conf
vi dhcpd.conf

 

subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.100 192.168.1.199;
  next-server 192.168.1.1;

 

         # This section allows dhcpd to respond with different answers
         # for the different tftp requests for the bootloader and kernel.
         if substring (option vendor-class-identifier, 0, 20)
           = "PXEClient:Arch:00000" {
             filename "pxelinux.0";
             #filename "pxeboot_ia32.bin";
         } elsif substring (option vendor-class-identifier, 0, 17)
           = "NetBSD:i386:libsa" {
             if filename = "boot.cfg" {
                 filename "tftp:boot.cfg";
             } else if filename = "netbsd" {
                 filename "tftp:netbsd70x64/binary/kernel/netbsd-INSTALL.gz";
             }
         }
}

 

dhcpd -t -cf /etc/dhcpd.conf
vi rc.conf
dhcpd=YES               dhcpd_flags="-q"
/etc/rc.d/dhcpd restart

 

tftp configuration and NetBSD repository 

cd /etc/
cp inetd.conf inetd.conf.dist
vi inetd.conf
tftp            dgram   udp     wait    root    /usr/libexec/tftpd      tftpd -l -s /tftpboot
tftp            dgram   udp6    wait    root    /usr/libexec/tftpd      tftpd -l -s /tftpboot
/etc/rc.d/inetd restart

 

mkdir -p /tftpboot/
cd /tftpboot/
mkdir NetBSD-7.0/
echo $PKG_PATH
pkg_add rsync
rsync -avz rsync://rsync.fr.netbsd.org/NetBSD/NetBSD-7.0/amd64/ NetBSD-7.0/amd64/

Ref. https://www.netbsd.org/docs/network/netboot/tftpd.html 

 

pxelinux configuration 

Fetch the [latest syslinux tarball](https://www.kernel.org/pub/linux/utils/boot/syslinux/) and deploy the needed parts of it, 

cd /tftpboot/
wget --no-check-certificate https://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.03.tar.gz
tar xzf syslinux-6.03.tar.gz
find syslinux-6.03 | grep pxelinux\.0$
cp syslinux-6.03/bios/core/pxelinux.0 .
cp syslinux-6.03/bios/com32/elflink/ldlinux/ldlinux.c32 .
cp syslinux-6.03/bios/com32/libutil/libutil.c32 .
cp syslinux-6.03/bios/com32/menu/menu.c32 .

 

netbsd pxe configuration 

cp -vp /usr/mdec/pxeboot_ia32.bin /tftpboot/
installboot -v -e -o bootconf,modules /tftpboot/pxeboot_ia32.bin
vi /tftpboot/boot.cfg

 

default=1
timeout=10
clear=1

 

banner=Welcome to the NetBSD PXE Installer
banner===============================================================================
banner=
banner=ACPI (Advanced Configuration and Power Interface) should work on all modern
banner=and legacy hardware. However if you do encounter a problem while booting,
banner=try disabling it and report a bug at http://www.NetBSD.org/.

 

menu=Drop to boot prompt:prompt
menu=Install NetBSD/amd64 7.0:boot tftp:netbsd70x64/binary/kernel/netbsd-INSTALL.gz
menu=Install NetBSD/amd64 5.2:boot tftp:netbsd52x64/binary/kernel/netbsd-INSTALL.gz
menu=Install NetBSD/i386 5.2:boot tftp:netbsd52x32/binary/kernel/netbsd-INSTALL_FLOPPY.gz

ref. http://connect.ed-diamond.com/GNU-Linux-Magazine/GLMF-166/Creation-d-un-serveur-de-demarrage-PXE-sous-NetBSD-pour-installer-NetBSD 

also worth interesting (older releases), 

  menu=VESA:rndseed /var/db/entropy-file;vesa 1024x768;boot netbsd 

 

You are ready to go, you should be able to PXE boot from now on. But you will also need either an FTP, HTTP or NFS service to fetch the binary sets. 

 

Setting up the HTTP service 

echo $PKG_PATH
pkg_add thttpd
cd /etc/rc.d/
cp -i /usr/pkg/share/examples/rc.d/thttpd .
cd /etc/
vi rc.conf
thttpd=YES
cd /etc/
ln -s ../usr/pkg/etc/thttpd.conf
cp thttpd.conf thttpd.conf.dist
vi thttpd.conf
dir=/tftpboot
chroot
/etc/rc.d/thttpd restart

check in a browser, 

http://192.168.1.1/

 

References 

http://connect.ed-diamond.com/GNU-Linux-Magazine/GLMF-166/Creation-d-un-serveur-de-demarrage-PXE-sous-NetBSD-pour-installer-NetBSD