Configuring PXE
Perform the following operations on the BMS management node baremetal.
Setting the DHCP Server
Based on the actual network situation, ensure that network links exist between the bare metal management node and the bare metal physical server nodes, and the DHCP service has been enabled.
Setting the TFTP Server
- Create a TFTP root directory.
1sudo mkdir -p /tftpboot
Change the tftpboot directory path as required.
- Install the TFTP service.
1sudo yum -y install tftp-server xinetd
- Modify the /etc/xinetd.d/tftp configuration file.
- Open the file.
vi /etc/xinetd.d/tftp
- Press i to enter the insert mode and modify the content under service tftp in the file to the following:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
service tftp { protocol = udp port = 69 socket_type = dgram wait = yes user = root server = /usr/sbin/in.tftpd server_args = -v -v -v -v -v --blocksize 1350 --map-file /tftpboot/map-file /tftpboot disable = no # This is a workaround for Fedora, where TFTP will listen only on # IPv6 endpoint, if IPv4 flag is not used. flags = IPv4 }
The maximum value of blocksize is the maximum MTU value of the NIC minus 32.
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the file.
- Create a mapping file in the TFTP root directory.
1 2 3 4
echo 're ^(/tftpboot/) /tftpboot/\2' > /tftpboot/map-file echo 're ^/tftpboot/ /tftpboot/' >> /tftpboot/map-file echo 're ^(^/) /tftpboot/\1' >> /tftpboot/map-file echo 're ^([^/]) /tftpboot/\1' >> /tftpboot/map-file
- Restart the xinetd service.
1sudo systemctl restart xinetd
Enabling UEFI Boot
- Install the Grub2 and shim software packages on the x86 server.
1sudo yum install grub2-efi shim
- Copy the x86 boot file to the TFTP root directory.
sudo cp /boot/efi/EFI/centos/shim.efi /tftpboot/bootx64.efi sudo cp /boot/efi/EFI/centos/grubx64.efi /tftpboot/grubx64.efi
- Copy the AArch64 boot file to the TFTP root directory.
Run the sudo yum install grub2-efi shim command on the Arm server to install the Grub2 and shim software packages, and transfer the shim.efi and grubaa64.efi files in the /boot/efi/EFI/centos/ directory to the TFTP root directory on the bare metal management node, and name them bootaa64.efi and grubaa64.efi.
You can run the following commands on the Arm server:
1 2 3
sudo yum install grub2-efi shim scp /boot/efi/EFI/centos/shim.efi ${user}@${ip}:/tftpboot/bootaa64.efi scp /boot/efi/EFI/centos/grubaa64.efi ${user}@${ip}:/tftpboot/grubaa64.efi
You should replace user, ip, and tftpboot with correct values.
- Create a grub.cfg file.
- Create a directory for storing the grub.cfg file.
1 2
GRUB_DIR=/tftpboot/EFI/centos sudo mkdir -p $GRUB_DIR
- Create a grub.cfg file in the /tftpboot/EFI/centos directory.
vi /tftpboot/EFI/centos/grub.cfg
- Press i to enter the insert mode and add the following content to the file:
1 2 3 4 5 6 7
set default=master set timeout=5 set hidden_timeout_quiet=false menuentry "master" { configfile /tftpboot/$net_default_mac.conf }
- Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
- Change the permission on grub.cfg:
1sudo chmod 644 $GRUB_DIR/grub.cfg
- Create a directory for storing the grub.cfg file.
- Create a GRUB configuration template file for the AArch64 platform.
GRUB supports different commands on different platforms. Therefore, you need to create a specific PXE configuration template for the AArch64 platform.
- Create a pxe_grubaa64_config.template file in the /tftpboot directory.
vi /tftpboot/pxe_grubaa64_config.template
- Press i to enter the insert mode and add the following content to the file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
set default=deploy set timeout=5 set hidden_timeout_quiet=false menuentry "deploy" { linux {{ pxe_options.deployment_aki_path }} selinux=0 troubleshoot=0 text {{ pxe_options.pxe_append_params|default("", true) }} BOOTIF=${mac} boot_server={{pxe_options.tftp_server}} ipa-api-url={{ pxe_options['ipa-api-url'] }} coreos.configdrive=0 initrd {{ pxe_options.deployment_ari_path }} } menuentry "boot_partition" { linux {{ pxe_options.aki_path }} root={{ ROOT }} ro text {{ pxe_options.pxe_append_params|default("", true) }} boot_server={{pxe_options.tftp_server}} initrd {{ pxe_options.ari_path }} } menuentry "boot_ramdisk" { linux {{ pxe_options.aki_path }} root=/dev/ram0 text {{ pxe_options.pxe_append_params|default("", true) }} {{ pxe_options.ramdisk_opts|default('', true) }} initrd {{ pxe_options.ari_path }} } menuentry "boot_whole_disk" { linux chain.c32 mbr:{{ DISK_IDENTIFIER }} }
- Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
- Change the permission of the pxe_grubaa64_config.template file.
1sudo chmod 644 /tftpboot/pxe_grubaa64_config.template
- Create a pxe_grubaa64_config.template file in the /tftpboot directory.
Enabling Legacy BIOS Boot
The Kunpeng server supports only the UEFI boot mode. You can perform the operations below to enable the Legacy BIOS boot for the x86 servers.
- Install the syslinux software package on the x86 server.
1sudo yum install syslinux-tftpboot
- Copy the PXE image and related files to the TFTP root directory.
1sudo cp /usr/share/syslinux/pxelinux.0 /tftpboot
If you are going to start the whole drive image in PXE mode, the chain.c32 file is required.1sudo cp /boot/extlinux/chain.c32 /tftpboot
Modifying Permissions on Directories and Files
1 2 | sudo chown -R ironic /tftpboot sudo chmod -R 755 /tftpboot |
Modifying the ironic Configuration File
- Open the /etc/ironic/ironic.conf file.
vi /etc/ironic/ironic.conf
- Press i to enter the insert mode and add the following content to the file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
[pxe] tftp_root=/tftpboot tftp_server=${my_ip} tftp_master_path = /tftpboot/master_images pxe_bootfile_name=pxelinux.0 pxe_config_template = $pybasedir/drivers/modules/pxe_config.template uefi_pxe_bootfile_name=bootx64.efi uefi_pxe_config_template=$pybasedir/drivers/modules/pxe_grub_config.template pxe_bootfile_name_by_arch=aarch64:grubaa64.efi pxe_config_template_by_arch=aarch64:/tftpboot/pxe_grubaa64_config.template pxe_append_params = nofb nomodeset vga=normal systemd.journald.forward_to_console=yes ipa-debug=1 console=tty0 console=ttyS0,115200n8
The BMS supports multi-architecture deployment based on the cpu_arch attribute of the BMS management node, pxe_bootfile_name_by_arch, and pxe_config_template_by_arch. The startup mode is specified by boot_mode.
- Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
- Restart the ironic-conductor service.
1sudo systemctl restart openstack-ironic-conductor