PXE Magic
Kyle Rankin
Sr. Systems Administrator
Quinstreet Inc.
"Pixie?"
- PXE = Preboot eXecution Environment
- Open standard developed by Intel
- Lets you boot an OS from a network card
- Comes on most newer laptops/desktops with integrated NICs
- Not OS-specific
Agenda
In this talk I'll cover...
- How to set up a PXE boot server
- How to PXE boot a client
- How to netboot with a card that doesn't support PXE
- Nifty PXE uses:
- Kickstart
- LTSP (Linux Terminal Server Project)
- Knoppix + clustered Knoppix-based distros
- A few others
- pxelinux Menus
- PXE menus in action
Create a PXE boot server
You need three things:
- DHCP server
- TFTP server
- Boot loader (pxelinux recommended)
Create a PXE boot server
DHCP server
- Any relatively new DHCP server works--use distro package
- Configure DHCP server normally
- Add dynamic-bootp to "range" designation in subnet{}
- then add to the subnet{} (or host{}) section:
next-server ip_of_pxe_server;
filename "pxelinux.0";
For instance:
subnet 10.0.0.1 netmask 255.255.255.0 {
range dynamic-bootp 10.0.0.200 10.0.0.220;
next-server 10.0.0.1;
filename "pxelinux.0";
...
}
Create a PXE boot server
TFTP server
- Install tftp server...
- pxelinux needs a TFTP server that supports the 'tsize' option:
- Create a /tftpboot directory
- Confirm tftpd is running, or enabled in /etc/inetd.conf:
tftp dgram udp wait root /usr/sbin/in.tftpd \
/usr/sbin/in.tftpd -s /var/lib/tftpboot
Create a PXE boot server
Install pxelinux
- Install syslinux (http://syslinux.zytor.com/pxe.php)
- Copy pxelinux.0 to /var/lib/tftpboot
- Copy kernels/initrd files to /var/lib/tftpboot
- Create /var/lib/tftpboot/pxelinux.cfg directory for config files
- Add per-host configuration files in /var/lib/tftpboot/pxelinux.cfg
Create a PXE boot server
/tftpboot/pxelinux.cfg/ config files
- pxelinux config file search order:
- Files labeled 01-MACADDRESS, ie 88:99:AA:BB:CC:DD = 01-88-99-aa-bb-cc-dd
- Files labeled after IP in hex, removing one digit for each failure
- A file named default
- Configuration files use same syntax as syslinux:
default linux
label linux
kernel vmlinuz-centos-3.6
append text nofb load_ramdisk=1 \
initrd=initrd-centos-3.6.img \
network ks=http://10.0.0.1/ks/centos3.cfg
PXE boot a client
- Reboot machine, confirm boot order in BIOS
- Might have to enable Network Boot option in BIOS, then reboot
- Make note of MAC address
Netboot PXE-incompatible NICs
- Etherboot adds PXE boot ROM to a NIC's PROM
- Can also create a PXE boot floppy
- Rom-O-Matic helps you create custom boot ROMs
- NetBoot -- Another ROM kit to create boot ROMs
Kickstart
- Tool to automate RedHat (and RedHat-like) installs
- Debian equivalent = FAI (Fully Automated Installer)
- Configure all install options in advance (or based on a current install)
- Store kickstart configs on a remote http/ftp server and access with boot option ks=
- With PXE boot, no need for boot CD/floppy--just netboot and the kickstart will begin
- Tip: Enabled Spanning Tree Port Fast on your kickstart client's port
- For more info: RHEL Kickstart Guide
LTSP
- Official site: http://www.ltsp.org
- Creates a single Terminal Server multiple thin clients can boot from
- All programs on thin client use server resources (CPU, RAM, disk)
- Great for reusing old computers
Knoppix
- Knoppix has built-in PXE + "terminal server"
- Boot Knoppix on "server" and click K->Knoppix->Services->Knoppix Terminal Server
- Select your network card modules in wizard
- Netboot clients all use the single Knoppix CD
Clustering Knoppix-based distros
Other PXE Uses
- Memtest86+
- Linux/DOS Rescue Disks
pxelinux Menus
- Create a config file named default
- Put display files (f1.msg, etc.) in /var/lib/tftpboot/
- Use syslinux menu syntax to create menu:
default 1
timeout 300
prompt 1
display f1.msg
F1 f1.msg
F2 f2.msg
label 1
kernel vmlinuz-knx3.9
append nfsdir=10.0.0.1:/apt/linux/knoppix/3.9 ...
label 2
kernel vmlinuz-centos-4.3
append ks=http://10.0.0.1/ks/centos4.cfg ...
...
PXE menus in action
Questions?
Some useful links