首页 > 其他分享 >折腾PXE网络启动 pxe 双引导bios&uefi模式 OPENWRT

折腾PXE网络启动 pxe 双引导bios&uefi模式 OPENWRT

时间:2024-04-06 19:33:06浏览次数:12  
标签:set EFI OPENWRT boot bios PXE dhcp match uci

简介:

前两篇已经折腾了pxe引导bios和uefi,甭管启动的是啥,已经可以网络引导了。

但是同时面对这两种系统的时候怎么办?需要通过dhcp的参数来控制谁启动什么。

核心内容

RFC 4578: Dynamic Host Configuration Protocol (DHCP) Options for the Intel Preboot eXecution Environment (PXE) (rfc-editor.org)

RFC4578定义了architecture types,

Type  Architecture Name
----   -----------------
0    Intel x86PC
1    NEC/PC98
2    EFI Itanium
3    DEC Alpha
4    Arc x86
5    Intel Lean Client
6    EFI IA32
7    EFI BC
8    EFI Xscale
9    EFI x86-64

DHCP服务器可以根据这个来决定返回哪些信息给客户端。

 

TFTP ROOT

创建TFTP主目录

 发布TFTP主目录

 

 分别测试启动正常

 

BIOS & UEFI

tftpd就算了,它的DHCP太简单了。

现在的实验环境是openwrt的主路由,就打它的主意。

[OpenWrt Wiki] OpenWRT Multi-Arch TFTP boot  

它的示例文件是用别的引导的,我们先不考虑那么多,先引导我们的maxdos,grub4dos uefi。

一行一行敲肯定不舒服,写成shell脚本吧。 

修改参数:

tftp_root,TFTP发布主目录
filename='tag:bios,grldr'  bios启动文件
filename='tag:efi32,BOOTX64.EFI' uefi32启动文件,可以删除
filename='tag:efi64,BOOTX64.EFI' uefi64启动文件。
#!/bin/sh
uci set dhcp.@dnsmasq[0].logdhcp='1'
uci set dhcp.@dnsmasq[0].enable_tftp='1'
uci set dhcp.@dnsmasq[0].tftp_root='/etc/luci-uploads/tftp-root'
uci add dhcp match
uci set dhcp.@match[-1].networkid='bios'
uci set dhcp.@match[-1].match='60,PXEClient:Arch:00000'
uci add dhcp match
uci set dhcp.@match[-1].networkid='efi32'
uci set dhcp.@match[-1].match='60,PXEClient:Arch:00006'
uci add dhcp match
uci set dhcp.@match[-1].networkid='efi64'
uci set dhcp.@match[-1].match='60,PXEClient:Arch:00007'
uci add dhcp match
uci set dhcp.@match[-1].networkid='efi64'
uci set dhcp.@match[-1].match='60,PXEClient:Arch:00009'
uci add dhcp boot
uci set dhcp.@boot[-1].filename='tag:bios,grldr'
uci set dhcp.@boot[-1].serveraddress="$(uci get network.lan.ipaddr)"
uci set dhcp.@boot[-1].servername="$(uci get system.@system[0].hostname)"
uci add dhcp boot
uci set dhcp.@boot[-1].filename='tag:efi32,BOOTX64.EFI'
uci set dhcp.@boot[-1].serveraddress="$(uci get network.lan.ipaddr)"
uci set dhcp.@boot[-1].servername="$(uci get system.@system[0].hostname)"
uci add dhcp boot
uci set dhcp.@boot[-1].filename='tag:efi64,BOOTX64.EFI'
uci set dhcp.@boot[-1].serveraddress="$(uci get network.lan.ipaddr)"
uci set dhcp.@boot[-1].servername="$(uci get system.@system[0].hostname)"
uci commit dhcp
service dnsmasq reload

执行批处理,openwrt就可以根据客户端的类型,来分配不同的启动文件了。

 

BIOS抓包验证

MAC地址:08::::::B3

发现

包含93参数:0

提供

含参数66,67。

但是66写入了Next server IP address,67没有写入Boot file name。

请求

验证2.194是否被占用

接受

含参数66,67。

但是66写入了Next server IP address,67没有写入Boot file name。

UEFI

MAC地址:08::::::35

发现

包含93参数:7

 

提供

含参数66,67。

但是66写入了Next server IP address,67没有写入Boot file name。

请求

验证2.180是否被占用

接受

 总结

抓包没找到需要的东西,就要多解开几层,TFTP实验时,总是显示在第二层,下图的Next server ip address,Boot file name。

Openwrt Dnsmasq,又写在Option。虽然客户端都能解析,但是我看的时候还以为有什么错误,排查了两天。

 

 

主要参考资料

pxe 如何应对复杂的服务器硬件环境 | lvbibir's Blog

标签:set,EFI,OPENWRT,boot,bios,PXE,dhcp,match,uci
From: https://www.cnblogs.com/jackadam/p/18117806

相关文章

  • 折腾PXE网络启动 pxe 引导uefi模式 GRUB Shell (TFTPD64 OPENWRT)
    简介:上一篇折腾了maxdos,但是uefi是不支持dos的,openwrt的闪存又决定了只能启动命令行界面的系统,只有UEFIShell适合了。一:所需软件提取BOOTX64.EFIgrub4dos(chenall.net)这次下载grub4dos-for_UEFI下载以后,解压,只需要根目录BOOTX64.EFI文件。配置TFTP文件#创建一个文件夹......
  • VMware ESXi 6.7U3t macOS Unlocker & OEM BIOS 集成 Realtek 网卡驱动和 NVMe 驱动 (
    VMwareESXi6.7U3tmacOSUnlocker&OEMBIOS集成Realtek网卡驱动和NVMe驱动(集成驱动版)UIfix此版本解决的问题:VMwareHostClient无法将现有虚拟磁盘(VMDK)附加到虚拟机请访问原文链接:https://sysin.org/blog/vmware-esxi-6-sysin/,查看最新版。原创作品,转载请保......
  • openwrt
    openwrt简介OpenWrt/LEDE是一个为嵌入式设备(通常是无线路由器)开发的高扩展度的GNU/Linux发行版。与许多其他路由器的发行版不同,OpenWrt是一个完全为嵌入式设备构建的功能全面、易于修改的由现代Linux内核驱动的操作系统。在实践中,这意味着您可以得到您需要的所有功能,却仍能避......
  • nbtstat /?命令参数 显示使用NBT(NetBIOS over TCP/IP)的协议统计信息和当前TCP/IP连接
    NBTSTAT(NetBIOSoverTCP/IPStatistics)是一个用于显示和更新NetBIOS名称缓存、NetBIOS名称表和NetBIOS会话表的Windows命令行实用程序。它允许用户查看当前网络上的NetBIOS名称信息,以便诊断网络连接问题和执行基本的网络故障排除。NetBIOS是一种用于在局域网中进行通信的协议,它......
  • iMX6ULL-OpenWRT
    iMX6ULL-OpenWRT基于正点原子的imx6ull阿尔法开发板,移植OpenWRT23.05,仅支持SD卡启动。开源工程地址:https://github.com/boxwoodt/imx6ull_openwrt功能列表:RTL8188J无线EC204G联网WEB升级1、硬件环境正点原子阿尔法开发板。核心板V1.6,底板V2.2。4G模块使用EC20-CE......
  • openwrt netdata 温度监控
    1、安装timeout:opkginstallcoreutils-timeout2、进入/etc/netdata3、使用./edit-configcharts.d.conf来编辑配置文件,这个edit-config等于是一个配置工具能够从/usr/lib拉取默认配置过来,在配置里最后加入sensors=force。不加一定不会有温度,原因未知。4、用/usr/lib/netdata/p......
  • VMware ESXi 8.0U1d macOS Unlocker & OEM BIOS 标准版和厂商定制版
    VMwareESXi8.0U1dmacOSUnlocker&OEMBIOS标准版和厂商定制版ESXi8.0U1标准版,Dell(戴尔)、HPE(慧与)、Lenovo(联想)、Inspur(浪潮)、Cisco(思科)、Hitachi(日立)、Fujitsu(富士通)、NEC(日电)OEM定制版请访问原文链接:https://sysin.org/blog/vmware-esx......
  • openwrt的docker编译环境
    version:'3'services:ubuntu-lxde-novnc:image:docker-ubuntu-lxde-novnc:latestcontainer_name:ubuntu-lxde-novncrestart:alwaysprivileged:trueenvironment:-TZ=Asia/Shanghai-HTTP_PASSWORD=password......
  • openwrt上使用emmylua + emmyluadebugger + clion调试luci
    lua-emmyluadebuggerAOpenWrtpackageofEmmyLuaDebuggerIntelliJ-EmmyLuaEmmyLuaDebuggerIntelliJ-EmmyLua是一个给JetBrains全家桶用的lua插件,也有VSCode版本VSCode-EmmyLua插件。EmmyLuaDebugger是配合IntelliJ-EmmyLua使用的remotedebugger,C++编写供lua调用的动态......
  • VMware ESXi 8.0U1d macOS Unlocker & OEM BIOS 标准版和厂商定制版
    VMwareESXi8.0U1dmacOSUnlocker&OEMBIOS标准版和厂商定制版ESXi8.0U1标准版,Dell(戴尔)、HPE(慧与)、Lenovo(联想)、Inspur(浪潮)、Cisco(思科)、Hitachi(日立)、Fujitsu(富士通)、NEC(日电)OEM定制版请访问原文链接:https://sysin.org/blog/vmware-esxi-8-u1......