Este conteúdo não está disponível no idioma selecionado.

Chapter 14. Setting up a remote diskless system


In a network environment, you can set up multiple clients with the identical configuration by deploying a remote diskless system. By using the current Red Hat Enterprise Linux server version, you can save the cost of hard drives for these clients and configure the gateway on a separate server.

The following diagram describes the connection of a diskless client with the server through Dynamic Host Configuration Protocol (DHCP) and Trivial File Transfer Protocol (TFTP) services.

Figure 14.1. Remote diskless system settings diagram

14.1. Preparing environments for the remote diskless system

Prepare your environment to continue with remote diskless system implementation. The remote diskless system booting requires the following services:

  • Trivial File Transfer Protocol (TFTP) service, which is provided by tftp-server. The system uses the tftp service to retrieve the kernel image and the initial RAM disk, initrd, over the network, through the Preboot Execution Environment (PXE) loader.
  • Dynamic Host Configuration Protocol (DHCP) service, which is provided by dhcp.

Prerequisites

  • You have set up your network connection.

Procedure

  1. Install the dracut-network package:

    # dnf install dracut-network
    Copy to Clipboard Toggle word wrap
  2. Add the following line to the /etc/dracut.conf.d/network.conf file:

    add_dracutmodules+=" nfs "
    Copy to Clipboard Toggle word wrap
  3. Ensure correct functionality of the remote diskless system in your environment by configuring services in the following order:

    1. Configure a TFTP service. For more information, see Configuring a TFTP service for diskless clients.
    2. Configure a DHCP server. For more information, see Configuring a DHCP server for diskless clients.
    3. Configure the Network File System (NFS) and an exported file system. For more information, see Configuring an exported file system for diskless clients.

14.2. Configuring a TFTP service for diskless clients

For the remote diskless system to function correctly in your environment, you need to first configure a Trivial File Transfer Protocol (TFTP) service for diskless clients.

Note

This configuration does not boot over the Unified Extensible Firmware Interface (UEFI). For UEFI based installation, see Configuring a TFTP server for UEFI-based clients.

Prerequisites

  • You have installed the following packages:

    • tftp-server
    • syslinux

Procedure

  1. Enable the tftp service:

    # systemctl enable --now tftp
    Copy to Clipboard Toggle word wrap
  2. Create a pxelinux directory in the tftp root directory:

    # mkdir -p /var/lib/tftpboot/pxelinux/
    Copy to Clipboard Toggle word wrap
  3. Copy the /usr/share/syslinux/pxelinux.0 file to the /var/lib/tftpboot/pxelinux/ directory:

    # cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/pxelinux/
    Copy to Clipboard Toggle word wrap
  4. Copy /usr/share/syslinux/ldlinux.c32 to /var/lib/tftpboot/pxelinux/:

    # cp /usr/share/syslinux/ldlinux.c32 /var/lib/tftpboot/pxelinux/
    Copy to Clipboard Toggle word wrap
  5. Create a pxelinux.cfg directory in the tftp root directory:

    # mkdir -p /var/lib/tftpboot/pxelinux/pxelinux.cfg/
    Copy to Clipboard Toggle word wrap

Verification

  • Check status of service tftp:

    # systemctl status tftp
    ...
    Active: active (running)
    ...
    Copy to Clipboard Toggle word wrap

14.3. Configuring a DHCP server for diskless clients

The remote diskless system requires several pre-installed services to enable correct functionality.

Prerequisites

  • Install the Trivial File Transfer Protocol (TFTP) service.
  • You have installed the following package:

    • dhcp-server
  • You have configured the tftp service for diskless clients. For more information, see Configuring a TFTP service for diskless clients.

Procedure

  1. Add the following configuration to the /etc/dhcp/dhcpd.conf file to setup a DHCP server and enable Preboot Execution Environment (PXE) for booting:

    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;
    option architecture-type code 93 = unsigned integer 16;
    
    subnet 192.168.205.0 netmask 255.255.255.0 {
      option routers 192.168.205.1;
      range 192.168.205.10 192.168.205.25;
    
      class "pxeclients" {
        match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
        next-server 192.168.205.1;
    
        if option architecture-type = 00:07 {
          filename "BOOTX64.efi";
          } else {
          filename "pxelinux/pxelinux.0";
        }
      }
    }
    Copy to Clipboard Toggle word wrap

    Your DHCP configuration might be different depending on your environment, like setting lease time or fixed address. For details, see Providing DHCP services.

    Note

    While using libvirt virtual machine as a diskless client, the libvirt daemon provides the DHCP service, and the standalone DHCP server is not used. In this situation, network booting must be enabled with the bootp file=<filename> option in the libvirt network configuration, virsh net-edit.

  2. Enable dhcpd.service:

    # systemctl enable --now dhcpd.service
    Copy to Clipboard Toggle word wrap

Verification

  • Check the status of service dhcpd.service:

    # systemctl status dhcpd.service
    ...
    Active: active (running)
    ...
    Copy to Clipboard Toggle word wrap

14.4. Configuring an exported file system for diskless clients

As a part of configuring a remote diskless system in your environment, you must configure an exported file system for diskless clients.

Prerequisites

Procedure

  1. Configure the Network File System (NFS) server to export the root directory by adding it to the /etc/exports directory. For the complete set of instructions see Deploying an NFS server
  2. Install a complete version of Red Hat Enterprise Linux to the root directory to accommodate completely diskless clients. To do that you can either install a new base system or clone an existing installation.

    • Install Red Hat Enterprise Linux to the exported location by replacing exported-root-directory with the path to the exported file system:

      # dnf install @Base kernel dracut-network nfs-utils --installroot=exported-root-directory --releasever=/
      Copy to Clipboard Toggle word wrap

      By setting the releasever option to /, releasever is detected from the host (/) system.

    • Use the rsync utility to synchronize with a running system:

      # rsync -a -e ssh --exclude='/proc/' --exclude='/sys/' example.com:/ exported-root-directory
      Copy to Clipboard Toggle word wrap
      • Replace example.com with the hostname of the running system with which to synchronize via the rsync utility.
      • Replace exported-root-directory with the path to the exported file system.

        Note, that for this option you must have a separate existing running system, which you will clone to the server by the command above.

  3. Configure the file system, which is ready for export, before you can use it with diskless clients:

    1. Copy the diskless client supported kernel (vmlinuz-_kernel-version_pass:attributes) to the tftp boot directory:

      # cp /exported-root-directory/boot/vmlinuz-kernel-version /var/lib/tftpboot/pxelinux/
      Copy to Clipboard Toggle word wrap
    2. Create the initramfs-kernel-version.img file locally and move it to the exported root directory with NFS support:

      # dracut --add nfs initramfs-kernel-version.img kernel-version
      Copy to Clipboard Toggle word wrap

      For example:

      # dracut --add nfs /exports/root/boot/initramfs-5.14.0-202.el9.x86_64.img 5.14.0-202.el9.x86_64
      Copy to Clipboard Toggle word wrap

      Example for creating initrd, using current running kernel version, and overwriting existing image:

      # dracut -f --add nfs "boot/initramfs-$(uname -r).img" "$(uname -r)"
      Copy to Clipboard Toggle word wrap
    3. Change the file permissions for initrd to 0644:

      # chmod 0644 /exported-root-directory/boot/initramfs-kernel-version.img
      Copy to Clipboard Toggle word wrap
      Warning

      If you do not change the initrd file permissions, the pxelinux.0 boot loader fails with a "file not found" error.

    4. Copy the resulting initramfs-kernel-version.img file into the tftp boot directory:

      # cp /exported-root-directory/boot/initramfs-kernel-version.img /var/lib/tftpboot/pxelinux/
      Copy to Clipboard Toggle word wrap
    5. Add the following configuration in the /var/lib/tftpboot/pxelinux/pxelinux.cfg/default file to edit the default boot configuration for using the initrd and the kernel:

      default rhel9
      
      label rhel9
        kernel vmlinuz-kernel-version
        append initrd=initramfs-kernel-version.img root=nfs:_server-ip_:/exported-root-directory rw
      Copy to Clipboard Toggle word wrap

      This configuration instructs the diskless client root to mount the /exported-root-directory exported file system in a read/write format.

    6. Optional: Mount the file system in a read-only` format by editing the /var/lib/tftpboot/pxelinux/pxelinux.cfg/default file with the following configuration:

      default rhel9
      
      label rhel9
        kernel vmlinuz-kernel-version
        append initrd=initramfs-kernel-version.img root=nfs:server-ip:/exported-root-directory ro
      Copy to Clipboard Toggle word wrap
    7. Restart the NFS server:

      # systemctl restart nfs-server.service
      Copy to Clipboard Toggle word wrap

You can now export the NFS share to diskless clients. These clients can boot over the network via Preboot Execution Environment (PXE).

14.5. Re-configuring a remote diskless system

If you want to install packages, restart services, or debug the issues, you can reconfigure the system.

Prerequisites

  • You have enabled the no_root_squash option in the exported file system.

Procedure

  • Change the user password:

    • Change the command line to /exported/root/directory:

      # chroot /exported/root/directory /bin/bash
      Copy to Clipboard Toggle word wrap
    • Change the password for the user you want:

      # passwd <username>
      Copy to Clipboard Toggle word wrap

      Replace the <username> with a real user for whom you want to change the password.

    • Exit the command line.
  • Install software on a remote diskless system:

    # dnf install <package> --installroot=/exported/root/directory --releasever=/ --config /etc/dnf/dnf.conf --setopt=reposdir=/etc/yum.repos.d/
    Copy to Clipboard Toggle word wrap

    Replace <package> with the actual package you want to install.

  • Configure two separate exports to split a remote diskless system into a /usr and a /var. For more information, see Deploying an NFS server.

14.6. Troubleshooting common issues with loading a remote diskless system

Based on the earlier configuration, some issues can occur while loading the remote diskless system. Following are some examples of the most common issues and ways to troubleshoot them on a Red Hat Enterprise Linux server.

Example 14.1. The client does not get an IP address

  1. Check if the Dynamic Host Configuration Protocol (DHCP) service is enabled on the server.

    1. Check if the dhcp.service is running:

      # systemctl status dhcpd.service
      Copy to Clipboard Toggle word wrap
    2. If the dhcp.service is inactive, enable and start it:

      # systemctl enable dhcpd.service
      # systemctl start dhcpd.service
      Copy to Clipboard Toggle word wrap
    3. Reboot the diskless client.
    4. Check the DHCP configuration file /etc/dhcp/dhcpd.conf. For details, see Configuring a DHCP server for diskless clients.
  2. Check if the Firewall ports are opened.

    1. Check if the dhcp.service is listed in active services:

      # firewall-cmd --get-active-zones
      # firewall-cmd --info-zone=public
      Copy to Clipboard Toggle word wrap
    2. If the dhcp.service is not listed in active services, add it to the list:

      # firewall-cmd --add-service=dhcp --permanent
      Copy to Clipboard Toggle word wrap
    3. Check if the nfs.service is listed in active services:

      # firewall-cmd --get-active-zones
      # firewall-cmd --info-zone=public
      Copy to Clipboard Toggle word wrap
    4. If the nfs.service is not listed in active services, add it to the list:

      # firewall-cmd --add-service=nfs --permanent
      Copy to Clipboard Toggle word wrap

Example 14.2. The file is not available during the booting a remote diskless system

  1. Check if the file is in the /var/lib/tftpboot/ directory.
  2. If the file is in the directory, ensure if it has the following permissions:

    # chmod 644 pxelinux.0
    Copy to Clipboard Toggle word wrap
  3. Check if the Firewall ports are opened.

Example 14.3. System boot failed after loading kernel/initrd

  1. Check if the NFS service is enabled on a server.

    1. Check if nfs.service is running:

      # systemctl status nfs.service
      Copy to Clipboard Toggle word wrap
    2. If the nfs.service is inactive, you must start and enable it:

      # systemctl start nfs.service
      # systemctl enable nfs.service
      Copy to Clipboard Toggle word wrap
  2. Check if the parameters are correct in the /var/lib/tftpboot/pxelinux.cfg/ directory. For details, see Configuring an exported file system for diskless clients.
  3. Check if the Firewall ports are opened.
Voltar ao topo
Red Hat logoGithubredditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar. Explore nossas atualizações recentes.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja o Blog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

Theme

© 2025 Red Hat