Here's my initial notes.
Booting via http on the LAN - method 1 and Booting via http (files obtained from externel web server) - method 1 both require a tftp server (tftpd32 used).
Booting via http on the LAN - method 2 and Booting via http (files obtained from externel web server) - method 2 use manually assigned network settings and do not require a tftp server. It should be possible to adapt Booting via http (files obtained from externel web server) - method 2 to boot from most routers with internet access. Remember that DNS will probably need disabling on the router.
Test system setup
Used Rom-o-Matic to generate a gPXE .lkrn file for my network adapter.
PC1 - gPXE client. Netbook with gPXE lkrn file loaded via grub4dos.
PC2 - DHCP/TFTP/HTTP Server on LAN. IP address 192.168.2.2. Tftpd32 running as DHCP and TFTP server. HTTP root directory contains grub.exe, DOS.iso, pxelinux.0, menu.c32 and pxelinux.cfg\default. pxelinux configuration file (pxelinux.cfg\default) contains the following entries -
default menu.c32 LABEL gpxe MENU LABEL gPXE test INITRD DOS.iso KERNEL grub.exe APPEND --config-file="map --mem (rd)+1 (0xff); map --hook; root (0xff); chainloader (0xff)"
Router - belkin router. IP address 192.168.2.1. DNS disabled. All PC's use static IP addresses.
Booting via http on the LAN - method 1
Booted PC1 (the netbook) and loaded gPXE.lkrn (via grub4dos - menu.lst entry kernel (hd0,0)/gPXE.lkrn).
Pressed [ctrl] + [B] keys to enter gPXE command-line.
Entered the following at the command prompt (connects to tftpd32 which assigns an IP address, etc) -
dhcp net0
Entered the following at the command prompt (this will set the configuration file as pxelinux.cfg\default (it will not search for a config file based on mac address etc) and will ensure that all entries in pxelinux.cfg\default will be prefixed with http://192.168.2.2/) -
set 209:string pxelinux.cfg/default set 210:string http://192.168.2.2/
Enterered the following at the command prompt (to chainload pxelinux.0 on the http server)
chain http://192.168.2.2/pxelinux.0
Due to the commands entered above the pxelinux configuration file will be interpreted as -
default http://192.168.2.2/menu.c32 LABEL gpxe MENU LABEL gPXE test INITRD http://192.168.2.2/DOS.iso KERNEL http://192.168.2.2/grub.exe APPEND --config-file="map --mem (rd)+1 (0xff); map --hook; root (0xff); chainloader (0xff)"
Booting via http on the LAN - method 2
Booted PC1 (the netbook) and loaded gPXE.lkrn (via grub4dos - menu.lst entry kernel (hd0,0)/gPXE.lkrn).
Pressed [ctrl] + [B] keys to enter gPXE command-line.
Entered the following at the command prompt to configure network settings -
ifopen net0 set net0/ip 192.168.2.3 set net0/netmask 255.255.255.0 set net0/gateway 192.168.2.1 set net0/dns 192.168.2.1
Entered the following to download DOS.iso from the http server -
initrd http://192.168.2.2/DOS.iso
Entered the following to download grub.exe from the http server (note the text that was previously added to the APPEND line in pxelinux.cfg\default has been added to the kernel line) -
kernel http://192.168.2.2/grub.exe --config-file="map --mem (rd)+1 (0xff); map --hook; root (0xff); chainloader (0xff)"
Booted DOS.iso by entering the following at the command prompt -
boot grub.exe
Booting via http (files obtained from externel web server) - method 1
The steps are very similar to those in Booting via http on the LAN - method 1, however http://192.168.2.2 must be replaced with the url of the remote web server. E.g. -
dhcp net0 set 209:string pxelinux.cfg/default set 210:string http://SERVER_IP/ chain http://SERVER_IP/pxelinux.0
Booting via http (files obtained from externel web server) - method 2
The steps are very similar to those in Booting via http on the LAN - method 2, however http://192.168.2.2 must be replaced with the url of the remote web server. E.g. -
ifopen net0 set net0/ip 192.168.2.3 set net0/netmask 255.255.255.0 set net0/gateway 192.168.2.1 set net0/dns 192.168.2.1 initrd http://SERVER_IP/DOS.iso kernel http://SERVER_IP/grub.exe --config-file="map --mem (rd)+1 (0xff); map --hook; root (0xff); chainloader (0xff)" boot grub.exe
Following also works (chainloads pxelinux.0 on the web server)
ifopen net0 set net0/ip 192.168.2.3 set net0/netmask 255.255.255.0 set net0/gateway 192.168.2.1 set net0/dns 192.168.2.1 set 209:string pxelinux.cfg/default set 210:string http://SERVER_IP/ chain http://SERVER_IP/pxelinux.0
Embedded Scripts
Now that these commands are working it's possible to embed them into gPXE (using Rom-o-Matic) using an embedded script. E.g. -
#!gpxe dhcp net0 initrd http://SERVER_IP/DOS.iso kernel http://SERVER_IP/grub.exe --config-file="map --mem (rd)+1 (0xff); map --hook; root (0xff); chainloader (0xff)" boot grub.exe
http://boot.kernel.org
http://boot.kernel.org is worth checking out and has been configured as a http boot server. To connect to it boot gPXE and start a command prompt, then enter either of the following set of commands (remember to ammend the IP addresses to reflect your own setup -
ifopen net0 set net0/ip 192.168.2.3 set net0/netmask 255.255.255.0 set net0/gateway 192.168.2.1 set net0/dns 192.168.2.1 set 209:string pxelinux.cfg/default set 210:string http://boot.kernel.org/bko/ chain http://boot.kernel.org/bko/pxelinux.0
dhcp net0 set 209:string pxelinux.cfg/default set 210:string http://boot.kernel.org/bko/ chain http://boot.kernel.org/bko/pxelinux.0
net0 is the first network card. If multiple network cards are installed this may also need editing.
A sample script for a static IP address setup (note that the config net0 command will halt the boot process and allow for the settings in the script to be amended -
#!gpxe ifopen net0 set net0/ip 192.168.2.3 set net0/netmask 255.255.255.0 set net0/gateway 192.168.2.1 set net0/dns 192.168.2.1 config net0 set 209:string pxelinux.cfg/default set 210:string http://boot.kernel.org/bko/ chain http://boot.kernel.org/bko/pxelinux.0
Have fun!
diddy