PXE BOOTING – How Network Booting works in Linux
Pixie or PXE booting is booting systems without a hard-drive, using RAM and a Network card. So how do we do this? Home routers won’t work, as you need a second DHCP function which does not conflict with existing DHCP servers.
Step 1 – PXE Capable Router & Client is needed
A home router won’t be able to PXE boot, as it needs to be able to operate 2 DHCP servers, a standard and an extended DHCP server – with extra pixie options.
Step 2 – Client sends the DHCP DISCOVER to Port 67
The client sends a DHCP DISCOVER packet extended with PXE options is sent to UDP port 4011 or UDP port 67.
Step 3 – Contact the “next server” by IP address
The client connects to the server that gave it the DHCP lease…. OR
If the “next-server” parameter is set, it will download from the IP set as the “next server” – ensure an IP not a hostname is used.
Step 4 – DHCP OFFER from server
The extended DHCP Offer replies to the client on UDP port 68.
DHCP is set up in the /etc/dhcp.conf
/etc/dhcp.conf can be configured to hand out pixie boot IP’s for a single IP, MAC or an entire subnet.
We need to look closely at 2 pixe specific sections…. SUBNET block and HOST block.
The Host block has 2 pixie specific parameters, “filename” and “next-server” 192.168.0.1
The “next-server” must be an IP address. If the “next-server” is omitted then it should default to the IP of the DHCP server, however there is a hiccup. Some motherboards will send packets to 0.0.0.0 if the “next-server” IP is missing.
This host block is for a single hardware MAC 00:0c:6E:64:D8:B4
We can set the IP to boot on an entire subnet.
The “filename” sets the file to be downloaded ie “pxelinux.o” in the above example.
Step 5 – Network Bootstrap attempts to Download file using TFTP
The PXE client attempts to download the specified file in Step 2 using TFTP.
It then executes this file.
PXE Stack before booting and after booting