Martijn Olivier Tigchelaar
2010-Mar-07 17:17 UTC
[syslinux] Can PXElinux be used to dynamically pass DHCP option 252 to a PXE client?
All (and hpa in particular),
I know that the question in the subject line of this message may come across as
a bit silly, given that PXElinux is not a DHCP server, but hear me out...
Those of you who have been working on PXE-booting Windows PE instances or the
new Windows installer images that make use of the Windows Boot Manager and
".wim" files may have come across the general understanding that the
"Boot Configuration Database" file ("BCD") has to exist on
the TFTP server as "\Boot\BCD". You will also have come across the
idea that the "bootmgr.exe" file HAS to exist in the root of the TFTP
server as "\bootmgr.exe"... All of this is however only partially
correct.
The default behaviour for the "pxeboot.com" (or
"pxeboot.n12") NBP is to look for "bootmgr.exe" in the
folder / path from which it was launched. If you launched
"pxeboot.n12" from the root of your TFTP server, it will try to load
"bootmgr.exe" from the root as well. If you launched
"pxeboot.n12" from a different path, then that path is where it will
try to load "bootmgr.exe" from as well. This does however ONLY work
when using MS-style paths (as in "\Boot\x86\pxeboot.n12" instead of
"/Boot/x86/pxeboot.12"). If you don't believe me, take a good look
at a running WDS server -> "bootmgr.exe" does not exist in the root
of the TFTP server, nor does "BCD".
Now onto the reasoning behind my question...
When "bootmgr.exe" has been loaded, it tries to determine WHERE to
find the "Boot Configuration Database" file and it has a number of
options on how to do it. The LAST (and therefore default) option is to simply
load the file "BCD" from the "\Boot" folder on the TFTP
server ("\Boot\BCD"). However, there are other options and they appear
to be as follows:"
Option 1) If DHCP option 252 (wpad) has been provided in the format
"\path\to\BCD\file", "bootmgr.exe" will simply load that
file from the TFTP server and use that as the BCD-file.
Option 2) If DHCP option 252 has not been provided, it will try to contact the
WDS server (I think) at port 4011 to ASK for the location of the BCD file. If no
response is received, it use the last option 3.
Option 3) load the file "BCD" from the "\Boot" folder on the
TFTP server ("\Boot\BCD").
This means that if PXElinux can dynamically pass DHCP option 252 with a text
like "path\to\BCD\file" to the PXE client based on a selected option
in the PXE menu, then that would allow us to specify different BCD files for
different situations / menu options. And THAT would actually be quite nice.
I have experimented with this stuff by forcing my DHCP server to provide option
252 with different paths to a VALID BCD file. Not only does that work, it also
gets rid of the annoying multi-second delay when "bootmgr.exe" is
started. And yes - it is during this delay that a network sniffer will show the
requests go to the TFTP server at port 4011...
So hmm - Can this be done? Can PXElinux be used to dynamically pass DHCP option
252 to a PXE client based on for example menu choices?
Looking forward to responses. Thanks in advance!
Sincerely,
Matijn Tigchelaar.
_________________________________________________________________
New Windows 7: Find the right PC for you. Learn more.
http://windows.microsoft.com/shop
Michael Brown
2010-Mar-07 23:58 UTC
[syslinux] Can PXElinux be used to dynamically pass DHCP option 252 to a PXE client?
On Sunday 07 Mar 2010 17:17:36 Martijn Olivier Tigchelaar wrote:> So hmm - Can this be done? Can PXElinux be used to dynamically pass DHCP > option 252 to a PXE client based on for example menu choices?Not strictly an answer to your question, but if you're using gpxelinux.0 then you could issue something equivalent to "set net0/252.string \path\to\BCD\file", which would cause the gPXE part to include option 252 within the (always artificially constructed) DHCP reply. That should work, though there may be an easier way to do it. Michael
Shao Miller
2010-Mar-08 18:38 UTC
[syslinux] Can PXElinux be used to dynamically pass DHCP option 252 to a PXE client?
Martijn Olivier Tigchelaar wrote:> ... > > Yes... Tried it. WOrks like a charm. Only one thing left to do - how > do I remove the delay between gPXE start and the execution of the script? >When you click the "Customize" button near the bottom of ROM-O-Matic[1], look for the BANNER_TIMEOUT option and experiment. 0 is a valid choice. - Shao Miller [1] http://rom-o-matic.net/gpxe/gpxe-git/gpxe.git/contrib/rom-o-matic/
Andrew Stuart
2010-Mar-09 00:07 UTC
[syslinux] Can PXElinux be used to dynamically pass DHCP option 252 to a PXE client?
On 3/7/2010 9:17 AM, Martijn Olivier Tigchelaar wrote:> >--snip--> > When "bootmgr.exe" has been loaded, it tries to determine WHERE to find the "Boot Configuration Database" file and it has a number of options on how to do it. The LAST (and therefore default) option is to simply load the file "BCD" from the "\Boot" folder on the TFTP server ("\Boot\BCD"). However, there are other options and they appear to be as follows:" > > Option 1) If DHCP option 252 (wpad) has been provided in the format "\path\to\BCD\file", "bootmgr.exe" will simply load that file from the TFTP server and use that as the BCD-file. > > Option 2) If DHCP option 252 has not been provided, it will try to contact the WDS server (I think) at port 4011 to ASK for the location of the BCD file. If no response is received, it use the last option 3. > > Option 3) load the file "BCD" from the "\Boot" folder on the TFTP server ("\Boot\BCD"). >--snip-- Are you sure about this? Do you have a reference you can point to, or is it just from observation? 252/wpad is commonly used for proxy configuration. I would suspect implementing this DHCP wide would cause all sorts of issues. I am one of the many of us annoyed by the delay, and would love to remove it, but not at the cost of having peoples browsers blow up. I wonder if restricting this to the PXEClient Class would still work.