Dhcp

UEFI 的 pxelinux.0 和 pxelinux.cfg/default 配置的等效性是什麼?

  • July 15, 2020

我將 Pxe 用於具有 BIOS(傳統模式)的伺服器,效果很好。

從 PXE 設置 Legacy 模式和引導伺服器,它將載入 pxelinux.0 並通過 TFTP 從 /var/lib/tftpboot/pxelinux.cfg/default 讀取配置菜單。

這是tcpdump舊版的

           Vendor-Class Option 60, length 32: "PXEClient:Arch:00000:UNDI:002001"
           END Option 255, length 0
           PAD Option 0, length 0, occurs 188
18:38:42.626709 00:0c:29:c6:72:77 > Broadcast, ethertype IPv4 (0x0800), length 342: (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328)
   172.16.234.112.bootps > 255.255.255.255.bootpc: [udp sum ok] BOOTP/DHCP, Reply, length 300, xid 0x90d61ab8, secs 6, Flags [Broadcast] (0x8000)
         Your-IP 172.16.235.94
         Server-IP 172.16.234.112
         Client-Ethernet-Address 00:25:90:d6:1a:b8
         file "/pxelinux.0"[|bootp]

18:38:42.628329 00:25:90:d6:1a:b8 > 00:0c:29:c6:72:77, ethertype IPv4 (0x0800), length 70: (tos 0x0, ttl 20, id 3, offset 0, flags [none], proto UDP (17), length 56)

   172.16.235.94.ah-esp-encap > 172.16.234.112.tftp: [udp sum ok]  28 RRQ "/pxelinux.0" octet tsize 0

   172.16.235.94.49152 > 172.16.234.112.tftp: [udp sum ok]  80 RRQ "/pxelinux.cfg/002590d6-1ab8-0607-0025-90d61ab80e0f" octet tsize 0 blksize 1408

我們可以看到 DHCP 提供了一個 IP 和 tftppxelinux.0/pxelinux.cfg/

我可以配置啟動菜單default,安裝 Centos 或其他任何東西。

然而最近我遇到了帶有 UEFI 的新伺服器的問題。我知道我可以被告知它是舊版還是 UEFIdhcpd.conf

ddns-update-style none;
default-lease-time 3600;
max-lease-time 3600;
ignore client-updates;
allow booting;
allow bootp;


option client-system-arch code 93 = unsigned integer 16;

class "pxeclients" {

       match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";

       next-server 172.16.234.112;


       if option client-system-arch = 00:00 {


               filename = "/pxelinux.0";

       }

       if option client-system-arch = 00:07 or option client-system-arch = 00:09{

               filename = "/BOOTX64.EFI";

       }

}

subnet 172.16.232.0 netmask 255.255.248.0 {

       option routers                  172.17.232.1;
       option subnet-mask              255.255.248.0;
       option domain-name-servers      202.106.0.20;
       range dynamic-bootp 172.16.235.2 172.16.239.253;

}

BOOTX64.EFI 來自 Centos7.5 ISO。

當它是 Legacy 時沒關係,但它會掛起

start PXE Over IPV4

螢幕閃爍並從另一個視窗切換(看不到它是什麼,非常快)。

從 看messages,它保留了 DHCP Request 和 offer。

Mar  8 19:32:36 ks dhcpd: DHCPREQUEST for 172.16.235.95 (172.16.234.112) from 5c:b9:01:92:f6:34 via ens192
Mar  8 19:32:36 ks dhcpd: DHCPACK on 172.16.235.95 to 5c:b9:01:92:f6:34 via ens192
Mar  8 19:32:36 ks dhcpd: DHCPDISCOVER from 5c:b9:01:92:f6:34 via ens192
Mar  8 19:32:36 ks dhcpd: DHCPOFFER on 172.16.235.95 to 5c:b9:01:92:f6:34 via ens192
Mar  8 19:32:40 ks dhcpd: DHCPREQUEST for 172.16.235.95 (172.16.234.112) from 5c:b9:01:92:f6:34 via ens192
Mar  8 19:32:40 ks dhcpd: DHCPACK on 172.16.235.95 to 5c:b9:01:92:f6:34 via ens192
Mar  8 19:32:40 ks dhcpd: DHCPDISCOVER from 5c:b9:01:92:f6:34 via ens192
Mar  8 19:32:40 ks dhcpd: DHCPOFFER on 172.16.235.95 to 5c:b9:01:92:f6:34 via ens192
Mar  8 19:32:44 ks dhcpd: DHCPREQUEST for 172.16.235.95 (172.16.234.112) from 5c:b9:01:92:f6:34 via ens192
Mar  8 19:32:44 ks dhcpd: DHCPACK on 172.16.235.95 to 5c:b9:01:92:f6:34 via ens192
Mar  8 19:32:44 ks dhcpd: DHCPDISCOVER from 5c:b9:01:92:f6:34 via ens192
Mar  8 19:32:44 ks dhcpd: DHCPOFFER on 172.16.235.95 to 5c:b9:01:92:f6:34 via ens192

......

這是來自 DHCP 伺服器的 tcpdump port 67

  0.0.0.0.bootpc > 255.255.255.255.bootps: [udp sum ok] BOOTP/DHCP, Request from 5c:b9:01:92:f6:34, length 359, xid 0xe8ffad6f, Flags [Broadcast] (0x8000)
         Client-Ethernet-Address 5c:b9:01:92:f6:34
         Vendor-rfc1048 Extensions
           Magic Cookie 0x63825363
           DHCP-Message Option 53, length 1: Request
           Server-ID Option 54, length 4: 172.16.234.112
           Requested-IP Option 50, length 4: 172.16.235.95

    ......

           GUID Option 97, length 17: 0.55.53.53.50.53.56.54.67.85.53.52.49.88.52.75.88
           NDI Option 94, length 3: 1.3.16
           ARCH Option 93, length 2: 7
           Vendor-Class Option 60, length 32: "PXEClient:Arch:00007:UNDI:003016"
           END Option 255, length 0

19:32:28.031210 00:0c:29:c6:72:77 > Broadcast, ethertype IPv4 (0x0800), length 342: (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328)
   172.16.234.112.bootps > 255.255.255.255.bootpc: [udp sum ok] BOOTP/DHCP, Reply, length 300, xid 0xe8ffad6f, Flags [Broadcast] (0x8000)
         Your-IP 172.16.235.95
         Server-IP 172.16.234.112
         Client-Ethernet-Address 5c:b9:01:92:f6:34
         file "BOOTX64.EFI"[|bootp]

似乎伺服器提供BOOTX64.EFI但客戶端不接受,因為 tcpdump ‘port 69` 沒有返回任何內容。

在傳統模式下,tcpdump 埠 69,文件由客戶端下載。

從上面的資訊看,Server 的身份是

PXEClient:Arch:00007:UNDI:003016

應該匹配else並載入BOOTX64.EFI

所以我很困惑,怎麼了?

什麼是 UEFI 配置等價物,它應該匹配客戶端(檢測它是 UEFI 還是 Legacy),並且應該有一個與pxelinux.0引導載入程序相同的文件,以及一個用於讀取引導菜單的文件。歡迎任何建議。

我用Google搜尋了一整天,沒有找到任何有用的東西,包括 Redhat Docs。

explore1,從這個頁面上看,說syslinux.efi的是和我一樣的pxelinux.0,我改了dhcpd.conf重啟,也不行。

  • pxelinux.0 為您提供了一個 PXE 菜單,用於引導舊版目標
  • BOOTX64.EFI 將幫助您啟動特定的 Linux 發行版,但您不會有不同 PXE 啟動資產的菜單
  • pxelinux.efi syslinux.efi為您提供用於引導UEFI目標

可悲的是我輸入了錯誤的 IP 地址 option routers 172.17.232.1; 應該是 172.16 而不是 172.17

謝謝大家。

引用自:https://serverfault.com/questions/957353