Next: , Previous: , Up: Top   [Contents][Index]

8 Booting GRUB from the network

The following instructions don’t work for *-emu, i386-qemu, i386-coreboot, i386-multiboot, mips_loongson, mips-arc and mips_qemu_mips

To generate a netbootable directory, run:

grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/<platform>

E.g. for i386-pc:

grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/i386-pc

Then follow instructions printed out by grub-mknetdir on configuring your DHCP server.

The grub.cfg file is placed in the same directory as the path output by grub-mknetdir hereafter referred to as FWPATH. GRUB will search for its configuration files in order using the following rules where the appended value corresponds to a value on the client machine.

(FWPATH)’/grub.cfg-‘(UUID OF MACHINE)’
‘(FWPATH)’/grub.cfg-‘(MAC ADDRESS OF NIC)’
‘(FWPATH)’/grub.cfg-‘(IPv4 OR IPv6 ADDRESS)’

The UUID is the Client Machine Identifier Option Definition as specified in RFC 4578. The client will only attempt to loouk up a UUID config file if it was provided by the DHCP server.

The client will only attempt to look up an IPv6 address config once, however, it will try the IPv4 multiple times. The concrete example below shows what would happen under the IPv4 case.

UUID: 7726a678-7fc0-4853-a4f6-c85ac36a120a
MAC:  52:54:00:ec:33:81
IPV4: (0A000082)

This feature is enabled by default but it can be disabled by setting the ‘feature_net_search_cfg’ to ‘n’. Since this happens before the configuration file is read by GRUB, this option has to be disabled in an embedded configuration file (see Embedded configuration).

After GRUB has started, files on the TFTP server will be accessible via the ‘(tftp)’ device.

The server IP address can be controlled by changing the ‘(tftp)’ device name to ‘(tftp,server-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. In the following description <interface> is placeholder for the name of network interface (platform dependent):


The network interface’s IP address. 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 IP address of the next (usually, TFTP) server provided by DHCP. Read-only.


Initially set to name of network interface that was used to load grub. Read-write, although setting it affects only interpretation of ‘net_default_ip’ and ‘net_default_mac


The IP address of default interface. Read-only. This is alias for the ‘net_${net_default_interface}_ip’.


The default interface’s MAC address. Read-only. This is alias for the ‘net_${net_default_interface}_mac’.


The default server used by network drives (see Device syntax). Read-write, although setting this is only useful before opening a network device.

Next: , Previous: , Up: Top   [Contents][Index]