Jump to content











Photo
* * * * * 2 votes

Tiny PXE Server

ipxe gpxe dhcp proxydhcp pxe boot sanboot http

  • This topic is locked This topic is locked
162 replies to this topic

#1 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 30 April 2013 - 06:34 PM

*
POPULAR

Posted Image

File Name: Tiny PXE Server
File Submitter: erwan.l
File Submitted: 30 Apr 2013
File Updated: 03 Mar 2021
File Category: Boot tools

Hi Gents,

I have been playing with pxe booting for a while, first starting with pxelinux, then gpxe and lately with ipxe.

I am mostly a windows user and as an IT often needs a quick (=no install) and portable (=run from USB) dhcp server including a tftp server and a http server offering me then pxe booting.
I could use tftp32 or serva but i like to make my own tools and these 2 were missing some features here and there.

So here comes a small portable dhcp server including a tftp and a http server.

This is freeware (and will always be), should be opensource and the unique here idea is to share and contribute.

-dhcp daemon supports an alternative filename based on the user-class thus enabling chainloading (gpxe->pxelinux, ipxe->script, etc), and also support settings dhcp options (which can then be used by your boot loader)
-tftp daemon supports tsize and blksize commands.
-http daemon support head, range (mandatory for ipxe sanboot options) and over 2gb iso.
-new in version 1.0.0.7 : BINL (RIS & WDS) support
-new in version 1.0.0.10 : DNS daemon
-new in version 1.0.0.14 : ProxyDHCP option
-new in version 1.0.0.18 : support pcbios/EFI mode

The root home of tftp and http is the folder where you main pxe loader sits.
I put all my iso files in a sub folder called images.
I put all my wim files in a sub folder called sources.
I put all my other loaders, in case I want to chain load, in next to my main loader (bootmgr, pxelinux, gpxe, grldr, etc)

In the attached screenshot, i load ipxe then chainloads a script (menu.ipxe).
In the script 3 different methods : the classic memdisk, a newer approach with sanboot and a new kid on the block wimboot.

More info about these loading methods here :
http://www.syslinux....dex.php/MEMDISK
http://ipxe.org/cmd/sanboot
http://ipxe.org/wimboot

Side note about ipxe+sanboot+http : I am big fan.
I have always been looking for a quick and efficient boot from lan methods and this is one is great : executes as it read and faster than memdisk since no preloading of the ISO is required.
iPXE reaches 50/60 MBits/secs on my lan.

"Voila".
Any questions, feedback is welcome.

Regards,
Erwan

Click here to download this file
  • Brito, misty, LordNecron and 1 other like this

#2 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 30 April 2013 - 06:42 PM

the menu.ipxe script :

 

 

The menu.ipxe script :
<code>
#!ipxe
######## MAIN MENU ###################
:start
menu Welcome to iPXE's Boot Menu
item
item --gap -- ------------------------- Operating systems ------------------------------
item 7pe_x86_E    Boot 7pe_x86 via sanboot
item pmagic    Boot pmagic via memdisk
item wimboot    wimboot
item --gap -- ------------------------------ Utilities ---------------------------------
item shell      Enter iPXE shell
item reboot     Reboot
item
item exit       Exit (boot local disk)
choose --default 7pe_x86_E_1 --timeout 30000 target && goto ${target}
########## UTILITY ITEMS ####################
:shell
echo Type exit to get the back to the menu
shell
set menu-timeout 0
goto start
 
:failed
echo Booting failed, dropping to shell
goto shell
 
:reboot
reboot
 
:exit
exit
########## MENU ITEMS #######################
:7pe_x86_E
sanboot --no-describe ${boot-url}/images/7pe_x86.iso || goto failed
goto start
 
:pmagic
initrd ${boot-url}/images/pmagic/pmagic_2013_02_28.iso
chain ${boot-url}/memdisk iso || goto failed
goto start
 
:wimboot
#case sensitive 
  kernel wimboot
  initrd BOOTMGR          BOOTMGR
  initrd BOOT/BCD         BCD
  initrd BOOT/BOOT.SDI    BOOT.SDI
  initrd SOURCES/BOOT.WIM BOOT.WIM
  boot
  goto start

  • diemgfrc likes this

#3 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 30 April 2013 - 07:35 PM

"Voila".
Any questions, feedback is welcome.
 

I know you were waiting for it :ph34r::
WHAT? :w00t: NO BINL server integrated? :dubbio:

:jaclaz:

:cheers:
Wonko



#4 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 30 April 2013 - 07:54 PM

Hi Wonko,

 

I dont know much about BINL right now.

I may be wrong but this is mainly (only?) used my MS is not it? is not it obsolete nowadays?

 

Shoot me for my ignorance there :)

 

If this is "only" a set of dhcp settings + some files to serve, I could probably implement it as well.

 

Regards,
Erwa,



#5 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 30 April 2013 - 07:59 PM

about ipxe, if anyone is willing to give the following a test :

 

 

:win7
sanboot --no-describe --drive 0x81 ${boot-url}/images/win7_x86_sp1.iso || goto failed
goto start
 
it boots but with long delays between different steps, and by the end the windows installer GUI complains about "no dvd driver found"...
i believe it would be handy to install win7 this way.
 
/erwan
 
answering myself :)
one cannot boot win7dvd.iso, see explanation from Michael here : http://forum.ipxe.or...ad.php?tid=6894.


#6 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 30 April 2013 - 08:58 PM

Another one which I like :,

-one can sanboot to an iscsi blank target.

-boot will fail (since target is blank) and then the system will keep on booting on the cd/dvd (provided bios is setup that way).

-if the dvd happens to be win7 (or up), windows will list the iscsi target as possible installable media :)

 

here below the ipxe script :

 

:bootsan
dhcp net0
set keep-san 1
sanboot iscsi:192.168.1.248:tcp:3260:0:iqn.2000-01.com.synology:ds210.name
boot
goto start
 
which is equal to the following dhcp setup (see screenshot) :
-load ipxe,
-chainload rootpath = iscsi:192.168.1.248:tcp:3260:0:iqn.2000-01.com.synology:ds210.name
-set options = 175.6.1.1.1.8.1.1 (see here for options)
 
/erwan

Attached Thumbnails

  • iscsi.png


#7 reboot12

reboot12

    Frequent Member

  • Advanced user
  • 287 posts
  • Interests:WinXP, Debian, OpenWrt, gPXE, iPXE, BIOS, UEFI, Coreboot, MS VirtualPC, VMware
  •  
    Poland

Posted 01 May 2013 - 03:28 PM

Maybe try load ISO over memdisk from menu.ipxe like this: with RAW parameter



#8 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 01 May 2013 - 03:37 PM

Hi Wonko,

 

I dont know much about BINL right now.

I may be wrong but this is mainly (only?) used my MS is not it? is not it obsolete nowadays?

 

Shoot me for my ignorance there :)

 

I have no idea if "something" else uses BINL, for sure it used in PXe RIS installs of Windows and - conversely - in the senselessly renamed WDS (which is actually an evolution of RIS and BINL).

Traditionally this has been a PITA because easy to follow/implement documentation is very scarce, there is in practice only one "free" BINL server (by Sherpya) and TFTP32 - which is undoubtedly the most used tool - misses one.

Serva includes one and since it is an "all in one" it has quickly become a new "standard".

In practice:

TFTP32 alone = no PXE installs (No RIS No BINL No WDS)

TFTP32+Sherpya's BINL Server = PXE install up to Server 2003 (RIS + BINL, No WDS)

Serva = PXE install up to Server 2003 AND up to Windows 8 (RIS + BINL + WDS)

 

 

Developing a new thingy without it seems to me like a "step backwards", maybe (cannot say) it could be implemented as a "Plugin" or "Module" (or whatever) i.e. optional but somehow "certified" by the Author :worship: as compatible/easy to use.

 

See Definitions here:

http://www.vercot.co...indowsPXE1.html

 

 

:cheers:

Wonko 



#9 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 01 May 2013 - 05:04 PM

Maybe try load ISO over memdisk from menu.ipxe like this: with RAW parameter

 

Hi Reboot12,

The issue with memdisk is the memory requirement.

 

My dvd iso is 2.1 gig and my system cannot afford to lose that much memory to load the iso.

 

Best method I could find for now to install win7 thru pxe boot is http://ipxe.org/howt...talling_windows.

 

Regards,

Erwa,



#10 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 01 May 2013 - 05:15 PM

I have no idea if "something" else uses BINL, for sure it used in PXe RIS installs of Windows and - conversely - in the senselessly renamed WDS (which is actually an evolution of RIS and BINL).

Traditionally this has been a PITA because easy to follow/implement documentation is very scarce, there is in practice only one "free" BINL server (by Sherpya) and TFTP32 - which is undoubtedly the most used tool - misses one.

Serva includes one and since it is an "all in one" it has quickly become a new "standard".

In practice:

TFTP32 alone = no PXE installs (No RIS No BINL No WDS)

TFTP32+Sherpya's BINL Server = PXE install up to Server 2003 (RIS + BINL, No WDS)

Serva = PXE install up to Server 2003 AND up to Windows 8 (RIS + BINL + WDS)

 

 

Developing a new thingy without it seems to me like a "step backwards", maybe (cannot say) it could be implemented as a "Plugin" or "Module" (or whatever) i.e. optional but somehow "certified" by the Author :worship: as compatible/easy to use.

 

See Definitions here:

http://www.vercot.co...indowsPXE1.html

 

 

:cheers:

Wonko 

 

Hi Wonko,

 

I'll definitely have a look at BINL along with RIS and WDS.

 

For now the main purpose of my pxe server is not to install windows distributions : although it may be possible and to be fair is what I am looking at right now :)

It seems that this is serva's main purpose.

 

Now I need to reverse engeeneer BINL :)

 

Regards,

Erwan



#11 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 01 May 2013 - 05:21 PM

talking about operating system installation thru PXE :

 

I successfully tested the following linux distribs.

Linux sure makes it easy (when it comes to install thru a network) as opposed to windows (my personal view there...).

 

 

:ubuntu-installer
kernel ${boot-url}/ubuntu-installer/i386/linux
initrd ${boot-url}/ubuntu-installer/i386/initrd.gz
boot
goto start
 
:centos-installer
initrd ${boot-url}/centos-installer/i386/CentOS-6.4-i386-netinstall.iso
chain ${boot-url}/memdisk iso || goto failed
goto start
 
:opensuse-installer
sanboot --no-describe --keep ${boot-url}/opensuse-installer/openSUSE-12.3-NET-i586.iso || goto failed
goto start
 
i purposedly picked up 3 different ways of booting


#12 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 01 May 2013 - 07:34 PM

NO need to reverse BINL, Sherpya's tool is Open Source (see links here):

http://diddy.boot-la.../files/binl.htm

and has published a page about it:

http://oss.netfarm.it/guides/binl.php

 

:cheers:

Wonko



#13 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 01 May 2013 - 07:54 PM

NO need to reverse BINL, Sherpya's tool is Open Source (see links here):

http://diddy.boot-la.../files/binl.htm

and has published a page about it:

http://oss.netfarm.it/guides/binl.php

 

:cheers:

Wonko

 

Reading thru it, on top of looking in bnlsrv.py and looking at what my wireshark spits out.

 

I have found the following steps.

I made it up to step 7 so far :)

 

Still dont know what bcd winpe.wim must contain. i guess genuine ones fresh from dvd wont do.

 

With some time and effort, i may be able to implement BINL.

 

For now, if it is only about booting a winpe.wim, there other simpler ways.

if I can boot a windows 7 installation, then it shall become interesting.

 

 

 

1.C->S DHCP request for IP
2.S->C Acknowledges IP request and gives the client a (free) ip-address
3.C->S DHCP request for bootserver/file

4.S->C DHCP Reply for bootserver/file SERVER:/boot/myserver/wdsnbp.0
5.C->S TFTP Request for bootfile /boot/myserver/wdsnbp.0
6.S->C TFTP Reply /boot/myserver/wdsnbp.0
7.C->S BINL request (where can I find the BCD file?)

Server finds in tftpd.log where that client has downloaded its wdsnbp file from and relies with the bcd file in that same directory.

8.S->C BINL reply   /boot/pxeboot.com and /boot/myserver/bcd

9.C->S TFTP request /boot/pxeboot.com
10.S->C TFTP reply   /boot/pxeboot.com
11.C->S TFTP request /boot/myserver/bcd
12.S->C TFTP reply   /boot/myserver/bcd

Client reads BCD file and finds out where to download the boot.sdi and winpe.wim from

13.C->S TFTP request /boot/boot.sdi
14.S->C TFTP reply   /boot/boot.sdi

15.C->S TFTP request /boot/winpe.wim
16.S->C TFTP reply   /boot/winpe.wim


#14 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 02 May 2013 - 02:05 PM

AIO Pxe Server (not sure about that name...) + BINL server works.

I was able to perform an XP installation over the network.

 

1-I created a folder RIS (windows shared, nullsessions enabled) containing BINL and XP cd.

2-I extracted all inf files from driverpacks to a temp\inf folder and ran infparser against it to obtain devlist.cache and nics.txt.

3-I extracted all sys files from driverpacks to a temp\sys folder and moved them to \xp\i386.

4-I launched binlsrv.exe.

5-I put the following file on my root RIS folder : startrom.0, ntldr, ntdetect.com, and winnt.sif.

6-I launched my pxe server choosing startrom.0 as the bootstrap loader.

 

I then could witness that startom.0 called ntldr which called ntdetect.com which read winnt.sif (thru tftpd) and from there my windows xp installation started.

During the process I could see my BINL server indicating which sys file to retrieve.

Later on, I could see the windows installation using my windows share (dont forget about nullsessions!).

 

The content of my (ris) winnt.sif is to be found below.

 

Xp was "easy", will now try Win7 :)

 

/Erwan

 

 

[data]
floppyless = "1"
msdosinitiated = "1"
; Needed for second stage
OriSrc = "\\192.168.1.100\RemInst\XP\i386"
OriTyp = "4"
LocalSourceOnCD = 1
DisableAdminAccountOnDomainJoin = 1
 
[SetupData]
OsLoadOptions = "/fastdetect"
; Needed for first stage
SetupSourceDevice = "\Device\LanmanRedirector\192.168.1.100\RemInst\XP"
 
[RemoteInstall]
; Avoid automatic format/repartition
Repartition = No
UseWholeDisk = No
 
[UserData]
ComputerName = *
;ProductID=XXXXX-XXXXX-XXXXX-XXXXX-XXXXX


#15 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 02 May 2013 - 07:07 PM

In the previous post, I showed how to boot Windows XP install cd thru network with a PXE server + a BINL server.

 

Now here comes to do the same with a WinPE wim file.

 

1-I created a WDS folder with a sources sub folder containing boot.wim and a boot sub folder containing bcd and boot.sdi.

2-I extracted all inf files from driverpacks to a temp\inf folder and ran infparser against it to obtain devlist.cache and nics.txt. (not sure this part is needed but binlsrv wont start without these 2 generated files).

3-I launched binlsrv.exe.

4-I put the following file on my root WDS folder : wdsnbp.com, pxeboot.com, bootmgr.exe.

5-I launched my pxe server choosing wdsnbp.com as the bootstrap loader.

 

wdsnbp.com with load pxeboot.com which will load bootmgr.exe which will read bcd ...

 

From winpe, you can then map the windows share containing your windows 7 installation files then.

Or even automate by customizing your winpe wim file.

 

The AIO Pxe Server zip file contains the BINL server. I believe there are no issues to distribute it.

 

Regards,

Erwan



#16 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 03 May 2013 - 09:08 AM

AIO Pxe Server (not sure about that name...) 

 

What about "ELPxe Server" this allows, beside giving some relevance to the name (actually initials) of the Author, some spanish subtitle:

 

 

ELPxe Server, el Pxe server más completo del mundo

:unsure:

 

:cheers:

Wonko



#17 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 03 May 2013 - 10:50 AM

What about "ELPxe Server" this allows, beside giving some relevance to the name (actually initials) of the Author, some spanish subtitle:

 

 

:unsure:

 

:cheers:

Wonko

 

Then it should be "LEPxe Server", would still work with my initials and would add a french touch !

But this is way too megalomaniac :)



#18 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 03 May 2013 - 10:57 AM

About post #15, I was about to add a BINL/WDS feature to that pxe server (listen on port 4011 requests, send back the right responses, etc) but it appears that if no BINL/WDS server is found, then the winpe boot will proceed anyway going for a default \boot\bcd (whereas with a BINL/WDS server you could implement some logic based on platform/mac/uuid, etc).

 

BINL/WDS is "really/only" useful in step 8 (see post #13).

 

Actually MS explains it here : http://technet.micro...8(v=ws.10).aspx .

 

Also one can use pxeboot.com (or rather pxeboot.n12) directly, thus skipping wdsnbp.com.

 

/Erwan



#19 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 03 May 2013 - 11:18 AM

Then it should be "LEPxe Server", would still work with my initials and would add a french touch !
But this is way too megalomaniac :)
Well, the issue is that LE is usually associated with Lite Edition, i.e. somewhat a diminutive. :ph34r:

I am not sure to understand your last post. (actually I am sure I don't understand it) :unsure:
Can you expand on it?

:cheers:
Wonko

#20 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 03 May 2013 - 11:35 AM

Well, the issue is that LE is usually associated with Lite Edition, i.e. somewhat a diminutive. :ph34r:

I am not sure to understand your last post. (actually I am sure I don't understand it) :unsure:
Can you expand on it?

:cheers:
Wonko

 

What I meant is that initially I tought that having a BINL server running was mandatory to boot winpe using wdsnbp.com boot strapper.

And actually indeed, when BINL is running, you can see one incoming request and BINL server pointing to \boot\bcd.

 

But I then realised that even with BINL not running, wdsnpb/pxeboot will still boot winpe.

Pxeboot will then simply attempt to download \boot\bcd (default hardcoded path I guess).

 

In such case then, I would say that the only interesting point of the BINL server is that one could dynamically point to another bcd file (which would then point to another wim file).

One could think of a logic depending on the mac address, or platform, etc which is part of the client request.

I guess this is probably what MS WDS does.

 

Note that this applies only to WDS (win7 and up), not RIS (xp network install is not possible without a BINL/RIS server).

 

Hope this makes more sense.

 

/Erwan



#21 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 03 May 2013 - 11:52 AM

I thought that the feature was required by WDS in the sense that normally (nomen is omen) Windows Deployment Service in an enterprise should allow to choose different images from the server to be deployed to the client (i.e. one central repository serving all). :unsure:

I.e. i believed that that would provide a way to choose form the client which image is deployed from the server.

It's not really my field of experience, though.

 

:cheers:

Wonko



#22 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 03 May 2013 - 12:19 PM

Hi Wonko,

 

Indeed this is what I meant :

My post #15 was wrong : you can boot winpe via wdsnbp bootstrap loader without a BINL server (which is answering WDS client requests).

 

If I were to implement a BINL/WDS feature in my pxe server, to make it useful I would then offer some sort of logic where one could hand over BCD files based on some criterias found in the client request.

A bit like pxelinux does to hand over a menu file (first tries out mac address, then ip, and finally defaullt menu).

 

To illustrate what goes on between client and server when wdsnbp bootstrap loader, see attached screenshot.

 

One thing which is not clear to me yet (I dont have a MS WDS server) is how the windows installation is actually triggered : is it simply a batch/executable triggerred from winpeshl.ini using some samba share?

 

Regards,

Erwan

Attached Thumbnails

  • binl.png


#23 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 03 May 2013 - 12:25 PM

Neither I have one available, but it seems to me much more complex than what you seem to assume. :ph34r:

See:

http://trycatch.be/b...parameters.aspx

 

This may be of actual help to you :unsure::

http://jacermeno.fil...alreference.doc

 

:cheers:

Wonko



#24 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3041 posts
  • Location:Nantes - France
  •  
    France

Posted 03 May 2013 - 12:40 PM

Neither I have one available, but it seems to me much more complex than what you seem to assume. :ph34r:

See:

http://trycatch.be/b...parameters.aspx

 

This may be of actual help to you :unsure::

http://jacermeno.fil...alreference.doc

 

:cheers:

Wonko

 

You are right : wds is quite complex and complete actually.

I am only focusing on one small aspect : the booting part.

 

I was merely surfing on your initial comment i.e should my pxe server implements some sort of BINL feature.

I have now come to the conclusion that I could very easily add an extra option/field where one would tick a checkbox to enable "BINL/WDS" and he would then have to point to BCD file (himself pointing to a WIM file).

 

Not sure if this is very useful.

Plus this is stepping away from opensource/free technologies.

 

At least now that you pointed me to BINL/WDS/RIS, I have a tiny bit more understanding and I could myself install XP thru network which is useless these days (at least in my environement) :)

 

/Erwan



#25 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 03 May 2013 - 02:09 PM

Not sure if this is very useful.
Plus this is stepping away from opensource/free technologies.

Allow me to disagree.
The whole point of having free (and possibly additionally open source) tools is to be not forced to (example) get Server 2008 or 2012 to have WDS to deploy a set of images.

More than that ;) you would need to name your tool All (but BINL and WDS) In One Pxe Server, ABBAWIO Pxe Server.
Of course, you could as well call it Winbuilder :whistling: or Billy-Bob :w00t:, what's in a name? :unsure:

:cheers:
Wonko




4 user(s) are reading this topic

0 members, 4 guests, 0 anonymous users