首页 > 系统相关 >WDS+MDT网络启动自动部署windows(三)UEFI & BIOS 双PXE引导

WDS+MDT网络启动自动部署windows(三)UEFI & BIOS 双PXE引导

时间:2024-04-10 17:13:26浏览次数:34  
标签:set windows boot PXEClient WDS UEFI dhcp match uci

简介:

我们可以通过调整启动文件来兼容不同的硬件(UEFI & BIOS),能否不手动调整呢?自动调整也是可以的。

本来是是想将DHCP放在H3C 5500上的,但是咨询过H3C的售前顾问后,没有任何一个型号支持这个功能,前面已经折腾过自动识别客户端类型,发送不同的启动文件了。为了更好的完成这个系列文章,以及添加shell脚本自动化处理,这篇还是写上吧。

双引导原理

我们知道两种系统启动文件不同,启动文件又是DHCP发送给终端的,那么需要DHCP识别客户端类型,RFC 4578规定了Option 93 是客户端类型的识别代码。我们就是通过DHCP识别终端的DHCP 发现数据包中的option93,从而发送给客户不同的启动文件。

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

抓包分析

过滤一下dhcp,可以看到discover包,包含93选项。

下图是抓的PXE bios

 再抓个 PXE-UEFI的

 看到有0有7。

WINDOWS DHCP 脚本设置

PXE Booting with WDS for UEFI and BIOS Devices – Mike Galvin - Technical Consultant

Add-DhcpServerv4Class -Name "PXEClient (UEFI x64)" -Type Vendor -Data "PXEClient:Arch:00007"
Add-DhcpServerv4Class -Name "PXEClient (UEFI x86)" -Type Vendor -Data "PXEClient:Arch:00006"
Add-DhcpServerv4Class -Name "PXEClient (BIOS x86 & x64)" -Type Vendor -Data "PXEClient:Arch:00000"

Add-DhcpServerv4Policy -Name "PXEClient (UEFI x64)" -Condition OR -VendorClass EQ,"PXEClient (UEFI x64)*"
Add-DhcpServerv4Policy -Name "PXEClient (UEFI x86)" -Condition OR -VendorClass EQ,"PXEClient (UEFI x86)*"
Add-DhcpServerv4Policy -Name "PXEClient (BIOS x86 & x64)" -Condition OR -VendorClass EQ,"PXEClient (BIOS x86 & x64)*"

Set-DhcpServerv4OptionValue -ScopeId 10.10.10.0 -PolicyName "PXEClient (UEFI x64)" -OptionId 067 -Value "boot\x64\wdsmgfw.efi"
Set-DhcpServerv4OptionValue -ScopeId 10.10.10.0 -PolicyName "PXEClient (UEFI x86)" -OptionId 067 -Value "boot\x86\wdsmgfw.efi"
Set-DhcpServerv4OptionValue -ScopeId 10.10.10.0 -PolicyName "PXEClient (BIOS x86 & x64)" -OptionId 067 -Value "boot\x64\wdsnbp.com"

openwrt dnsmasq 脚本设置

[OpenWrt Wiki] DHCP and DNS examples

注意修改tfpt_root TFTP主目录

filename,启动文件名。

#!/bin/bash
uci set dhcp.@dnsmasq[0].logdhcp='1'
uci set dhcp.@dnsmasq[0].enable_tftp='1'
uci set dhcp.@dnsmasq[0].tftp_root='/srv/tftp'
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,bios/lpxelinux.0'
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,efi32/syslinux.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,efi64/syslinux.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

  

标签:set,windows,boot,PXEClient,WDS,UEFI,dhcp,match,uci
From: https://www.cnblogs.com/jackadam/p/18126436

相关文章