Second Hack:
Network Booting and You
eBox has support for serving a bootfile over TFTP.
Only it's broken. Oops.
Here's my quick fix:
sudo nano /etc/inetd.conf
tftp dgram udp wait root /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot
That /var/lib/tftpboot is where tftp will serve files from.
eBox expects it to be serving a file such as:
/var/lib/ebox/conf/dhcp/eth0/firmware
tftp dgram udp wait root /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/ebox/conf/dhcp/eth0
Now when you 'upload' a new boot file to eBox's dashboard,
/var/lib/ebox/conf/dhcp/ethX/firmware
gets replaced with whatever you've uploaded.
But eBox won't set the dhcp-option 'filename' to serve it.
sudo nano /usr/share/ebox/stubs/dhcp/subnet.mas
Look for
% if(defined($info{'nextServer'})) {
next-server <% $info{'nextServer'} %>;
% }
% if(defined($info{'filename'})) {
filename "<% $info{'filename'} %>";
% }
And change it to
% if(defined($info{'nextServer'})) {
next-server <% $info{'nextServer'} %>;
# Filename entry added by Kamilion (dec 01 2009)
filename firmware;
% }
% if(defined($info{'filename'})) {
filename "<% $info{'filename'} %>";
% }
Now we need something to boot.
Go pick up the latest gPXE from here:
http://www.rom-o-matic.net/gpxe/gpxe-git/gpxe.git/contrib/rom-o-matic/build.phpClick Customize.
Change the following Settings:
[X] DOWNLOAD_PROTO_HTTPS
[X] DOWNLOAD_PROTO_FTP
[X] TIME_CMD
[X] DIGEST_CMD
And paste in the following Embedded Script: (Good base, but edit if you wish)
#!gpxe
echo "Greetings! Hit Ctrl-C to bail out."
sleep 5
echo "Going to DHCP on primary network adapter"
ifopen net0
dhcp net0
echo "Going to try http://netboot/default.gpxe"
chain http://netboot/default.gpxe
echo "Didn't work, we're still here. Falling back to http://boot/default.gpxe"
chain http://boot/default.gpxe
echo "Didn't work, we're still here. Falling back to BKO"
set 209:string pxelinux.cfg/default
set 210:string http://boot.kernel.org/bko/
echo "Here we go, off to boot.kernel.org!"
chain http://boot.kernel.org/bko/pxelinux.0
echo "Didn't work, we're still here. No Internet connection? Falling back to next BIOS Boot device"
You should get a single .pxe file back after clicking Get Image.
Go to DHCP -> Interface -> Advanced Options -> Thin Client.
Settings:
Next server: eBox
File Name [browse] <Choose gpxe-x.x.x+-gpxe.pxe>
File path in next server: <blank>
Click "Change" to complete the settings, then Save Changes.
Place this file in the root of your HTTP server, named default.gpxe, and create a DNS alias to that machine named 'netboot'.
#!gpxe
imgfree
chain http://netboot/boot/menu.gpxe
Here's an example you can use to load Parted Magic:
#!gpxe
imgfree
kernel -n img http://bigblock/boot/pmagic/4.5/bzImage load_ramdisk=1 prompt_ramdisk=0 keymap=us loglevel=0 rw sleep=4
initrd http://bigblock/boot/pmagic/4.5/initramfs
boot img
Here's an example you can use to boot from iSCSI.
#!gpxe
imgfree
#dhcp net0
set keep-san 1
sanboot iscsi:10.10.10.250::::iqn.bigblock:storage.iscsikarmic-one
chain http://10.10.10.250/boot/iscsi.gpxe
More examples here:
http://files.sllabs.com/boot/