使用ipxe安装现有的装机环境

iPXE和传统PXE区别

iPXE和传统PXE(Pre-boot Execution Environment,预启动执行环境)的主要区别在于它们的功能和协议支持。以下是两者的主要区别:

  1. 协议支持:

    • PXE仅支持TFTP(trivial file transfer protocol)协议,这可能导致下载速度较慢,尤其是在下载较大的启动软件包时。
    • iPXE不仅支持TFTP,还支持HTTP、NFS等多种网络协议,这大大提高了下载速度和灵活性。
  2. 功能和安全性:

    • PXE的功能相对较少,它主要通过网络启动操作系统,并在启动过程中通过TFTP或MTFTP协议下载启动软件包。
    • iPXE提供了更多的功能,包括支持多种网络协议、HTTPS网络安全通信、自定义脚本启动流程设置等,这使得iPXE比PXE更加强大和灵活。
  3. 服务器从盘启动:

    • iPXE支持服务器从盘启动,这是一种通过以太网存储协议如iSCSI挂载启动盘到服务器,然后以类似本地加载的方式获取第二阶段的BootLoader,从而加载kernel并进入操作系统的启动方式。这种方式对于无盘工作站非常有用。
    • 需要注意的是,从安全性和可靠性的角度来看,iPXE的云盘启动可能不如本地磁盘启动。
  4. 其他优点:

    • PXE的优点包括规模化(同时装配多台服务器)、自动化(安装系统和配置服务)和远程实现(不需要安装介质),但这些优点依赖于在同一广播域中的使用。

综上所述,iPXE相比传统PXE提供了更多的网络协议支持、更强大的功能和安全性,以及服务器从盘启动的额外能力。这些特点使得iPXE成为了一个更先进、更灵活的网络启动解决方案。

iPXE使用线上内核装机测试

cat /etc/dhcp/dhcpd.conf

bash 复制代码
include "/etc/dhcp/ipxe.conf";

ddns-update-style interim;
ignore client-updates;
allow unknown-clients;
allow bootp;
allow booting;
ping-check true;
default-lease-time 1800;
max-lease-time 1800;

group host_pool {
    allow bootp;
    allow booting;
    default-lease-time 1800;
    max-lease-time 2400;

    next-server 10.4.24.29;
    filename "gpxelinux.0";
 
    if exists user-class and option user-class = "iPXE" {
        filename "uefipxe/BOOTX64.EFI";
    }
    else if option client-arch != 00:00 {
        filename "ipxe.efi";
    }
    else {
        filename "gpxelinux.0";
    }

subnet 10.4.0.0 netmask 255.255.255.0 {
    option routers 10.4.0.254;
    option subnet-mask 255.255.255.0;
    range  dynamic-bootp 10.4.0.200 10.4.0.240;
} 
subnet 10.4.24.0 netmask 255.255.255.0 {
    option routers 10.4.24.254;
    option subnet-mask 255.255.255.0; 
    range  dynamic-bootp 10.4.24.200 10.4.24.240; 
}
subnet 10.4.25.0 netmask 255.255.255.0 {
    option routers 10.4.25.254;
    option subnet-mask 255.255.255.0; 
    range  dynamic-bootp 10.4.25.200 10.4.25.240; 
}
subnet 10.4.33.0 netmask 255.255.255.0 {
    option routers 10.4.33.254;
    option subnet-mask 255.255.255.0;
    range  dynamic-bootp 10.4.33.200 10.4.33.240;
}
}

cat /var/lib/tftpboot/pxelinux.cfg/default

bash 复制代码
label linux
  kernel http://10.4.24.29/centos7-pxe/vmlinuz
  append initrd=http://10.4.24.29/centos7-pxe/initrd2.cpio.gz  devfs=nomount ramdisk_size=9960000 idle=poll inst.gpt
  ipappend 2

装机测试

​解决方法:修改default文件,添加关于界面显示的参数

bash 复制代码
default vesamenu.c32
timeout 600

display boot.msg

menu background splash.png
menu title CentOS 8.X
menu vshift 8
menu rows 18
menu margin 8
#menu hidden
menu helpmsgrow 15
menu tabmsgrow 13

# Border Area
menu color border * #00000000 #00000000 none

# Selected item
menu color sel 0 #ffffffff #00000000 none

# Title bar
menu color title 0 #ff7ba3d0 #00000000 none

# Press [Tab] message
menu color tabmsg 0 #ff3a6496 #00000000 none

# Unselected menu item
menu color unsel 0 #84b8ffff #00000000 none

# Selected hotkey
menu color hotsel 0 #84b8ffff #00000000 none

# Unselected hotkey
menu color hotkey 0 #ffffffff #00000000 none

# Help text
menu color help 0 #ffffffff #00000000 none

# A scrollbar of some type? Not sure.
menu color scrollbar 0 #ffffffff #ff355594 none

# Timeout msg
menu color timeout 0 #ffffffff #00000000 none
menu color timeout_msg 0 #ffffffff #00000000 none

# Command prompt text
menu color cmdmark 0 #84b8ffff #00000000 none
menu color cmdline 0 #ffffffff #00000000 none

# Do not display the actual menu unless the user presses a key. All that is displayed is a timeout message.


label linux
  kernel http://10.4.24.29/centos7-pxe/vmlinuz
  append initrd=http://10.4.24.29/centos7-pxe/initrd2.cpio.gz  devfs=nomount ramdisk_size=9960000 idle=poll inst.gpt
  ipappend 2

再次尝试重启,可以正常装机

cat /var/log/httpd/access_log

​pxe环境测试是否能使用http服务

pxelinux.0为测试版本

pxe环境下,default文件配置http协议,拉取文件时卡住

结论:pxe环境不支持http协议

pxelinux.0为公司版本

不使用http

能正常装机

使用http
复制代码
[root@10-4-70-200 pxelinux.cfg]# cat default
label linux
kernel http://10.4.24.29/centos7-pxe/vmlinuz
append initrd=http://10.4.24.29/centos7-pxe/initrd2.cpio.gz devfs=nomount ramdisk_size=9960000 idle=poll
ipappend 1

结论:pxe不支持http协议

相关推荐
深信达沙箱8 小时前
漏洞修不完、合规过不了?先御OS如何让嵌入式设备‘出厂即合规
arm开发·操作系统·嵌入式操作系统
振南的单片机世界12 小时前
3.5T静默分帧,CRC16校验:Modbus-RTU帧结构解析
arm开发·stm32·单片机·嵌入式硬件
m0_5474866617 小时前
《Arm Cortex-M4嵌入式系统-STM32G4系列微控制器的原理架构与开发》全套PPT课件
arm开发·stm32·嵌入式硬件
工业设备方案笔记17 小时前
RK3588 AI部署实战:如何在ARM设备上运行AI模型?——从模型转换到边缘推理全过程解析
arm开发·人工智能·边缘计算
2601_9547064920 小时前
基于 ARM 虚拟化的云手机架构选型与 Python 自动化实战——2026 年 8 月为何我推荐傲晨云手机
arm开发·智能手机·架构
执迷不悟8231 天前
ARM--ADC/SPI
arm开发
weixin_424381002 天前
IAR EW for Arm - IAR命令行
arm开发
咯哦哦哦哦2 天前
【deban13】系统 安装arm qt6.8.2
arm开发
磨十三2 天前
U-Boot
arm开发·嵌入式硬件
Discipline~Hai4 天前
ARM03-蜂鸣器和中断
c语言·arm开发·单片机·嵌入式硬件·嵌入式