PXE Network booting

From LinuxReviews
Jump to navigationJump to search

PXE, short for "Preboot Execution Environment", is a standard for booting clients using an operating system which is physically stored on some other computer on the network. The information required to boot over the network is typically served to the client by a DHCP server and the actual files are usually transferred using tftp.

Basic Example[edit]

There are many software options which can be used to serve PXE clients. dnsmasq is a really easy way to do it. It is available in all the distributions repositories. Install it with apt-get install dnsmasq or dnf install dnsmasq depending on what distribution you are using.

dnsmasq is configured in the file /etc/dnsmasq.conf which can look like this when DHCP, TFTP and PXE booting is configured:

File: /etc/dnsmasq.conf
interface=eth0
dhcp-range=192.168.1.100,192.168.1.200,12h
dhcp-boot=pxelinux.0
enable-tftp
tftp-root=/tftpboot/
dhcp-option=3,192.168.1.1
dhcp-option=6,8.8.8.8,1.1.1.1
  • dhcp-option number 3 specifies the network gateway.
  • dhcp-option number 6 specifies the DNS servers which should be used.*
  • dhcp-boot= and enable-tftp and tftp-root= are the lines are important for serving PXE boot information.

Ensuring there is a image to boot[edit]

You need a special network boot image. Regular ISO images used by GNU/Linux distributions will not work. They typically offer a PXE option for either the installer or a live CD or both. The Debian installation image is available as a PXE capable image. It is named netboot.tar.gz. To enable it:

mkdir -p /tftpboot
cd /tftpboot
wget http://ftp.nl.debian.org/debian/dists/buster/main/installer-amd64/current/images/netboot/netboot.tar.gz
tar zxpf netboot.tar.gz
# rm netboot.tar.gz

Removing the file with rm netboot.tar.gz is optional. You may need it.

See also[edit]