Setting up PXE/BIOS/EFI64 & BOOTP

Requirements

Slackware

ls -lF /var/log/packages/{dhcp-,tftp-hpa-}*

and see syslinux to avoid 14.2/v4.07 and rather get a recent version

ls -lF /var/log/packages/syslinux-*
removepkg syslinux

Debian/Ubuntu,

apt install isc-dhcp-server tftpd-hpa tftp inetutils-inetd pxelinux nginx
#tftp client conflicts with tftp-hpa

RHEL,

yum install dhcp syslinux tftp-server

DHCPD

See Setting up DHCPD

TFTP

ls -lhd /tftpboot/
#ls -lhd /var/lib/tftpboot/
#ln -s var/lib/tftpboot /tftpboot

Default locations:

Slackware,

mv -i /etc/inetd.conf /etc/inetd.conf.dist
grep '^# tftp' /etc/inetd.conf.dist | sed 's/^# //' > /etc/inetd.conf

for the record, the content will be,

tftp  dgram   udp     wait    root    /usr/sbin/in.tftpd  in.tftpd -s /tftpboot -r blksize

chmod +x /etc/rc.d/rc.inetd
/etc/rc.d/rc.inetd restart

Ubuntu,

ls -lhF /usr/sbin/in.tftpd
cp -pi /etc/default/tftpd-hpa /etc/default/tftpd-hpa.dist
vi /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftpboot"
TFTP_ADDRESS=":69"
TFTP_OPTIONS="-l -s"
RUN_DAEMON="yes"

Devuan with IPv6 disabled at boot time,

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="-4 --secure"

RHEL,

vi /etc/xinetd.d/tftp

disable = no

PXE bootloader

locate pxelinux.0
locate ldlinux.c32
locate menu.c32
locate libutil.c32
locate memdisk

locate syslinux.efi
locate ldlinux.e64
locate libutil.c32 | grep efi
locate menu.c32 | grep efi

slackware BIOS

date
ls -lF /usr/share/syslinux/pxelinux.0
ls -lF /usr/share/syslinux/ldlinux.c32
ls -lF /usr/share/syslinux/libutil.c32 #REQUIRED
ls -lF /usr/share/syslinux/menu.c32
ls -lF /usr/share/syslinux/memdisk

mkdir -p /tftpboot/bios/
cp -f /usr/share/syslinux/pxelinux.0 /tftpboot/bios/
cp -f /usr/share/syslinux/ldlinux.c32 /tftpboot/bios/
cp -f /usr/share/syslinux/libutil.c32 /tftpboot/bios/ #REQUIRED
cp -f /usr/share/syslinux/menu.c32 /tftpboot/bios/
cp -f /usr/share/syslinux/memdisk /tftpboot/bios/

slackware EFI64

date
ls -lF /usr/share/syslinux/efi64/syslinux.efi
ls -lF /usr/share/syslinux/efi64/ldlinux.e64
ls -lF /usr/share/syslinux/efi64/libutil.c32 #REQUIRED
ls -lF /usr/share/syslinux/efi64/menu.c32

mkdir -p /tftpboot/efi64/
cp -f /usr/share/syslinux/efi64/syslinux.efi /tftpboot/efi64/
cp -f /usr/share/syslinux/efi64/ldlinux.e64 /tftpboot/efi64/
cp -f /usr/share/syslinux/efi64/libutil.c32 /tftpboot/efi64/ #REQUIRED
cp -f /usr/share/syslinux/efi64/menu.c32 /tftpboot/efi64/
chmod -x /tftpboot/efi64/syslinux.efi

slackware EFI32

date
ls -lF /usr/share/syslinux/efi32/syslinux.efi
ls -lF /usr/share/syslinux/efi32/ldlinux.e32
ls -lF /usr/share/syslinux/efi32/libutil.c32 #REQUIRED
ls -lF /usr/share/syslinux/efi32/menu.c32

mkdir -p /tftpboot/efi32/
cp -f /usr/share/syslinux/efi32/syslinux.efi /tftpboot/efi32/
cp -f /usr/share/syslinux/efi32/ldlinux.e32 /tftpboot/efi32/
cp -f /usr/share/syslinux/efi32/libutil.c32 /tftpboot/efi32/ #REQUIRED
cp -f /usr/share/syslinux/efi32/menu.c32 /tftpboot/efi32/
chmod -x /tftpboot/efi32/syslinux.efi

ubuntu BIOS

ll /var/lib/tftpboot/
ll /usr/lib/syslinux/modules/bios/

cp -f /usr/lib/syslinux/modules/bios/pxelinux.0 /tftpboot/
cp -f /usr/lib/syslinux/modules/bios/ldlinux.c32 /tftpboot/
cp -f /usr/lib/syslinux/modules/bios/menu.c32 /tftpboot/

ubuntu EFI64

ls -lF /usr/lib/syslinux/modules/efi64/

efi64/syslinux.efi
efi64/ldlinux.e64
efi64/libutil.c32
efi64/menu.c32

Setup

mkdir -p /tftpboot/bios/pxelinux.cfg/
mkdir -p /tftpboot/efi64/pxelinux.cfg/
ln -s ../../default /tftpboot/bios/pxelinux.cfg/default
ln -s ../../default /tftpboot/efi64/pxelinux.cfg/default

vi /tftpboot/default

default menu.c32
prompt 0
menu title PXE/BIOS/EFI64

label slackware142 install
        kernel slackware142/kernels/huge.s/bzImage
        append initrd=slackware142/isolinux/initrd.img vga=791

label netbsd install
        kernel pxeboot_ia32.bin

label openbsd install
        kernel pxeboot.bin

now enable Client System Architecture and restart DHCPD

HTTP & NFS

Slackware, using HTTP,

slackpkg install thttpd
cp /etc/thttpd.conf /etc/thttpd.conf.dist           
vi /etc/thttpd.conf

#host=localhost

dir=/tftpboot

thttpd -C /etc/thttpd.conf
ps auxww | grep thttpd

#ldd /usr/lib64/libgd.so
#slackpkg install nginx

Slackware, using NFS,

mv /etc/exports /etc/exports.dist
vi /etc/exports

/tftpboot       x.x.x.x/24(ro,root_squash,async,subtree_check)

exportfs -ra

Ubuntu, using HTTP,

apt install nginx
cp -pi /etc/nginx/sites-available/default /etc/nginx/sites-available/default.dist
vi /etc/nginx/sites-enabled/default

#listen [::]:80 default_server;

#root /var/www/html;
root /tftpboot;
autoindex on;

Kernels and Repositories

Proceed with further ado over there (look for pxe.* guides)

Remote Acceptance

dhcpd

dhclient -v NIC

tftpd

cd ~/
tftp PXE-SERVER-ADDRESS

get pxelinux.0
^D

ls -l pxelinux.0

http

curl -s PXE-SERVER-ADDRESS

iPXE

You can validate with VirtualBox and here’s a draft to try it out with QEMU instead

ip tuntap add tap0 mode tap
brctl addif xenbr0 tap0
qemu-system-x86_64 -net nic,model=virtio,macaddr=00:00:00:00:00:01 -net tap,ifname=tap0

brctl delif xenbr0 tap0
ip tuntap del tap0 mode tap

Beware NetBSD tftp client and iPXE don’t understand each other

Operations

tail -n0 -F /var/log/* /var/log/*/*

Slackware,

pkill thttpd
/etc/rc.d/rc.inetd stop
pkill dhcpd

dhcpd -q NETIF1 NETIF2
/etc/rc.d/rc.inetd start
/usr/local/sbin/thttpd -C /etc/thttpd.conf

pgrep -a dhcpd
pgrep -a inetd
pgrep -a thttpd

Debian/Ubuntu,

systemctl stop nginx
systemctl stop tftpd-hpa
systemctl stop isc-dhcp-server

systemctl start isc-dhcp-server
systemctl start tftpd-hpa
systemctl start nginx

systemctl status isc-dhcp-server
systemctl status tftpd-hpa
systemctl status nginx

RHEL,

systemctl restart dhcpd

resulting processes on Ubuntu,

dhcpd -user dhcpd -group dhcpd -f -4 -pf /run/dhcp-server/dhcpd.pid -cf /etc/dhcp/dhcpd.conf
/usr/sbin/in.tftpd --listen --user tftp --address :69 -l -s /tftpboot

resulting processes on Devuan,

/usr/sbin/dhcpd -4 -q -cf /etc/dhcp/dhcpd.conf
/usr/sbin/in.tftpd --listen --user tftp --address 0.0.0.0:69 -4 --secure /tftpboot

Misc

improved layout

ui menu.c32
prompt 0
menu title PXE
timeout 100
default ...

#path lib/

sub-menus

label bsd
        kernel menu.c32
        append pxelinux.cfg/bsd

label linuces
        kernel menu.c32
        append pxelinux.cfg/linuces

label ghost & rescue
        kernel menu.c32
        append pxelinux.cfg/ghostrescue

label obsolete
        kernel menu.c32
        append pxelinux.cfg/obsolete

label dos
        kernel menu.c32
        append pxelinux.cfg/dos

And the sub-menus may also have a title

vi /tftpboot/pxelinux.cfg/linuces

menu title GNU/Linux

vi /tftpboot/pxelinux.cfg/bsd

menu title BSD

More

#meminfo.c32

this sometimes fails, I prefer to avoid it

#label exit
#        localboot 0

Resources

PXELINUX https://wiki.syslinux.org/wiki/index.php?title=PXELINUX

How to install PXE Server on Ubuntu 16.04 https://www.ostechnix.com/how-to-install-pxe-server-on-ubuntu-16-04/

DisklessUbuntuHowto https://help.ubuntu.com/community/DisklessUbuntuHowto

PXE-netboot-install https://wiki.ubuntu.com/UEFI/PXE-netboot-install

PXEInstallServer https://help.ubuntu.com/community/PXEInstallServer

Howto do QEMU full virtualization with bridged networking https://ahelpme.com/linux/howto-do-qemu-full-virtualization-with-bridged-networking/

Directives/path https://wiki.syslinux.org/wiki/index.php?title=Directives/path

PXELINUX-Multi-Arch https://wiki.syslinux.org/wiki/index.php?title=PXELINUX-Multi-Arch

Library modules https://wiki.syslinux.org/wiki/index.php?title=Library_modules

UEFI https://wiki.syslinux.org/wiki/index.php?title=Install#UEFI

Need explanations about server-name, next-server… https://lists.isc.org/pipermail/dhcp-users/2007-March/003089.html


Nethence | Pub | Lab | Pbraun | SNE Russia | xhtml