How does Bare metal provisioning to clients work with PXE

Solution 1:

First thing to understand: PXE stands for Preboot Execution Environment. That alone should clear up things a bit.

I will limit myself to systems using this PXE stuff. There might be other methods, but I'll just mention PXE.

Is a re-image task 'pushed' from a server to clients while they are turned on using client software built into the OS?

No. PXE starts during boot - basically the system can load an OS from the network instead of from the disks.

How does pushing images work if the OS gets corrupted and the base OS that receives the imaging task does not boot? What about bare metal. Presumably some sort of DHCP to boot from a PXE Server is required. Does this mean that you manually have to change the boot order of the clients from the disk, to network boot to allow to pxe boot?

From a pure PXE view, the state of the installed OS is not important, as it won't be used during the process. However, your install might fail anyway if your installation processs needs to command the installed OS to restart and it doesn't react.

What exactly would you pxe boot into? Presumably some sort of pre-environment that then pulls a base image from a network share and installs that?

Exactly.

What happens if you want to support pxe booting multiple images? For example a base windows image and a base linux image. Do you then manually have to go around each system and select the image to boot? this sounds difficult with large deployments. eg, is it possible to say MAC address X should be linux, address Y is windows?

I guess that would depend on the deployment software, but most systems allow to specify exactly which system gets which image, often based on the MAC address of the NIC. Some display menus if the system is unknown to them to allow choosing an OS.

Solution 2:

The Wikipedia article on PXE is good start.

PXE boot is mostly a pull mechanism IMHO and not a push mechanism.

The PXE environment is built into the firmware of the network card. When enabled on every reboot the NIC will issue a DHCP request to get network settings, before the system tries booting from other media.

When the DHCP server determines that the DHCP request is in fact a PXE boot request it may simply treat it as a normal DHCP request, which instructs the NIC in turn to instruct the BIOS fall back on the next available boot method and typically the system would continue to boot from local disk. Alternatively when new images need to be deployed, the DHCP server will respond with the location of TFTP server and instructs the PXE boot client in the NIC to go and look for a boot image there. Then rather than booting from local disk a boot image will be loaded from the network with TFTP.

As with all things related to DHCP the only way to identify the system that is PXE booting is from the MAC address.

IIRC typically the approach is to have the PXE enabled NIC load a generic boot image as the first stage, such as pxelinux, which in turn can do more advanced stuff while interacting with you (such present you with a menu of different boot images) or while interacting with the imaging server.