From Fedora Project Wiki

Revision as of 12:58, 6 April 2018 by Pjones (talk | contribs) (remove some old stuff that's become inaccurate)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

network booting

This describes how to set up a server for network booting of both UEFI and BIOS clients.

packages

On the server, you'll need several packages:

  1. dhcpd
  2. tftp-server
  3. grub2-efi-${ARCH}
  4. syslinux

setup

  1. Make sure tftp is enabled in /etc/xinetd.d/tftp
  2. Copy necessary files:
    • mkdir /var/lib/tftpboot/efi/ /var/lib/tftpboot/pxelinux/ /var/lib/tftpboot/pxelinux/pxelinux.cfg
    • cp /boot/efi/EFI/redhat/shim.efi /var/lib/tftpboot/efi/bootx64.efi
    • cp /boot/efi/EFI/redhat/grubx64.efi /var/lib/tftpboot/efi/grubx64.efi
    • cp /usr/share/grub/unicode.pf2 /var/lib/tftpboot/efi/unicode.pf2
    • cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/pxelinux/pxelinux.0
  3. Configure your dhcpd server to use the EFI boot images packaged with grub, and configure a test system to boot using the EFI boot image. A sample configuration in /etc/dhcpd.conf might look like:
  option space PXE;
  option PXE.mtftp-ip    code 1 = ip-address;
  option PXE.mtftp-cport code 2 = unsigned integer 16;
  option PXE.mtftp-sport code 3 = unsigned integer 16;
  option PXE.mtftp-tmout code 4 = unsigned integer 8;
  option PXE.mtftp-delay code 5 = unsigned integer 8;
  option arch code 93 = unsigned integer 16;

  option space pxelinux;
  option pxelinux.magic code 208 = string;
  option pxelinux.configfile code 209 = text;
  option pxelinux.pathprefix code 210 = text;
  option pxelinux.reboottime code 211 = unsigned integer 32;

  subnet 10.0.0.0 netmask 255.255.255.0 {
          option routers 10.0.0.254;
          range 10.0.0.2 10.0.0.253;

          class "pxeclients" {
                  match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
                  next-server 10.0.0.1;
                 
                  if option arch = 00:07 {
                          filename "efi/bootx64.efi";
                  } else {
                          filename "pxelinux/pxelinux.0";
                  }
          }

          host example-ia32 {
                  hardware ethernet XX:YY:ZZ:11:22:33;
                  fixed-address 10.0.0.2;
          }
  }
  1. Add a grub config file to /var/lib/tftpboot/efi/grub.cfg and a syslinux config file to /var/lib/tftpboot/pxelinux/pxelinux.cfg/default.
    • A sample grub config file at /var/lib/tftpboot/efi/grub.cfg might look like:
set default=0
if loadfont /unicode.pf2
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
set timeout=5

menuentry 'Fedora 20' {
  load_video
  set gfxpayload=keep
  insmod gzip
  insmod part_gpt
  insmod ext2
  linuxefi /vmlinuz-3.16.3-200.fc20.x86_64
  initrdefi /initramfs-3.16.3-200.fc20.x86_64.img
}
    • A sample syslinux config file at /var/lib/tftpboot/pxelinux/pxelinux.cfg/default might look like:
default vesamenu.c32
IPAPPEND 2
timeout 100

label Fedora
	MENU rawhide x86_64
	kernel /rawhide-x86_64/vmlinuz
	append initrd=/rawhide-x86_64/initrd.img
  1. Copy the boot images into your tftp directory:
    • cp /path/to/x86_64/os/images/pxeboot/{vmlinuz,initrd.img} /var/lib/tftpboot/pxelinux/rawhide-x86_64/
    • cp -al /var/lib/tftpboot/pxelinux/rawhide-x86_64/ /var/lib/tftpboot/efi/rawhide-x86_64/