Setting up PXE/BIOS & PXE/EFI64

pxe tftpd dhcpd advanced client identifier http

Intro

there’s a difference between PXE boot, providing an install media and serving the system live.

Requirements

debian/ubuntu

apt install isc-dhcp-server tftpd-hpa tftp inetutils-inetd pxelinux syslinux-efi
# tftp-hpa nginx

and eventually see thttpd for serving install media

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

rhel

yum install dhcp syslinux tftp-server

TFTP folders

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

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

# seen in /etc/default/tftpd-hpa
rmdir /srv/tftp/
ln -s /tftpboot /srv/tftp

PXE bootloader

updatedb

# bios
locate pxelinux.0
locate ldlinux.c32

# efi64
locate syslinux.efi
locate ldlinux.e64

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/

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

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

TFTP setup

see TFTPD

DHCPD setup

see DHCPD

Ready to go

eventually make sure no firewall is enabled on the PXE server

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

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


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun