문서의 이전 판입니다!
PXE Server - UEFI
RHEL9 기반에서 PXE서버를 구성하는 방법에 대해 설명한다.
DHCP서버는 dhcpd 패키지를 기준으로 구성한다.
사전준비
서버의 DHCP 서비스를 위한 인터페이스가 eth1이고 eth1의 아이피는 10.0.0.9 라고 가정한다.
Client의 부트모드는
Legacy BIOSUEFI
두가지 모드가 있다. 각 모드에 대해서 구성을 하도록 한다.
패키지 설치
[root@pxe-server ~]# dnf install tftp-server dhcp-server syslinux-tftpboot [root@pxe-server ~]# firewall-cmd --permanent --add-service=tftp
BIOS mode
syslinux-tftpboot패키지를 설치하게되면 Legacy BIOS 부팅에 필요한 파일들이 /tftpboot경로에 설치된다.
이 파일들을 /var/lib/tftpboot경로에 모두 복사한다.
shim-x64패키지를 설치하게되면 UEFI 모드 부팅에 필요한 파일이 /boot/efi/EFI/ 아래 설치된다. *.efi파일들을 모두 /var/lib/tftpboot/efi디렉토리에 복사한다.
BIOS 모드에서 필요한 설정파일
/var/lib/tftpboot/pxelinux.cfg/default: BIOS모드의 부트화면 설정메뉴
UEFI 모드에서 필요한 설정파일
/var/lib/tftpboot/efi/grub.cfg: UEFI모드의 부트화면 설정메뉴
dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp-server/dhcpd.conf.example
# see dhcpd.conf(5) man page
#
#option domain-name "local.domain";
#option domain-name-servers dns.local.domain;
default-lease-time 600;
max-lease-time 7200;
authoritative;
# add follows
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 10.0.0.0 netmask 255.255.255.0 {
range dynamic-bootp 10.0.0.200 10.0.0.254;
option broadcast-address 10.0.0.255;
option routers 10.0.0.1;
# add follows
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
# PXE servers hostname or IP address
next-server 10.0.0.9;
# EFI Architecture system
# 0 Intel x86PC
# 1 NEC/PC98
# 2 EFI Itanium
# 3 DEC Alpha
# 4 Arc x86
# 5 Intel Lean Client
# 6 EFI IA32
# 7 EFI BC(BootController)
# 8 EFI Xscale
# 9 EFI x86-64
if option architecture-type = 00:07 or option architecture-type = 00:09 {
filename "efi/BOOTX64.EFI"; # 파일 위치는 /var/lib/tftpboot 디렉토리를 기준으로 하며 grub.cfg 파일은 동일한 디렉토리에 존재해야함
}
else {
filename "pxelinux.0"; # 파일 위치는 /var/lib/tftpboot 디렉토리를 기준으로 하며 pxelinux.cfg/default 파일이 존재해야함
}
}
}
/var/lib/tftpboot/grub.cfg
set default="1"
function load_video {
insmod efi_gop
insmod efi_uga
insmod video_bochs
insmod video_cirrus
insmod all_video
}
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
#insmod gfxterm
#terminal_output gfxterm
#loadfont /EFI/BOOT/fonts/unicode.pf2
#insmod gfxterm_background
#insmod png
#background_image -m stretch /EFI/BOOT/splash.png
set timeout=60
### CentOS ###
submenu 'CentOS' {
configfile CentOS/CentOS.menu.efi
}
#submenu 'CentOS' {
# menuentry 'Install CentOS 7' --class fedora --class gnu-linux --class gnu --class os {
# linuxefi /CentOS/7/isolinux/vmlinuz inst.repo=http://10.0.0.9/media/CentOS7
# initrdefi /CentOS/7/isolinux/initrd.img
# }
#}
### RHEL ###
submenu 'RHEL' {
configfile RHEL/RHEL.menu.efi
}
CentOS.menu.efi
menuentry 'Install CentOS 7' --class fedora --class gnu-linux --class gnu --class os {
linuxefi /CentOS/7/isolinux/vmlinuz inst.repo=http://10.0.0.9/media/CentOS7
initrdefi /CentOS/7/isolinux/initrd.img
}