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

相关推荐
VekiSon8 分钟前
Linux内核驱动——杂项设备驱动与内核模块编译
linux·c语言·arm开发·嵌入式硬件
AI+程序员在路上1 小时前
Nand Flash与EMMC区别及ARM开发板中的应用对比
arm开发
17(无规则自律)7 小时前
深入浅出 Linux 内核模块,写一个内核版的 Hello World
linux·arm开发·嵌入式硬件
梁洪飞19 小时前
内核的schedule和SMP多核处理器启动协议
linux·arm开发·嵌入式硬件·arm
代码游侠1 天前
学习笔记——Linux字符设备驱动
linux·运维·arm开发·嵌入式硬件·学习·架构
syseptember2 天前
Linux网络基础
linux·网络·arm开发
代码游侠2 天前
学习笔记——Linux字符设备驱动开发
linux·arm开发·驱动开发·单片机·嵌入式硬件·学习·算法
程序猿阿伟2 天前
《Apple Silicon与Windows on ARM:引擎原生构建与模拟层底层运作深度解析》
arm开发·windows
wkm9562 天前
在arm64 ubuntu系统安装Qt后编译时找不到Qt3DExtras头文件
开发语言·arm开发·qt
unicrom_深圳市由你创科技2 天前
基于ARM+DSP+FPGA异构计算架构的高速ADC采集卡定制方案
arm开发·fpga开发