The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 807 - File: showthread.php PHP 7.3.15 (Linux)
File Line Function
/showthread.php 807 errorHandler->error





Post Reply 
 
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PXE Dispatcher for iPXE
2011-04-05, 18:10 (This post was last modified: 2011-04-05 18:16 by robinsmidsrod.)
Post: #1
PXE Dispatcher for iPXE
I have created a simple Perl-based script which can be hooked into any web server that supports a standard CGI interface.

You can find the code at: http://github.com/robinsmidsrod/pxe-dispatcher

What I usually do is to symlink this script in the root of my TFTP root (/srv/tftp/ on Ubuntu, which I use) and then I share out that folder as a Samba share (so I can edit the files from a Windows desktop machine). At the end I create a symlink in /var/www/tftp that points to /srv/tftp. This way I can easily boot from either TFTP or HTTP with the same files.

If I create /srv/tftp/pxeboot/default.pxe, this script will automatically be executed by iPXE on boot. If default.pxe doesn't exist, pxelinux.0 is booted if it exists. pxelinux.0 should be installed alongside pxeboot.cgi.

The more interesting part of the script is the part that allows you to create custom boot scripts by MAC of the client. They should be named something like /srv/tftp/pxeboot/0025b35fd52f.pxe. The content of the file is just a normal iPXE script.

My laptop has a boot script file which contains the following code:
Code:
#!ipxe
echo
echo Booting HP laptop
chain freedos.pxe

And for that to work I have a separate file named /srv/tftp/pxeboot/freedos.pxe with the following code in it:
Code:
#!ipxe
echo
echo Booting FreeDOS for ${hostname} from SAN
set keep-san 1
set root-path iscsi:nas.smidsrod.lan::::iqn.2011-02.lan.smidsrod:${hostname}.boot.freedos
sanboot ${root-path}
echo Boot from ${root-path} failed, dropping to shell
shell

This enables me to boot FreeDOS on my laptop entirely from an iSCSI target.

Another script I have is named ubuntu-install.pxe and it contains the following code:
Code:
#!ipxe
echo
echo Installing Ubuntu for ${hostname} from SAN
# Setup iSCSI root path
set root-path iscsi:nas.smidsrod.lan::::iqn.2011-02.lan.smidsrod:${hostname}.boot.ubuntu
set skip-san-boot 1
set keep-san 1
# Hook iSCSI target
sanboot ${root-path}
# Boot kernel+initrd for Ubuntu install
kernel http://boot.smidsrod.lan/ubuntu-10.10-amd64-server/boot/linux
initrd http://boot.smidsrod.lan/ubuntu-10.10-amd64-server/boot/initrd.gz
imgargs linux ks=http://boot.smidsrod.lan/ubuntu-10.10-amd64-server/boot/ks.cfg
boot

echo Booting failed, dropping to shell
shell

For booting Ubuntu, I just use a script similar to the FreeDOS variant, just with the strings "freedos" replaced with "ubuntu".

Hope some of you will find it useful, and I would love if any of you have any ideas for improvements. If you make any improvements, do send me a pull request on GitHub.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
PXE Dispatcher for iPXE - robinsmidsrod - 2011-04-05 18:10
RE: PXE Dispatcher for iPXE - mcb30 - 2011-04-05, 18:24
RE: PXE Dispatcher for iPXE - mcb30 - 2011-04-05, 20:22
RE: PXE Dispatcher for iPXE - mcb30 - 2011-04-06, 00:01
RE: PXE Dispatcher for iPXE - Sha0 - 2011-08-08, 15:46



User(s) browsing this thread: 1 Guest(s)