How to configure/setup a PXE server on RHEL 10 ?
Environment
- Red Hat Enterprise Linux 10
Issue
- How to configure/setup a PXE server for RHEL 10 ?
- How to configure a RHEL 10 server as a PXE server for RHEL 10 client installations ?
Resolution
Prerequesites
RHEL 10.0 DVD ISO is being used in this example to host the repository
-
Download the This content is not included.RHEL 10.0 DVD from Customer Portal
-
Decide the network configuration required for
PXEserver for your environment.
In the example below, thePXEserver will provideDHCPservice,TFTPservice andHTTPDservice on the same server.- DHCP : Needed for IP address assignmment and to provide location of the bootloader file
- TFTP : Host the bootloader and boot configuration during boot for BIOS/UEFI.
- HTTPD : Host the repository and make it available for installation. (Optional : Also provide bootloader and boot configuration for HTTP boot in case of UEFI clients.)
|Parameter|Value|
|---------|---------|
| Network Interface| enp7s0|
| Network ID| 192.168.10.0/24|
| DHCP Server IP| 192.168.10.1/24|
| Subnet Range| 192.168.10.100 - 192.168.10.200|
| Gateway| 192.168.10.1|
| TFTP Server| 192.168.10.1|
| DNS Server| 192.168.10.1|
| HTTPD Server| 192.168.10.1|
| Installation Repository| http://192.168.10.1/dvd/|
Configuration
-
Install the
DHCPserver,TFTPserver andHTTPDserver. RHEL 10 useskeafor DHCP.# dnf install kea tftp-server httpd -
Configure KEA DHCP server.
The file content of/etc/kea/kea-dhcp4.confshould contain the below content for our configuration above.{ "Dhcp4": { "interfaces-config": { "interfaces": [ "enp7s0" ] }, "subnet4": [ { "id": 1, "subnet": "192.168.10.0/24", "pools": [ { "pool": "192.168.10.100 - 192.168.10.200" } ], "option-data": [ { "space": "dhcp4", "name": "routers", "code": 3, "data": "192.168.10.1" }, { "space": "dhcp4", "name": "domain-name-servers", "code": 6, "data": "192.168.10.1" } ] } ], "client-classes": [ { "name": "uefi PXE Clients", "test": "substring(option[60].hex,0,9) == 'PXEClient' and option[93].hex == 0x0007", "next-server": "192.168.10.1", "boot-file-name": "/uefi/BOOT/BOOTX64.EFI" }, { "name": "bios PXE Clients", "test": "substring(option[60].hex,0,9) == 'PXEClient' and option[93].hex == 0x0000", "next-server": "192.168.10.1", "boot-file-name": "/bios/grub2/i386-pc/core.0" }, { "name": "uefi HTTP Clients", "test": "substring(option[60].hex,0,10) == 'HTTPClient' and option[93].hex == 0x0007", "option-data": [ { "space": "dhcp4", "name": "vendor-class-identifier", "code": 60, "data": "HTTPClient" } ], "next-server": "192.168.10.1", "boot-file-name": "http://192.168.10.1/uefi/BOOT/BOOTX64.EFI" } ], "loggers": [ { "name": "kea-dhcp4", "output-options": [ { "output": "/var/log/kea/kea-dhcp4.log" } ], "severity": "INFO", "debuglevel": 0 } ] } } -
Mount the RHEL 10 DVD and for copying the boot related files and provide installation source in
/var/www/html# mkdir -v /mnt/dvd # mount -v /root/rhel-10.0-x86_64-dvd.iso /mnt/dvd # ln -s /mnt/dvd /var/www/html/dvd -
Place boot files in the
TFTProot directory which by default is located at/var/lib/tftpboot# cp -av /mnt/dvd/boot /var/lib/tftpboot/bios # cp -av /mnt/dvd/EFI /var/lib/tftpboot/uefi # cp -av /mnt/dvd/images /var/lib/tftpboot/images -
Modify the existing boot configuration to point create a new PXE boot entry.
For BIOS,-
Modify the BIOS
grubconfiguration file/var/lib/tftpboot/bios/grub2/grub.cfgand add/modify PXE boot menuentry as below.menuentry 'PXE Install Red Hat Enterprise Linux 10.0' --class fedora --class gnu-linux --class gnu --class os { linux /images/pxeboot/vmlinuz inst.stage2=http://192.168.10.1/dvd/ quiet initrd /images/pxeboot/initrd.img } -
Additinally for BIOS,the boot configuration file
/var/lib/tftpboot/bios/grub2/grub.cfgshould be placed in the same directory as the bootloader file/var/lib/tftpboot/bios/grub2/i386-pc/core.0, so create a symlink for thegrub.cfgin the same directory ascore.0# ln -s ../grub.cfg /var/lib/tftpboot/bios/grub2/i386-pc/
For UEFI,
-
Modify the UEFI
grubconfiguraiton file/var/lib/tftpboot/uefi/BOOT/grub.cfgand add/modify the PXE boot menuentry as belowmenuentry 'PXE Install Red Hat Enterprise Linux 10.0' --class fedora --class gnu-linux --class gnu --class os { linuxefi /images/pxeboot/vmlinuz inst.stage2=http://192.168.10.1/dvd/ quiet initrdefi /images/pxeboot/initrd.img } -
Additonally for UEFI, make sure we have read permission for all the UEFI bootloader and configuration files.
# chmod -R a+rX /var/lib/tftpboot/uefi/BOOT/
-
-
Optional: You may copy these files from
/var/lib/tftpbootto/var/www/htmlfor performing HTTP boot using UEFI if your firmware supports it.# cp -av /var/lib/tftpboot/{uefi,images} /var/www/html/ -
Enable firewall ports and set restore the SELinux context (if required)
# firewall-cmd --add-service=tftp --permanent # firewall-cmd --add-service=http --permanent # firewall-cmd --reload # restorecon -FRv /var/lib/tftpboot /var/www/html -
Enable all the services.
# systemctl enable --now kea-dhcp4 # systemctl enable --now tftp.socket # systemctl enable --now httpd
Troubleshooting
-
DHCP :
- To troubleshoot
DHCPrelated issues with thekea-dhcp4service, refer the logs in/var/log/kea/kea-dhcp4.log - The verbosity of these logs can be increased by setting
severityanddebuglevelunder theloggersin thekeaconfiguration.
- To troubleshoot
-
TFTP :
- TFTP service logs will be logged to system journal and is accessible when running
journalctl -t in.tftpd - Verbosity of these logs can be increased by editing the
ExecStartline in the/usr/lib/systemd/system/tftp.servicefile by adding-v(can be added multiple times) for increasing the verbosity of thein.tftpdprocess. Make sure to runsystemctl daemon-reloadafter changing the service file and restart thetftp.socketprocess.
- TFTP service logs will be logged to system journal and is accessible when running
-
HTTPD :
- HTTPD access and error logs will be present inside
/var/log/httpdfor any issue related to HTTPD
- HTTPD access and error logs will be present inside
Also refer the RHEL 10 Network Installation documentation for more information.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.