配置 DHCP 服务同时支持两种启动方式
安装 DHCP 服务
dnf -y install dhcp-server
准备 DHCP 服务配置文件
复制如下内容到 /etc/dhcp/dhcpd.conf
。(IP 根据实际情况修改)
具体为什么这么写找机会在总结一下,现在就是照着 RedHat 官方文档抄的。
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;
option rfc3442-classless-static-routes code 121 = array of integer 8;
option ms-classless-static-routes code 249 = array of integer 8;
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;
# A slightly different configuration for an internal subnet.
subnet 192.168.255.0 netmask 255.255.255.0 {
range 192.168.255.100 192.168.255.200;
option domain-name-servers pxe.example.com;
option domain-name "example.com";
option broadcast-address 192.168.255.255;
default-lease-time 600;
max-lease-time 7200;
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
next-server 192.168.255.254;
if option architecture-type = 00:07 {
filename "uefi/BOOTX64.EFI";
} else {
filename "legacy/pxelinux.0";
}
}
# UEFI clients
#if substring(option architecture, 0, 9) = "PXEClient" {
#filename "uefi/BOOTX64.EFI";
#}
# Legacy BIOS clients
#if substring(option architecture, 0, 6) = "GRUB 2" {
# filename "legacy/pxelinux.0";
#}
}