系统:CentOS7.9
部署:DHCP + TFTP + iPXE + httpd
1、DHCP配置文件
#yum install dhcp
# cat /etc/dhcp/dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.example
# see dhcpd.conf(5) man page
#
subnet 192.168.1.0
netmask 255.255.255.0
{
range 192.168.1.200 192.168.1.250;
option routers 192.168.1.11;
next-server 192.168.1.11;
}
option client-architecture code 93 = unsigned integer 16;
if exists user-class and option user-class = "iPXE" {
filename "http://192.168.1.11/menu.php";
} elsif option client-architecture = 00:00 {
filename "undionly.kpxe";
} else {
filename "ipxe.efi";
}
subnet 192.168.213.0
netmask 255.255.255.0
{
}
2、tftp配置文件
#yum install tftp-server
# cat /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
3、ipxe文件
将启动文件放置tftp服务的根路径下(默认/var/lib/tftpboot)
启动文件下载地址:
https://boot.ipxe.org/undionly.kpxe
https://boot.ipxe.org/ipxe.efi
4、/menu.php
# cat menu.php
#!ipxe
set base-url http://192.168.1.11
kernel ${base-url}/image/vmlinuz initrd=initramfs-081005.cpio.xz biosdevname=0 net.ifnames=0
initrd ${base-url}/image/initramfs-081005.cpio.xz
boot
5、tmpfs文件
# pwd
/var/www/html/image
# ll
total 410388
-rw-r--r-- 1 root root 413498948 Aug 11 13:28 initramfs-081005.cpio.xz
-rwxr-xr-x 1 root root 6734016 Aug 11 13:28 vmlinuz
BIOS虚拟机:

UEFI虚拟机:

iPXE比pxe优点:
1、镜像介质加载速度更快,支持http等;
2、定制化丰富
















