The following instructions only work on PC BIOS systems where the Preboot eXecution Environment (PXE) is available.
To generate a PXE boot image, run:
grub-mkimage --format=i386-pc-pxe --output=grub.pxe --prefix='(pxe)/boot/grub' pxe pxecmd
Copy grub.pxe, /boot/grub/*.mod, and /boot/grub/*.lst to the PXE (TFTP) server, ensuring that *.mod and *.lst are accessible via the /boot/grub/ path from the TFTP server root. Set the DHCP server configuration to offer grub.pxe as the boot file (the ‘filename’ option in ISC dhcpd).
You can also use the
grub-mknetdir utility to generate an image
and a GRUB directory tree, rather than copying files around manually.
After GRUB has started, files on the TFTP server will be accessible via the ‘(pxe)’ device.
The server and gateway IP address can be controlled by changing the ‘(pxe)’ device name to ‘(pxe:server-ip)’ or ‘(pxe:server-ip:gateway-ip)’. Note that this should be changed both in the prefix and in any references to the device name in the configuration file.
GRUB provides several environment variables which may be used to inspect or change the behaviour of the PXE device:
The IP address of this machine. Read-only.
The network interface’s MAC address. Read-only.
The client host name provided by DHCP. Read-only.
The client domain name provided by DHCP. Read-only.
The path to the client’s root disk provided by DHCP. Read-only.
The path to additional DHCP vendor extensions provided by DHCP. Read-only.
The boot file name provided by DHCP. Read-only.
The name of the DHCP server responsible for these boot parameters. Read-only.
The default server. Read-write, although setting this is only useful before opening a network device.