Articles

An introduction to PXE booting

This document is currently under construction, in draft form.  Please forgive the mess!

What is PXE?

PXE is short for Preboot Execution Envionment. A short and simple explanation of PXE is that it allows you to boot a computer over a network without requiring a harddrive or cdrom. You can do this with as few as 2 computers (1 server, 1 client) or you can do it with as many as can get your hands on.


Reasons for PXE booting:

$43.99 8 gb ssd

$14.99 40 gb ultra ata

$17.94 39 gb sata

$4 to $20 cdrom device

These prices are from pricewatch night of June 11, 2011.

So if we are setting up a network with 101 computers(1 server, 100 clients) we could potentially save (100 X (cost of harddrive)) + (100 X (cost of cdrom)). And those were the cheapest data storage devices I could find. Other good reasons to mess around with PXE are that it is fun and you can learn more. One last great advantage of PXE booting is that you can have all of your configuration stored on one machine. This means you can spend less time running around to resolve software issues.


Setting up for PXE booting:

Server Side:

Your server will need to do a couple of things. Typically it hosts DHCP (Dynamic Host Configuration Protocol). If you are thinking, "I already have dhcp provided by my router!", please know that this is insufficient, as you will most likely be unable to configure the path for the network bootstrap program. Also there is a tftp (Trivial File Transfer Protocol) which needs to be set up. This tftp hosts the kernel and whatever else you decide to put there. The PXE firmware usually asks for this network bootstrap program. Luckily, Porteus has all of this taken care of for us -- it will automatically configure all of this for you when you select the PXE boot option from the boot menu.

Client side:

In the past, you needed a simple "PXE boot disk" in order to boot a computer over PXE. Now most motherboards with integrated network adapters allow for booting directly over a network adapter. You can find out how to enable network booting in the motherboard manual that usually comes with the computer. If you don't have access to the manual, just scan around in the BIOS settings. You will be looking for two things: one says "Enable Network Boot:" with an enable/disable switch. It might be worded a little differently. This option needs to be enabled. Then you go to the boot options. Now that network boot is enabled you can see it in the list with cdrom, floppy, and harddrive. Now we put it as the #1 boot option,(save and exit) then restart your computer. You could also get a network adapter that is capable of booting over the network without support from your BIOS. If this is the case for you, then set all the boot options in the BIOS to pass or disable all of your boot devices so that the BIOS will pass the boot process to the rest of the hardware in your computer. Sometimes the network bootable Ethernet adapter can be seen by the BIOS and you will be given the option to select it in the boot options.


NOTE:
If your computer doesn't have the network boot option enabled, check out http://etherboot.org. This is a wonderful resource on non proprietary PXE roms. Some other cool stuff which is similar to PXE booting can be found at http://boot.kernel.org, where you can boot your computer over the internet instead of the ethernet. This is very slow due to bandwidth issues but it's fun to mess arround with.


Steps to use PXE booting in Porteus:

As described above, there is a lot of configuration that needs to take place before you just flip a couple of switches and have everything up and running smoothly. You need to have the Server setup and configured properly (this is taken care of by Porteus), you must have all of the clients configured to boot properly over the network (as described above), and you have to have the ethernet cables all plugged in properly.

Once you have your everything set up, you need to boot Porteus on the computer that will be acting as your server, using the PXE boot option. If you didn't select this option when you boot up your server then you can manually start the PXE initialization script (/opt/porteus-scripts/pxe-boot) to configure the server. Once you've got your server running, then you can power on your client(s). Typically (on the clients), when configured properly, you will have a bootmenu when you power up, where you select the kernel+cheatcodes. Once you select your boot parameters and press enter, Porteus will be loaded to the client from the server and started up.

((Question - if you boot with the standard '/boot/pxelinux.cfg/default' included in the ISO, the prompt is set to 0, does this mean you will not have an opportunity to enter cheatcodes or select your boot mode? If that is the case, then I can include instructions from this doc to add 1 to prompt, allowing clients to pick which boot option to select))


A more in-depth explanation of this process:

1) On the server side, Porteus must be started from CD, USB, Hard drive, etc., with the 'Porteus as a PXE server' boot menu option in syslinux (or you can start it with any other mode and then start the 'pxe-boot' script manually)

2) The 'pxe-boot' script launches the http server ('Monkey' in 32bit and 'webfsd' in 64bit) and dhcp + tftp (which is done by the dnsmasq utility). Once the http server is started you can monitor all of the files that the server is hosting by typing your IP address into firefox or some other browser. You should see the /porteus folder there.

3) At this stage the client can be started with the 'boot over network' option enabled in your BIOS settings.

4) After powering on, the client searches for an IP address from the server and the pxelinux.0 network bootstrap program (/boot/pxelinux.0 on the server side). Pxelinux.0 then starts downloading vmlinuz + initrd.xz with all your cheatcodes from the server.

5) After the kernel and initrd are unpacked, linuxrc checks /proc/cmdline for the IP address assigned by dnsmasq and if it is found, then linuxrc launches the 'httpfs' utility which mounts /porteus/base (with all modules) from the http server inside the ram disk.

6) Now booting continues as in normal CD/USB scenario.

 

NOTE: If you have a specific question regarding this topic feel free to ask it on this thread. I will answer to the best of my ability. Also, the first time I ever put together a PXE server I was running an open-mosix cluster. All my clients were just motherboard, CPU, RAM, and power supply. After the BIOS's on those clients were configured I did not have any need for a monitor, keyboard or any other attached device. My PXE server was also running an open-mosix kernel and I was able to use the CPU's and RAM of all clients as if they existed within the server.