使用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协议

相关推荐
Awh-17 小时前
ARM 裸机开发 DAY9 学习笔记
arm开发·笔记·学习
en.en..19 小时前
8086、x86、ARM 结构化详解
arm开发
sunoo-2291 天前
嵌入式Linux驱动学习笔记(第3-6天):从misc封装、platform总线到设备树、中断与单总线外设实战
linux·arm开发·驱动开发·笔记·单片机·学习
半杯咖啡半行码1 天前
STM32之ARM通用汇编指令详解:从指令格式到寻址方式
汇编·arm开发·stm32
szxinmai主板定制专家2 天前
基于RK3588+FPGA+AI的储能电站边缘网关,实现电力数据采集与智能预警
arm开发·人工智能·fpga开发·rk3576·半导体设备
XMAIPC_Robot2 天前
储能控制器产品化:ARM+FPGA整机高低温、EMC可靠性测试实战总结
arm开发·人工智能·fpga开发·arm+fpga·rk3588+fpga
半杯咖啡半行码2 天前
ARM交叉编译环境搭建与Qt源码编译移植全过程详解
arm开发
XMAIPC_Robot2 天前
FPGA+ARM联合调试避坑:储能电力采样数据同步、丢包问题定位与根治方案,应用于储能EMS、微网控制器中
arm开发·人工智能·fpga开发·rk3588+fpga·rk3576+fpga
幼儿园蛋小黄3 天前
从设备树到 ARM 驱动:嵌入式 Linux 驱动开发学习总结
linux·arm开发·驱动开发