PXE boot

From Tom's notes
Jump to navigation Jump to search

PXE boot using gPXE

gPXE can be downloaded from http://etherboot.org/wiki/download where they even have a nice image generator at http://rom-o-matic.net/

Put the image on a Tftp-server and add following lines to ISC dhcpd:

### gPXE start
option space gpxe;
option gpxe-encap-opts code 175 = encapsulate gpxe;
option gpxe.keep-san code 8 = unsigned integer 8;

### gPXE end

host iscsitst {
   # Client IP
   fixed-address 192.168.1.10;
   hardware ethernet 01:02:03:04:05:06;

   # TFTP server IP
   next-server 192.168.1.1;

   # Prevent boot loop, send this reply when the gPXE client asks for an IP address
   if exists user-class and option user-class = "gPXE" {
      filename "";
      # Following address has format: iscsi:iscsi-server-ip:[protocol, default tcp=6]:[port, default=3260]:[LUN, default=0]:target-name
      option root-path "iscsi:192.168.1.1:::1:iqn.2007-01.be.hacks:target1";
      option gpxe.keep-san 1;
      #filename "http://my.web.server/real_boot_script.php";
   # When we get a regular PXE request, send the gPXE image
   } else {
#      filename "gpxe-1.0.1-gpxe.kpxe";
#      filename "gpxe-1.0.1+-gpxe.kpxe";
      filename "gpxe-1.0.1+-undionly.kpxe";
   }
}

I had to use the undionly driver because otherwise there were tcp protocol errors when trying to mount the iscsi target resulting in a 'Connection timed out' error.

More info on setting up the ISCSI target.