Setting up PXE/BIOS & PXE/EFI64

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 syslinux-efi nginx
#tftp client conflicts with tftp-hpa

RHEL

yum install dhcp syslinux tftp-server

DHCPD setup

see DHCPD

TFTP folders

this is already the default tftpboot location for Slackware & RHEL6, we’re just separating EFI64 for the one not to override the other.

mkdir -p /tftpboot/pxelinux.cfg/
mkdir -p /tftpboot/efi64/pxelinux.cfg/

special tweak for RHEL7+ & Ubuntu

ls -alF /var/lib/tftpboot/ # no exist
ln -s ../../tftpboot /var/lib/tftpboot

TFTP setup

see TFTP

PXE bootloader

updatedb

locate pxelinux.0
locate ldlinux.c32

locate syslinux.efi
locate ldlinux.e64

slackware BIOS

ls -lF /usr/share/syslinux/

cp -f /usr/share/syslinux/pxelinux.0 /tftpboot/
cp -f /usr/share/syslinux/ldlinux.c32 /tftpboot/
cp -f /usr/share/syslinux/libutil.c32 /tftpboot/
cp -f /usr/share/syslinux/menu.c32 /tftpboot/
cp -f /usr/share/syslinux/memdisk /tftpboot/

slackware EFI64

ls -lF /usr/share/syslinux/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/
cp -f /usr/share/syslinux/efi64/menu.c32 /tftpboot/efi64/
chmod -x /tftpboot/efi64/syslinux.efi

ubuntu BIOS

ls -lF /usr/lib/PXELINUX/
ls -lF /usr/lib/syslinux/modules/bios/

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

cp -f /usr/lib/syslinux/modules/bios/chain.c32 /tftpboot/
cp -f /usr/lib/syslinux/modules/bios/libcom32.c32 /tftpboot/
cp -f /usr/lib/syslinux/modules/bios/pxechn.c32 /tftpboot/

cp -f /usr/lib/syslinux/memdisk /tftpboot/

ubuntu EFI64

ls -lF /usr/lib/SYSLINUX.EFI/
ls -lF /usr/lib/syslinux/modules/efi64/

cp -f /usr/lib/SYSLINUX.EFI/efi64/syslinux.efi /tftpboot/efi64/
cp -f /usr/lib/syslinux/modules/efi64/ldlinux.e64 /tftpboot/efi64/
cp -f /usr/lib/syslinux/modules/efi64/libutil.c32 /tftpboot/efi64/
cp -f /usr/lib/syslinux/modules/efi64/menu.c32 /tftpboot/efi64/

PXE setup

vi /tftpboot/pxelinux.cfg/default

default menu.c32
prompt 0
menu title PXE

and see pxe slackware, pxe netbsd, pxe openbsd, pxe dfly or many others for booting entries.

as for EFI64, we cannot just use an include here, as the path for the kernels would be different

    vi /tftpboot/efi64/pxelinux.cfg/default

    path efi64
    config /tftpboot/pxelinux.cfg/default /tftpboot

Ready to go

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

Slackware

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

    dhcpd -q eth0
# -q NIC1 NIC2
    /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

#ls -lF /var/lib/dhcp/dhcpd.leases
#touch /var/lib/dhcp/dhcpd.leases

#ln -s ../usr.sbin.dhcpd /etc/apparmor.d/disable/usr.sbin.dhcpd
#systemctl restart apparmor

systemctl stop isc-dhcp-server6
systemctl disable isc-dhcp-server6

# PXE-UP
systemctl stop nftables
/usr/local/sbin/thttpd -C /etc/thttpd.conf
systemctl start rpcbind.socket
systemctl start portmap
systemctl start nfs-server
systemctl start tftpd-hpa
systemctl start isc-dhcp-server

# PXE-DOWN
systemctl stop isc-dhcp-server
systemctl stop tftpd-hpa
systemctl stop nfs-server
systemctl stop rpcbind.target
systemctl stop rpcbind.socket
systemctl stop portmap
pkill thttpd
systemctl start nftables

# assuming a workstation
systemctl disable isc-dhcp-server
systemctl disable tftpd-hpa
systemctl disable nfs-server
systemctl disable rpcbind.target
systemctl disable rpcbind.socket
systemctl disable portmap
systemctl enable nftables

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

RHEL

    systemctl restart dhcpd

NetBSD

vi /etc/rc.conf

dhcpd=yes
dhcpd_flags="-q xennet1"

/etc/rc.d/dhcpd start

Acceptance

remote node on the network

dhclient -v NIC

tftp PXE-SERVER-ADDRESS

get pxelinux.0
^D

ls -lF pxelinux.0

Additional notes

qemu

draft

Validate with QEMU instead of VirtualBox

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

chain-load alternative

not required for chain-loading but worth mentioning

label openbsd install
    kernel pxechn.c32
    append ::obsd6/pxeboot.bin

improved layout

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

library path

path efi64

sub-menus

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

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

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

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

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

then (sub-menus can have a title)

vi /tftpboot/pxelinux.cfg/linuces

menu title GNU/Linux

local boot

label exit
    localboot 0

fails as such

No more network devices
FATAL: Couldnot read from the boot medium! System halted.

unused

meminfo.c32

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/

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

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

bootp/dhcp

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

multi-arch

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

Hardcoded options https://wiki.syslinux.org/wiki/index.php?title=PXELINUX#Hardcoded_options –> more DHCP options

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

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

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

notes

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

pxechn.c32 - Chainboot to new Network Boot Program (NBP). https://wiki.syslinux.org/wiki/index.php?title=Pxechn.c32

How to select a boot disk wie pxelinux https://unix.stackexchange.com/questions/291632/how-to-select-a-boot-disk-wie-pxelinux

Serial-PXE-TFTP install of FreeBSD(BSDRP,Xsense,NAS4Free)/OpenBSD/Centos https://blog.cochard.me/2015/06/serial-pxe-tftp-install-of.html –> more on pxechn.c32


GUIDES | LECTURES | BENCHMARKS | SMTP HEALTH