grub2: Network
1
1 8 Booting GRUB from the network
1 *******************************
1
1 The following instructions don't work for *-emu, i386-qemu,
1 i386-coreboot, i386-multiboot, mips_loongson, mips-arc and
1 mips_qemu_mips
1
1 To generate a netbootable directory, run:
1
1 grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/<platform>
1
1 E.g. for i386-pc:
1
1 grub-mknetdir --net-directory=/srv/tftp --subdir=/boot/grub -d /usr/lib/grub/i386-pc
1
1 Then follow instructions printed out by grub2-mknetdir on configuring
1 your DHCP server.
1
1 The grub.cfg file is placed in the same directory as the path output
1 by grub-mknetdir hereafter referred to as FWPATH. GRUB will search for
1 its configuration files in order using the following rules where the
1 appended value corresponds to a value on the client machine.
1
1 '(FWPATH)'/grub.cfg-'(UUID OF NIC)'
1 '(FWPATH)'/grub.cfg-'(MAC ADDRESS OF NIC)'
1 '(FWPATH)'/grub.cfg-'(IPv4 OR IPv6 ADDRESS)'
1 '(FWPATH)'/grub.cfg
1
1 The client will only attempt to look up an IPv6 address config once,
1 however, it will try the IPv4 multiple times. The concrete example
1 below shows what would happen under the IPv4 case.
1
1 UUID: 7726a678-7fc0-4853-a4f6-c85ac36a120a
1 MAC: 52:54:00:ec:33:81
1 IPV4: 10.0.0.130 (0A000082)
1
1 '(FWPATH)'/grub.cfg-7726a678-7fc0-4853-a4f6-c85ac36a120a
1 '(FWPATH)'/grub.cfg-52-54-00-ec-33-81
1 '(FWPATH)'/grub.cfg-0A000082
1 '(FWPATH)'/grub.cfg-0A00008
1 '(FWPATH)'/grub.cfg-0A0000
1 '(FWPATH)'/grub.cfg-0A000
1 '(FWPATH)'/grub.cfg-0A00
1 '(FWPATH)'/grub.cfg-0A0
1 '(FWPATH)'/grub.cfg-0A
1 '(FWPATH)'/grub.cfg-0
1 '(FWPATH)'/grub.cfg
1
1 After GRUB has started, files on the TFTP server will be accessible
1 via the '(tftp)' device.
1
1 The server IP address can be controlled by changing the '(tftp)'
1 device name to '(tftp,SERVER-IP)'. Note that this should be changed
1 both in the prefix and in any references to the device name in the
1 configuration file.
1
1 GRUB provides several environment variables which may be used to
1 inspect or change the behaviour of the PXE device. In the following
1 description <INTERFACE> is placeholder for the name of network interface
1 (platform dependent):
1
1 'net_<INTERFACE>_ip'
1 The network interface's IP address. Read-only.
1
1 'net_<INTERFACE>_mac'
1 The network interface's MAC address. Read-only.
1
1 'net_<INTERFACE>_hostname'
1 The client host name provided by DHCP. Read-only.
1
1 'net_<INTERFACE>_domain'
1 The client domain name provided by DHCP. Read-only.
1
1 'net_<INTERFACE>_rootpath'
1 The path to the client's root disk provided by DHCP. Read-only.
1
1 'net_<INTERFACE>_extensionspath'
1 The path to additional DHCP vendor extensions provided by DHCP.
1 Read-only.
1
1 'net_<INTERFACE>_boot_file'
1 The boot file name provided by DHCP. Read-only.
1
1 'net_<INTERFACE>_dhcp_server_name'
1 The name of the DHCP server responsible for these boot parameters.
1 Read-only.
1
1 'net_<INTERFACE>_next_server'
1 The IP address of the next (usually, TFTP) server provided by DHCP.
1 Read-only.
1
1 'net_default_interface'
1 Initially set to name of network interface that was used to load
1 grub. Read-write, although setting it affects only interpretation
1 of 'net_default_ip' and 'net_default_mac'
1
1 'net_default_ip'
1 The IP address of default interface. Read-only. This is alias for
1 the 'net_${net_default_interface}_ip'.
1
1 'net_default_mac'
1 The default interface's MAC address. Read-only. This is alias for
1 the 'net_${net_default_interface}_mac'.
1
1 'net_default_server'
1 The default server used by network drives (⇒Device syntax).
1 Read-write, although setting this is only useful before opening a
1 network device.
1