Technology Encyclopedia Home >How to network boot from GRUB in Linux?

How to network boot from GRUB in Linux?

To network boot from GRUB in Linux, you typically need to configure GRUB to use the Preboot eXecution Environment (PXE) for network booting. Here’s a step-by-step guide:

  1. Ensure PXE Support: Make sure your network card supports PXE and that it is enabled in the BIOS settings.

  2. Configure DHCP Server: Set up a DHCP server on your network to assign IP addresses and direct clients to the TFTP server for boot files. The DHCP server should be configured to point to the TFTP server's IP address and the filename of the boot file (usually pxelinux.0 or grub.efi).

  3. Set Up TFTP Server: Install and configure a Trivial File Transfer Protocol (TFTP) server. This server will host the boot files needed for PXE booting.

  4. Prepare Boot Files: Place the necessary boot files on the TFTP server. For GRUB, you might need grub.efi (for UEFI systems) or grub.img (for BIOS systems), along with other GRUB configuration files.

  5. Configure GRUB: Edit the GRUB configuration file (usually grub.cfg) to include network boot options. This might involve specifying the network interface and the TFTP server address.

  6. Boot from Network: Restart your computer and enter the BIOS settings to change the boot order, setting the network card as the first boot device. Save the settings and exit, and the system should attempt to boot from the network.

Example Configuration:

  • In the DHCP server, you might set the boot file name to grub.efi.
  • On the TFTP server, you would place grub.efi and grub.cfg.
  • In grub.cfg, you might add an entry like:
    menuentry "Network Boot" {
        set root='(tftp,192.168.1.1)'
        linux /grub.efi
    }
    

Recommendation: For managing and deploying such configurations at scale, consider using cloud services that offer robust networking and server management capabilities. For instance, Tencent Cloud provides services like Cloud Virtual Machine (CVM) and Cloud Load Balancer that can be integrated with your PXE boot setup to ensure high availability and scalability.