Intro
PXE (Preboot Execution Environment) Booting, or just Network booting in general is very interesting, at least to me, and a few others. As I believe it was Marty Connor in this awesome video "gPXE: Modern FOSS Network Booting" said that some people get really excited over booting machines over networks (including the Internet!) while others... not so much.
Well, I'm one of those people who gets really excited over the idea of booting machines over a network, and I can't really put my finger on why, it's just awesome to me.
So, I wanted to document the netboot setups that I use at my home, and my work. This entry consists of my home network. My work one, I'll put in another entry (as it's significantly different in it's programming, but does the same functions), and link here.
Now, network booting isn't for everyone, and it doesn't fit every situation, so your mileage will vary greatly.
My home network consists of iPXE, PHP scripting, and separate utilities. All of this is detailed below... so lets begin!
What does this page assume?
- You have a working network
- You control your DHCP Server
- You have control of your DNS server
- You have a working webserver
- Basic understanding of PHP
- Have a basic understand of whats involved with PXE Booting, even if it's skimming over the Wikipedia page
- Have a machine that is capable of picking the network card to boot from, via PXE (On most Dell systems, you need to go into the BIOS, Integrated Peripherals, and mark the NIC as "On W/ PXE", not just "On", or "On W/ ImageServer"
My Environment
- Linux, Distro: Gentoo (~AMD64 "Unstable")
- Apache 2.4.3
- PHP 5.4.7
- tftp-hpa 5.2
- iPXE (current GIT master)
- Misc Utilities like Drive Fitness Test, SeaTools, Memtest, etc.
The Basic Process
-- My Setup
- Computer powers on, and selects the NIC to boot from, either via interaction, or it being the first device
- The native PXE Stack (iPXE (flashed onto the ROM/BIOS), Intel, Broadom, Realtek, etc) brings up the network card, does a DHCP Request, while also requesting, at least, options 66 and 67
- DHCP Server responds with an IP, and the two options
- The PXE Stack then tried to contact the server provided in option 66, to retrieve the file specified in option 67, which in this case is iPXE (for non-iPXE clients), over TFTP
- iPXE then unloads the native PXE stack (to a degree), and takes over, issuing it's own DHCP Request, again requesting, among other options, 66 and 67
- The DHCP Server responds with (typically) the same IP address, but now detects that the client is iPXE, and passes a different option 67.
- iPXE then boots to the URL passed in option 67 this time (via HTTP), and that script then directs it what to do.
Files
dhcpd.conf
- This information can be placed globally, specific subnets, or individual filename/next-server can be placed on host definitions
- Relevant sections of my ISC DHCP config:
if exists user-class {
if option user-class = "iPXE" {
filename "http://boot.example.com/preboot.php";
}
} else {
filename "netboot/ipxe.kkpxe";
}
next-server 10.0.3.2;
- This if statement breaks the "infinite loop"
- The filename listed on line 3 is for when iPXE does the DHCP request
- The filename listed on line 6 is for when a non-iPXE client does a DHCP request, to get it to use iPXE.
- The next-server on line 8 is the TFTP server that the non-iPXE clients will grab the above file from