From Brandon's Tinkerings
Jump to: navigation, search
(Initial submit of the page.)
 
m (removed extra header)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
<center>'''<big>This is under construction and may not be complete</big>''' </center>
== Intro ==  
== 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 [http://www.youtube.com/watch?v=GofOqhO6VVM 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.
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 [http://www.youtube.com/watch?v=GofOqhO6VVM 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.
Line 359: Line 360:
%>
%>
</syntaxhighlight>
</syntaxhighlight>
=== mainmenu.ipxe ===
<syntaxhighlight lang="text" line="GESHI_NORMAL_LINE_NUMBERS">
ui vesamenu.c32
menu title Network Boot Menu for Work
menu autoboot System will boot to Ghost in # seconds
menu master passwd MasterPassword
menu background backgrounds/pxeboot-800.png
menu resolution 800 600
prompt 0
timeout 1000
menu timeoutrow 99
allowoptions 0
menu rows 25
menu helpmsgrow -1
menu color title  0 #ff00388b #00FFFFFF none 
menu color unsel  0 #ffffffff #88000000 std
menu color sel    0 #ff000000 #88c1c1c1 none
menu color hotkey 0 #ff0067ff #80000000 std
menu color hotsel 0 #ff000000 #88c1c1c1 none
menu color disabled 0 #ff0067ff #88000000 std
Label GhostPE
menu label Ghost Tools / PE Environments:
menu disable
label  PE
menu indent 2
menu label ^1 Ghost PE Boot Disk (08/06/12)
menu default
kernel memdisk
append iso raw
initrd PEBoot-08_06_12.iso
label Alt-PE
menu indent 4
menu label Ghost PEBoot AltBoot (08/06/12)
COM32 linux.c32
APPEND memdisk initrd=PEBoot-08_06_12.iso iso
Label HardDiag
menu label Hardware Diagnostics:
menu disable
label  Memtest
menu indent 2
menu label ^2 Memtest86+ v4.20
kernel memtest86-420
label  DFT
menu indent 2
menu label ^3 Drive Fitness Test v4.16
kernel memdisk
append initrd=dft32_v416_b00_install.IMG floppy
label WDDLD
menu indent 2
menu label ^4 WD Data Lifeguard Diagnostic v5.04f
kernel memdisk
append iso raw
initrd Diag504fCD.iso
label SEATOOLS
menu indent 2
menu label ^5 Seagate Seatools for DOS v2.23
kernel memdisk
append iso raw
initrd SeaToolsDOS223ALL.ISO
label  HDT
menu indent 2
menu label ^6 Hardware Detection Tool
kernel hdt.c32
label  UBCD
menu indent 2
menu label ^7 Ultimate Boot CD v5.1.1
kernel memdisk
append iso raw
initrd ubcd511.iso
label  SpinRite
menu indent 2
menu label ^8 SpinRite v6.0
kernel memdisk
append iso raw
initrd spinrite.iso
label DiskWipe
menu label Disk Utilities:
menu disable
label  QuickWipe
menu indent 2
menu label ^9 Quick Disk Wipe (Default: Disk 0)
kernel memdisk
append floppy initrd=wipe2.img
label  DBAN
menu indent 2
menu label ^0 Darik's Boot And Nuke (DBAN) v2.2.6
kernel memdisk
append iso raw edd=off
initrd dban-2.2.6_i586-fixed.iso
label  SalvationHDD
menu indent 2
menu label ^S Salvation HDD Scan & Restore v3.0
kernel memdisk
append floppy initrd=sal-hdd-sr.img
label  PartedMagic
menu indent 2
menu label ^P Parted Magic
linux pmagic/bzImage
append initrd=pmagic/initramfs edd=off noapic load_ramdisk=1 prompt_ramdisk=0 rw vga=791 loglevel=0 mac_loop=256
label  GParted
menu indent 2
menu label ^G GParted (Gnome Partition Editor)
kernel gparted/vmlinuz
append initrd=gparted/initrd.img boot=live config union=aufs noswap noprompt vga=788 fetch=http://netboot.example.com/gparted/filesystem.squashfs noapic edd=off
label OtherNetboot
menu label Other Netboot Systems:
menu disable
label  Citrix
menu indent 2
menu label ^C Boot to Citrix Provisioning Service (citrix-dp)
com32 pxechn.c32
append 10.133.2.232::ardbp32.bin
label Thinstation
menu indent 2
menu label ^T Thinstation
kernel thinstation/vmlinuz
append initrd=thinstation/initrd  video=uvesafb:1024x768-32,ywrap splash=off console=tty1 loglevel=7 LM=3
label Others
menu label Other Options:
menu disable
label Installers
menu label ^E Installers SubMenu
menu indent 2
kernel vesamenu.c32
append installers.conf
label BIOS
menu disabled
menu label ^B BIOS Updates SubMenu
menu indent 2
kernel vesamenu.c32
append bios/biosupdates.conf
Label Testing
Menu Label ^T Testing SubMenu
menu indent 2
kernel vesamenu.c32
append testing.conf
label  MenuExit
menu indent 2
menu label ^Q Exit Menu System - PXELinux Boot Prompt
menu quit
</syntaxhighlight>
=== installers.conf ===
<syntaxhighlight lang="text" line="GESHI_NORMAL_LINE_NUMBERS">
ui vesamenu.c32
menu title Network Installers Menu for Work
menu master passwd MasterPassword
menu background backgrounds/pxeboot-800.png
menu resolution 800 600
prompt 0
menu timeoutrow 99
allowoptions 0
menu rows 22
menu helpmsgrow -1
menu color title  0 #ff00388b #00FFFFFF none 
menu color unsel  0 #ffffffff #88000000 std
menu color sel    0 #ff000000 #88c1c1c1 none
menu color hotkey 0 #ff0067ff #80000000 std
menu color hotsel 0 #ff000000 #88c1c1c1 none
menu color disabled 0 #ff0067ff #88000000 std
Label VMWare
menu label VMWare Installers:
menu disable
label ESXi5
menu indent 2
menu label ^1 VMWare ESXi HyperVisor 5.1.0
menu default
kernel esxi51/mboot.c32
append -c /esxi51/boot.cfg
label DebianAMD64
menu label ^2 Debian Squeeze AMD64 Netinstall
menu indent 2
kernel debian-installer/amd64/linux
append vga=788 initrd=debian-installer/amd64/initrd.gz
label DebianAMD64Rescue
menu label ^3 Debian Squeeze AMD64 Rescue mode
menu indent 2
kernel debian-installer/amd64/linux
append vga=788 initrd=debian-installer/amd64/initrd.gz rescue/enable=true
label Debiani386
menu label ^4 Debian Squeeze i386 Netinstall
menu indent 2
kernel debian-installer/i386/linux
append vga=788 initrd=debian-installer/i386/initrd.gz
label Debiani386Rescue
menu label ^5 Debian Squeeze i386 Rescue Mode
menu indent 2
kernel debian-installer/i386/linux
append vga=788 initrd=debian-installer/i386/initrd.gz rescue/enable=true
label MainMenu
menu indent 2
menu label ^Q Return to Main Menu
kernel vesamenu.c32
append mainmenu.ipxe
</syntaxhighlight>
=== mainmenu-shd.ipxe ===
<syntaxhighlight lang="text" line="GESHI_NORMAL_LINE_NUMBERS">
ui vesamenu.c32
menu title Network Boot Menu for Work
menu master passwd MasterPassword
menu background backgrounds/pxeboot-800.png
menu resolution 800 600
prompt 0
timeout 1000
menu timeoutrow 99
allowoptions 0
#menu vshift 0
menu rows 23
menu helpmsgrow -1
menu color title  0 #ff00388b #00FFFFFF none 
menu color unsel  0 #ffffffff #88000000 std
menu color sel    0 #ff000000 #88c1c1c1 none
menu color hotkey 0 #ff0067ff #80000000 std
menu color hotsel 0 #ff000000 #88c1c1c1 none
menu color disabled 0 #ff0067ff #88000000 std
Label HardDiag
menu label Hardware Diagnostics:
menu disable
label  Memtest
menu indent 2
menu label ^1 Memtest86+ v4.20
kernel memtest86-420
label  DFT
menu indent 2
menu label ^2 Drive Fitness Test v4.16
kernel memdisk
append initrd=dft32_v416_b00_install.IMG floppy
label WDDLD
menu indent 2
menu label ^3 WD Data Lifeguard Diagnostic v5.04f
kernel memdisk
append iso raw
initrd Diag504fCD.iso
label SEATOOLS
menu indent 2
menu label ^4 Seagate Seatools for DOS v2.23
kernel memdisk
append iso raw
initrd SeaToolsDOS223ALL.ISO
label  HDT
menu indent 2
menu label ^5 Hardware Detection Tool
kernel hdt.c32
label  UBCD
menu indent 2
menu label ^6 Ultimate Boot CD v5.1.1
kernel memdisk
append iso raw
initrd ubcd511.iso
label  Rescue
menu label System Rescue Utilities
menu disable
label  Avira
menu indent 2
menu disable
menu label ^7 Avira AntiVir Rescue System - Currently Broken
kernel memdisk
append iso raw
initrd rescue_system-common-en.iso
label Others
menu label Other Options:
menu disable
label  MenuExit
menu indent 2
menu passwd zaxscd
menu label ^Q Exit Menu System - PXELinux Boot Prompt
menu quit
</syntaxhighlight>
== Resources Used ==
* http://ipxe.org -- iPXE's main site, which contains a ton of information (specifics are linked throughout the entry too)
* http://forum.ipxe.org -- iPXE Forums, Great resource for finding answers, or asking questions.
* http://lists.ipxe.org/pipermail/ipxe-devel/ -- iPXE Mailing List
* http://etherboot.org -- Etherboot/gPXE, iPXE's predecessor. This is what I used when I first setup my netboot, and a lot of the setup came from here.  Other issues aside, iPXE is a fork, and is being updated. Most of the information still applies to iPXE.
* http://www.networksorcery.com/enp/protocol/bootp/options.htm -- General DHCP Options
* http://www.vcritical.com/2011/07/vmware-esxi-5-interactive-pxe-installation-improvements/ -- Linked above, but want to again. This is a good article on how to get ESXi installer to run over PXE.
* I'm sure there have been many over the years. As I come up with more, I will add them.
* https://gist.github.com/2234639 -- Robin Smidsrød's iPXE menu
* http://www.youtube.com/watch?v=GofOqhO6VVM -- Linked above, but linking again, as it's an Awesome presentation!
* http://www.syslinux.org/wiki/index.php/Menu -- Syslinux's Menu documentation
== Fin ==
These files may end up on [https://github.com/bpenglase my github] at some point. If/when they do, I'll note it here.
iPXE is EXTREMELY powerful, especially with the [http://ipxe.org/scripting embedded scripting]. There is so much that can be done, it's hard to go into details, just because what you can do is so vast! A perfect example of this is Robin's iPXE menu linked to above. He does some awesome stuff!
I'm always looking to expand the netboot. Be adding diag utils, playing around with new options, or just plain tweaking it. In the above boot.php, a few of the things I want to tweak, is instead of referencing the name boot.example.com all the time, have it pull the PHP server variable. This way if you have a different hostname internal/external, as long as you set it once (say in a script, or via DHCP), it will always reference that server.
One thing to note with iPXE, is you can also embed the scripts into it. In my work netboot (coming soon!), I embed pxelinux.0 and a small script. This will be explained more in that post, but one thing to note, is you can embed a script that does DHCP, then chains to your server at home. As long as you have external access to that box, and flash the resulting iPXE to a USB drive, or CD, you can boot any machine anywhere in the world.
For contacting myself (for complaints/improvements/suggestions), or others who use iPXE, there is the IRC channel, irc.freenode.net, #ipxe.  I'm pretty much always in there as Sedorox. The developers also hang out there, and other users too, who do all sorts of fun network booting things. Come visit!
Hopefully this helps someone better understand iPXE and netbooting, or at the very least, serves as an example on what you can do.

Latest revision as of 02:19, 17 October 2012

This is under construction and may not be complete

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 work setup. My home setup is detailed here

Now, network booting isn't for everyone, and it doesn't fit every situation, so your mileage will vary greatly.

My work setup consists of iPXE, ASP Scripting, Syslinux, and different 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 ASP
  • 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

  • Windows Server 2008 R2
  • IIS 7
  • Classic ASP Scripting
  • tftpd32 v4.00 (Service)
  • iPXE (current GIT master)
  • Syslinux 4.06_Pre11
  • Misc Utilities like Drive Fitness Test, SeaTools, Memtest, etc.

The Basic Process

-- My Setup

  1. Computer powers on, and selects the NIC to boot from, either via interaction, or it being the first device
  2. 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
  3. DHCP Server responds with an IP, and the two options
  4. 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
  5. 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
  6. The DHCP Server responds with (typically) the same IP address, but now detects that the client is iPXE, and passes a different option 67.
  7. iPXE then boots to the URL passed in option 67 this time (via HTTP), and that script then directs it what to do.

Files

IIS Config

<Place holder for the time being>

TFTPD32 Config

<Place holder for the time being>

preboot.asp

<% 
response.contenttype="text/plain" 
dim mac
dim plembed
dim clientip
dim code
dim code1

' Set code
code = "onereallylongcodethatsrandomlygenerated"

' Set Code1
code1 = "secondreallylongcodethatsrandomlygenerated"

' Set IP Subnets that do not get prompted for login
dim nologinips(1)
nologinips(0) = "10.80.18" ' Subnet for NetApps
nologinips(1) = "10.80.38" ' Subnet in Technicians Office

' Get the client's IP Address
clientip = request.servervariables("REMOTE_ADDR")

' Check to see if the PXE boot thats hitting us is authorized, the boot will embed two random codes
' this is also used to try and hide the user/pass on the command since it's shown in plain text in the URL
' Check Code0
if not request.querystring("code").count = 0 then
	if request.querystring("code") = code then
		' Check Code1		
		if not isEmpty(request.querystring("code1")) then
			if not request.querystring("code1") = code1 then
				' Fail to boot, don't offer login screen again
				response.write("#!ipxe" & vbcrlf & "echo Boot Error Code: Error 001 - This PXEBoot is not authorized." & vbcrlf & "exit 1")
				response.end
			end if
		end if
	else
		' Fail to boot, don't offer login screen again
		response.write("#!ipxe" & vbcrlf & "echo Boot Error Code: Error 002 - This PXEBoot is not authorized."& vbcrlf & "exit 1")
		response.end
	end if
else
		' Fail to boot, don't offer login screen again
		response.write("#!ipxe" & vbcrlf & "echo Boot Error Code: Error 003 - This PXEBoot is not authorized."& vbcrlf & "exit 1")
		response.end
end if

'Get MAC Address into a variable
' This should always be handed over to this script.
If not isEmpty(request.querystring("MAC")) Then
	mac = request.querystring("MAC")
else
	' If no MAC found, it's most likely a bad script, or unauthorized netboot that has somehow gotten this far
	response.write("#!ipxe" & vbcrlf & "echo Boot Error Code: Error 009 - MAC Not listed."& vbcrlf & "exit 1")
	response.end
End If

' Find out of Pxelinux is embedded or not
If not isEmpty(request.querystring("plembed")) Then
	plembed = request.querystring("plembed")
else
	plembed = 0
End If

' Compare the current client IP to IPs we shouldn't prompt for login for
for i=0 to ubound(nologinips)
	if instr(clientip, nologinips(i)) then
		'Perform functions for clients that don't need to be prompted for login
		response.write("#!ipxe"&vbcrlf)
		response.write("echo On IP "&clientip&" -- Bypassing Login, Autologging in as CS."&vbcrlf)
		response.write("chain -ar http://netboot.example.com/boot.asp?MAC="&mac&"&code="&code&"&user=cs&pass=a12345B&plembed="&plembed&"&code1="&code1&vbcrlf)
		response.end
	end if
next
response.write("#!ipxe"&vbcrlf)
response.write("echo On IP "&clientip&" -- Forcing Login."&vbcrlf)
response.write("login"&vbcrlf)
response.write("chain -ar http://netboot.example.com/boot.asp?MAC="&mac&"&code="&code&"&user=${username:uristring}&pass=${password:uristring}&plembed="&plembed&"&code1="&code1&vbcrlf)
response.end

%>

boot.asp

<% 
response.contenttype="text/plain" 
dim mac
dim user
dim pass
dim plembed
dim testing

'Check to see if the PXE boot thats hitting us is authorized, the boot will embed two random codes
'this is also used to try and hide the user/pass on the command since it's shown in plain text
' Check Code0
if not request.querystring("code").count = 0 then
	if request.querystring("code") = "onereallylongcodethatsrandomlygenerated" then
		' Check Code1		
		if not isEmpty(request.querystring("code1")) then
			if not request.querystring("code1") = "secondreallylongcodethatsrandomlygenerated" then
				' Fail to boot, don't offer login screen again
				response.write("#!ipxe" & vbcrlf & "echo Boot Error Code: Error 001 - This PXEBoot is not authorized." & vbcrlf & "exit 1")
				response.end
			end if
		end if
	else
		' Fail to boot, don't offer login screen again
		response.write("#!ipxe" & vbcrlf & "echo Boot Error Code: Error 002 - This PXEBoot is not authorized."& vbcrlf & "exit 1")
		response.end
	end if
else
		' Fail to boot, don't offer login screen again
		response.write("#!ipxe" & vbcrlf & "echo Boot Error Code: Error 003 - This PXEBoot is not authorized."& vbcrlf & "exit 1")
		response.end
end if

'Check to see if user is set, and not empty, if it is, then do the same with the password.
'If set, copy the results to variables
'Otherwise fail over with an error code. 
if not request.querystring("user").count = 0 and not isEmpty(request.querystring("user")) then
	user = request.querystring("user")
	if not request.querystring("pass").count = 0 and not isEmpty(request.querystring("pass")) then
		pass = request.querystring("pass")
	else
		' If no password is set, fail (either blank, or login command was not issued)
		response.write("#!ipxe" & vbcrlf & "echo Boot Error Code: Error 004 - No Password Set."& vbcrlf & "exit 1")
		response.end	
	end if	
else
		' If the username is blank, fail (either left blank, or login command was not issued)
		response.write("#!ipxe" & vbcrlf & "echo Boot Error Code: Error 005 - No Username Set."& vbcrlf & "exit 1")
		response.end	
end if

'Verify user/pass combination
'Other users can be added here, following the same code (can use the cs or shd variables if returning the same menu
'Otherwise new variables can be added for more functionality)
'First is user 'cs' - Computing Services
if user = "cs" then
	' If the password needs to change, change it here
	if not pass = "a12345B" then
		response.write("#!ipxe" & vbcrlf & "echo Boot Error Code: Error 006 - Wrong Password." & vbcrlf & "exit 1")
		response.end
	else
		' Set the proper code for which menu (or other functions) should be returned to the user
		cs = 1
		shd = 0
	end if
'Next user is 'shd' - Student HelpDesk
elseif user = "shd" then
	' If the password needs to change, change it here
	if not pass = "B54321a" then
		response.write("#!ipxe" & vbcrlf & "echo Boot Error Code: Error 007 - Wrong Password." & vbcrlf & "exit 1")
		response.end
	else
		' Set the proper code for which menu (or other functions) should be returned to the user
		cs = 0
		shd = 1
	end if
else
		response.write("#!ipxe" & vbcrlf & "echo Boot Error Code: Error 008 - Invalid Username." & vbcrlf & "exit 1")
		response.end
end if
		
'Get MAC Address into a variable
' This should always be handed over to this script.
If not isEmpty(request.querystring("MAC")) Then
	mac = request.querystring("MAC")
else
	' If no MAC found, it's most likely a bad script, or unauthorized netboot that has somehow gotten this far
	response.write("#!ipxe" & vbcrlf & "echo Boot Error Code: Error 009 - MAC Not listed."& vbcrlf & "exit 1")
	response.end
End If

' Find out of Pxelinux is embedded or not
If not isEmpty(request.querystring("plembed")) Then
	plembed = request.querystring("plembed")
else
	plembed = 0
End If

' Check the MAC, this is where we can specify certain PCs get certain things
' This was changed to #!ipxe on 5/7/12, if gPXE is still in use, it may fail, however most builds are now ipxe
response.write("#!ipxe" & vbCrLF)
Select Case mac
	Case "00:0c:29:xx:xx:xx" ' This is a VM for testing the netboot with.
		ipxemenu
	Case "84:2b:2b:xx:xx:xx" ' Dell 980 
		ipxemenu
	Case Else
		' Fall back and set the pxelinux variables and what variables should work with what menus
		' Variable here (current) set based on username provided
		response.write("set 210:string http://netboot.example.com/" & vbcrlf)
		If cs = 1 Then
			response.write("set 209:string mainmenu.ipxe" & vbcrlf)
		ElseIf shd = 1 Then
			response.write("set 209:string mainmenu-shd.ipxe" & vbcrlf)
		End If

		' If pxelinux is embedded, load it from the embedded image, otherwise pull it from the server
		If plembed = 1 Then
			response.write("imgload pxelinux.0" & vbcrlf)
			response.write("imgexec pxelinux.0" & vbcrlf)
		Else
			response.write("chain ${210:string}pxelinux.0" & vbcrlf)
		End If
End Select

sub ipxemenu()
	response.write(":mainmenu" & vbcrlf)
	response.write("menu Work Netboot" & vbcrlf)
	response.write("item --gap --		----------- Ghost Boots -----------" & vbcrlf)
	response.write("item --key w wimboot	Symantec Ghost PE via WIMBoot" & vbcrlf)
	response.write("item --gap --   	------ Hardware Diagnostics -------" & vbcrlf)
	response.write("item --key m memtest	Memtest" & vbcrlf)
	response.write("item --key d dft	Drive Fitness Test v4.16" & vbcrlf)
	response.write("item --key l wddld	WD Data Lifegaurd Diagnostics v5.04f" & vbcrlf)
	response.write("item --key s seatools	Seagate Seatools for DOS v2.23" & vbcrlf)
	response.write("item --gap -- 		--------- Disk Utilities ----------" & vbcrlf)
	response.write("item --key q qwipe	Quick Wipe (Default Disk: 0)" & vbcrlf)
	response.write("item --key a dban	Darik's Boot and Nuke (DBAN) v2.2.6" & vbcrlf)
	response.write("item --key h shdd	Salvation HDD Scan and Restore v3.0" & vbcrlf)
	response.write("item --key p pmagic	Parted Magic" & vbcrlf)
	response.write("item --key g gparted	GParted (Gnome Partition Editor)" & vbcrlf)
	response.write("item --gap --		---------- Other Options ----------" & vbcrlf)
	response.write("item --key o nboot	Other Netboot Systems Menu" & vbcrlf)
	response.write("item --key i installers	Installers Submenu" & vbcrlf)
	response.write("item --key x shell	iPXE Shell" & vbcrlf)
	response.write("item default	Default VesaMenu" & vbcrlf)
	response.write("choose label && goto ${label}" & vbcrlf)

	response.write(":dft" & vbcrlf)
	response.write("sanboot --drive=0x00 dft32_v416_b00_install.IMG" & vbcrlf)
	response.write("goto mainmenu" & vbcrlf)

	response.write(":wddld" & vbcrlf)
	response.write("sanboot --drive=0xa0 Diag504fCD.iso" & vbcrlf)
	response.write("goto mainmenu" & vbcrlf)

	response.write(":nboot" & vbcrlf)
	response.write("menu Work Netboot - Other Netboot Systems" & vbcrlf)
	response.write("item --key c citrix	Citrix Provisioning Service (Citrix-DP)" & vbcrlf)
	response.write("item --key t tstation	Thinstation" & vbcrlf)
	response.write("item --key r mainmenu	Return to Main Menu" & vbcrlf)
	response.write("choose label && goto ${label}" & vbcrlf)

	response.write(":installers" & vbcrlf)
	response.write("menu Work Netboot - Installers Menu" & vbcrlf)
	response.write("item --key 3 7x32	Windows 7 32bit Installer" & vbcrlf)
	response.write("item --key 6 7x64	Windows 7 64bit Installer" & vbcrlf)
	response.write("item --key p esxi51sl	ESXi 5.1 Installer via PXELinux" & vbcrlf)
	response.write("item --key i esxi51	ESXi 5.1 Installer native iPXE" & vbcrlf)
	response.write("item --key r mainmenu	Return to Main Menu" & vbcrlf)
	response.write("choose label && goto ${label}" & vbcrlf)

	response.write(":memtest" & vbcrlf)
	response.write("chain memtest.0" & vbcrlf)
	response.write("goto mainmenu" & vbcrlf)

	response.write(":esxi51sl" & vbcrlf)
	response.write("set 210:string http://netboot.example.com/" & vbcrlf)
	response.write("set 209:string esxi51/esxi.cfg" & vbcrlf)
	If plembed = 1 Then
		response.write("imgload pxelinux.0" & vbcrlf)
		response.write("imgexec pxelinux.0" & vbcrlf)
	Else
		response.write("chain ${210:string}pxelinux.0" & vbcrlf)
	End If
	response.write("goto end" & vbcrlf)

	response.write(":esxi51" & vbcrlf)
	response.write("chain http://netboot.example.com/esxi51/esxi51.ipxe" & vbcrlf)
	response.write("goto end" & vbcrlf)

	response.write(":wimboot" & vbcrlf)
	response.write("imgfree" & vbcrlf)
	response.write("kernel wimboot" & vbcrlf)
	response.write("initrd ghostpe/bootmgr.exe bootmgr.exe" & vbcrlf)
	response.write("initrd ghostpe/BCD BCD" & vbcrlf)
	response.write("initrd ghostpe/fonts/chs_boot.ttf chs_boot.ttf" & vbcrlf)
	response.write("initrd ghostpe/fonts/cht_boot.ttf cht_boot.ttf" & vbcrlf)
	response.write("initrd ghostpe/fonts/kor_boot.ttf kor_boot.ttf" & vbcrlf)
	response.write("initrd ghostpe/fonts/jpn_boot.ttf jpn_boot.ttf" & vbcrlf)
	response.write("initrd ghostpe/fonts/wgl4_boot.ttf wgl4_boot.ttf"& vbcrlf)
	response.write("initrd ghostpe/boot.sdi boot.sdi" & vbcrlf)
	response.write("initrd ghostpe/boot.wim boot.wim" & vbcrlf)
	response.write("boot" & vbcrlf)

	response.write(":7x64" & vbcrlf)
	response.write("sanboot --drive 0xA0 --no-describe http://netboot.example.com/sysinstalls/W7ENTx64.iso" & vbcrlf)

	response.write(":7x32" & vbcrlf)
	response.write("sanboot --drive 0x81 --no-describe http://netboot.example.com/sysinstalls/W7ENTx32.iso" & vbcrlf)

	response.write(":default" & vbcrlf)
	response.write("set 210:string http://netboot.example.com/" & vbcrlf)
	If cs = 1 Then
		response.write("set 209:string mainmenu.ipxe" & vbcrlf)
	ElseIf shd = 1 Then
		response.write("set 209:string mainmenu-shd.ipxe" & vbcrlf)
	End If
	If plembed = 1 Then
		response.write("imgload pxelinux.0" & vbcrlf)
		response.write("imgexec pxelinux.0" & vbcrlf)
	Else
		response.write("chain ${210:string}pxelinux.0" & vbcrlf)
	End If
	response.write(":end" & vbcrlf)
end sub

%>

mainmenu.ipxe

ui vesamenu.c32
menu title Network Boot Menu for Work
menu autoboot System will boot to Ghost in # seconds
menu master passwd MasterPassword

menu background backgrounds/pxeboot-800.png
menu resolution 800 600

prompt 0
timeout 1000
menu timeoutrow 99
allowoptions 0
menu rows 25
menu helpmsgrow -1

menu color title  0	#ff00388b #00FFFFFF none  		
menu color unsel  0	#ffffffff #88000000 std
menu color sel    0 	#ff000000 #88c1c1c1 none
menu color hotkey 0	#ff0067ff #80000000 std
menu color hotsel 0	#ff000000 #88c1c1c1 none
menu color disabled 0 	#ff0067ff #88000000 std

	Label GhostPE
		menu label Ghost Tools / PE Environments:
		menu disable

	label  PE
		menu indent 2
		menu label ^1 Ghost PE Boot Disk (08/06/12)
		menu default
		kernel memdisk
		append iso raw 
		initrd PEBoot-08_06_12.iso

	label	Alt-PE
		menu indent 4
		menu label Ghost PEBoot AltBoot (08/06/12)
		COM32 linux.c32
		APPEND memdisk initrd=PEBoot-08_06_12.iso iso

	Label HardDiag
		menu label Hardware Diagnostics:
		menu disable

	label  Memtest
		menu indent 2
		menu label ^2 Memtest86+ v4.20
		kernel memtest86-420

	label  DFT
		menu indent 2
		menu label ^3 Drive Fitness Test v4.16
		kernel memdisk
		append initrd=dft32_v416_b00_install.IMG floppy

	label	WDDLD
		menu indent 2
		menu label ^4 WD Data Lifeguard Diagnostic v5.04f
		kernel memdisk
		append iso raw
		initrd Diag504fCD.iso

	label	SEATOOLS
		menu indent 2
		menu label ^5 Seagate Seatools for DOS v2.23
		kernel memdisk
		append iso raw
		initrd SeaToolsDOS223ALL.ISO

	label  HDT
		menu indent 2
		menu label ^6 Hardware Detection Tool
		kernel hdt.c32

	label  UBCD
		menu indent 2
		menu label ^7 Ultimate Boot CD v5.1.1
		kernel memdisk
		append iso raw 
		initrd ubcd511.iso

	label  SpinRite
		menu indent 2
		menu label ^8 SpinRite v6.0
		kernel memdisk
		append iso raw 
		initrd spinrite.iso

	label DiskWipe
		menu label Disk Utilities:
		menu disable

	label  QuickWipe
		menu indent 2
		menu label ^9 Quick Disk Wipe (Default: Disk 0)
		kernel memdisk
		append floppy initrd=wipe2.img

	label  DBAN
		menu indent 2
		menu label ^0 Darik's Boot And Nuke (DBAN) v2.2.6
		kernel memdisk
		append iso raw edd=off
		initrd	dban-2.2.6_i586-fixed.iso

	label  SalvationHDD
		menu indent 2
		menu label ^S Salvation HDD Scan & Restore v3.0
		kernel memdisk
		append floppy initrd=sal-hdd-sr.img

	label  PartedMagic
		menu indent 2
		menu label ^P Parted Magic
		linux pmagic/bzImage
		append initrd=pmagic/initramfs edd=off noapic load_ramdisk=1 prompt_ramdisk=0 rw vga=791 loglevel=0 mac_loop=256

	label  GParted
		menu indent 2
		menu label ^G GParted (Gnome Partition Editor)
		kernel gparted/vmlinuz
		append initrd=gparted/initrd.img boot=live config union=aufs noswap noprompt vga=788 fetch=http://netboot.example.com/gparted/filesystem.squashfs noapic edd=off

	label OtherNetboot
		menu label Other Netboot Systems:
		menu disable

	label  Citrix
		menu indent 2
		menu label ^C Boot to Citrix Provisioning Service (citrix-dp)
		com32 pxechn.c32
		append 10.133.2.232::ardbp32.bin

	label Thinstation
		menu indent 2
		menu label ^T Thinstation
		kernel thinstation/vmlinuz
		append initrd=thinstation/initrd  video=uvesafb:1024x768-32,ywrap splash=off console=tty1 loglevel=7 LM=3

	label Others
		menu label Other Options:
		menu disable	

	label Installers
		menu label ^E Installers SubMenu
		menu indent 2
		kernel vesamenu.c32
		append installers.conf

	label BIOS
		menu disabled
		menu label ^B BIOS Updates SubMenu
		menu indent 2
		kernel vesamenu.c32
		append bios/biosupdates.conf

	Label Testing
		Menu Label ^T Testing SubMenu
		menu indent 2
		kernel vesamenu.c32
		append testing.conf

	label  MenuExit
		menu indent 2
		menu label ^Q Exit Menu System - PXELinux Boot Prompt
		menu quit

installers.conf

ui vesamenu.c32
menu title Network Installers Menu for Work
menu master passwd MasterPassword

menu background backgrounds/pxeboot-800.png
menu resolution 800 600

prompt 0
menu timeoutrow 99
allowoptions 0
menu rows 22
menu helpmsgrow -1

menu color title  0	#ff00388b #00FFFFFF none  		
menu color unsel  0	#ffffffff #88000000 std
menu color sel    0 	#ff000000 #88c1c1c1 none
menu color hotkey 0	#ff0067ff #80000000 std
menu color hotsel 0	#ff000000 #88c1c1c1 none
menu color disabled 0 	#ff0067ff #88000000 std

	Label VMWare
		menu label VMWare Installers:
		menu disable

	label ESXi5
		menu indent 2
		menu label ^1 VMWare ESXi HyperVisor 5.1.0
		menu default
		kernel esxi51/mboot.c32
		append -c /esxi51/boot.cfg
	
	label DebianAMD64
		menu label ^2 Debian Squeeze AMD64 Netinstall
		menu indent 2
		kernel debian-installer/amd64/linux
		append vga=788 initrd=debian-installer/amd64/initrd.gz

	label DebianAMD64Rescue
		menu label ^3 Debian Squeeze AMD64 Rescue mode
		menu indent 2
		kernel debian-installer/amd64/linux
		append vga=788 initrd=debian-installer/amd64/initrd.gz rescue/enable=true

	label Debiani386
		menu label ^4 Debian Squeeze i386 Netinstall
		menu indent 2
		kernel debian-installer/i386/linux
		append vga=788 initrd=debian-installer/i386/initrd.gz

	label Debiani386Rescue
		menu label ^5 Debian Squeeze i386 Rescue Mode
		menu indent 2
		kernel debian-installer/i386/linux
		append vga=788 initrd=debian-installer/i386/initrd.gz rescue/enable=true

	label MainMenu
		menu indent 2
		menu label ^Q Return to Main Menu
		kernel vesamenu.c32
		append mainmenu.ipxe

mainmenu-shd.ipxe

ui vesamenu.c32
menu title Network Boot Menu for Work
menu master passwd MasterPassword

menu background backgrounds/pxeboot-800.png
menu resolution 800 600

prompt 0
timeout 1000
menu timeoutrow 99
allowoptions 0
#menu vshift 0
menu rows 23
menu helpmsgrow -1

menu color title  0	#ff00388b #00FFFFFF none  		
menu color unsel  0	#ffffffff #88000000 std
menu color sel    0 	#ff000000 #88c1c1c1 none
menu color hotkey 0	#ff0067ff #80000000 std
menu color hotsel 0	#ff000000 #88c1c1c1 none
menu color disabled 0 	#ff0067ff #88000000 std


	Label HardDiag
		menu label Hardware Diagnostics:
		menu disable

	label  Memtest
		menu indent 2
		menu label ^1 Memtest86+ v4.20
		kernel memtest86-420

	label  DFT
		menu indent 2
		menu label ^2 Drive Fitness Test v4.16
		kernel memdisk
		append initrd=dft32_v416_b00_install.IMG floppy

	label	WDDLD
		menu indent 2
		menu label ^3 WD Data Lifeguard Diagnostic v5.04f
		kernel memdisk
		append iso raw
		initrd Diag504fCD.iso

	label	SEATOOLS
		menu indent 2
		menu label ^4 Seagate Seatools for DOS v2.23
		kernel memdisk
		append iso raw
		initrd SeaToolsDOS223ALL.ISO

	label  HDT
		menu indent 2
		menu label ^5 Hardware Detection Tool
		kernel hdt.c32

	label  UBCD
		menu indent 2
		menu label ^6 Ultimate Boot CD v5.1.1
		kernel memdisk
		append iso raw 
		initrd ubcd511.iso

	label  Rescue
		menu label System Rescue Utilities
		menu disable

	label  Avira
		menu indent 2
		menu disable
		menu label ^7 Avira AntiVir Rescue System - Currently Broken
		kernel memdisk
		append iso raw
		initrd rescue_system-common-en.iso

	label Others
		menu label Other Options:
		menu disable	

	label  MenuExit
		menu indent 2
		menu passwd zaxscd
		menu label ^Q Exit Menu System - PXELinux Boot Prompt
		menu quit

Resources Used

Fin

These files may end up on my github at some point. If/when they do, I'll note it here.

iPXE is EXTREMELY powerful, especially with the embedded scripting. There is so much that can be done, it's hard to go into details, just because what you can do is so vast! A perfect example of this is Robin's iPXE menu linked to above. He does some awesome stuff!

I'm always looking to expand the netboot. Be adding diag utils, playing around with new options, or just plain tweaking it. In the above boot.php, a few of the things I want to tweak, is instead of referencing the name boot.example.com all the time, have it pull the PHP server variable. This way if you have a different hostname internal/external, as long as you set it once (say in a script, or via DHCP), it will always reference that server.

One thing to note with iPXE, is you can also embed the scripts into it. In my work netboot (coming soon!), I embed pxelinux.0 and a small script. This will be explained more in that post, but one thing to note, is you can embed a script that does DHCP, then chains to your server at home. As long as you have external access to that box, and flash the resulting iPXE to a USB drive, or CD, you can boot any machine anywhere in the world.

For contacting myself (for complaints/improvements/suggestions), or others who use iPXE, there is the IRC channel, irc.freenode.net, #ipxe. I'm pretty much always in there as Sedorox. The developers also hang out there, and other users too, who do all sorts of fun network booting things. Come visit!

Hopefully this helps someone better understand iPXE and netbooting, or at the very least, serves as an example on what you can do.