什麼是 HTTP Boot? 官方網站說明 https://github.com/tianocore/tianocore.github.io/wiki/HTTP-Boot
裡面有提到 UEFI , EDK II 以及 HTTP Boot 先來了解一下.
- UEFI
Extensible Firmware Interface (EFI) 的功能就類似傳統 BIOS ,他是 OS 與硬體之間溝通介面. 不過相較於傳統的 BIOS EFI 他的架構更模組化,功能更強大.EFI 的架構是由 Intel 提出的, 目前是交由 Unified EFI Forum 來管理.也就是我們現在所稱的 Unified Extensible Firmware Interface (UEFI) - EDK II
EDK II is a modern, feature-rich, cross-platform firmware development environment for the UEFI and Platform Initialization(PI) specifications.
EDK II is open source, using a BSD(FreeBSD) license.
EDK II is a development code base for creating UEFI drivers, applications and firmware images. - HTTP Boot
傳統的網卡 ROM 裡面存放了一些基本的網路協定如: Internet Protocol (IP), User Datagram Protocol (UDP), Dynamic Host Configuration Protocol (DHCP) 以及 Trivial File Transfer Protocol (TFTP) 透過這一些協定使得網卡在系統開機後就可以直接進行網路存取,進一步取得開機檔案與程序,這就是所謂的 PXE .
新的 iPXE 就支援比較多的開機模式,可以從 web server via HTTP , iSCSI SAN , Fibre Channel SAN via FCoE , AoE SAN , wireless network , wide-area network , infiniband network.
iPXE 可以直接把它燒錄到 網卡 ROM 內,或是透過一般的 PXE ROM 開機,但後續的工作環境透過 iPXE 來運作並搭配他的 Script + command line 命令列指令來操作.EDK II 有支援從 HTTP Boot 開機的選項,同時支援 IPv4 與 IPv6 的環境.
設定參考文件: https://github.com/tianocore-docs/Docs/raw/master/White_Papers/EDKIIHttpBootGettingStartedGuide_0_8.pdf
EDK II HTTP Boot 需要下列服務 DHCP (v4 或 v6) , DNS , Web Server .
- HTTP Boot 測試所需服務都架設在 CentOS 6.8 x68_64 ( IPv4: 192.6.1.1/24 , IPv6: 3ffe:501:ffff:100::1/64 )
- 還需要有一台有支援 HTTP Boot 開機的系統.
設定 DHCPv4
[root@localhost ~]# vi /etc/dhcp/dhcpd.conf #ddns-update-style interim; ddns-update-style none; ignore client-updates; allow booting; allow bootp; subnet 192.6.1.0 netmask 255.255.255.0 { range 192.6.1.50 192.6.1.250; option broadcast-address 192.6.1.255; option subnet-mask 255.255.255.0; option vendor-class-identifier “HTTPClient”; option bootfile-name “http://192.6.1.1/EFI/Shell.efi”; }
DHCP v4 設定需注意的地方如下,開機檔案請依據實際位置設定.
- option vendor-class-identifier “HTTPClient”;
- bootfile-name “http://192.6.1.1/EFI/Shell.efi”;
設定 DHCPv6
[root@localhost ~]# vi /etc/dhcp/dhcpd6.conf default-lease-time 600; max-lease-time 7200; log-facility local7; option dhcp6.vendor-class code 16 = {integer 32, integer 16, string}; subnet6 3ffe:501:ffff:100::1/64 { range6 3ffe:501:ffff:100::100 3ffe:501:ffff:100::200 option dhcp6.vendor-class 0 0 “HTTPClient”; option dhcp6.bootfile-url “http://3ffe:501:ffff:100::1/EFI/Shell.efi”; }
DHCP v6 設定需注意的地方如下,開機檔案請依據實際位置設定.
- option dhcp6.vendor-class 0 0 “HTTPClient”;
- option dhcp6.bootfile-url “http://3ffe:501:ffff:100::1/EFI/Shell.efi”;
DNS
如果你跟我一樣只有使用到 IP ,DNS 為非必要.
Web Server (Apache)
RHEL 預設的 Web Server 為 Apache,須確認服務已開啟.
[root@localhost ~]# service httpd status httpd (pid 3688) is running...
整合 PXE 環境
可能你的環境已經有舊的 Legacy PXE ,我們可以把 UEFI PXE, HTTP Boot 都整合在同一台伺服器.只需要修改 DHCP 的設定即可.
- DHCP IPv4
[root@localhost ~]# cat /etc/dhcp/dhcpd.conf #ddns-update-style interim; ddns-update-style none; ignore client-updates; allow booting; allow bootp; subnet 192.6.1.0 netmask 255.255.255.0 { range 192.6.1.50 192.6.1.250; option broadcast-address 192.6.1.255; option subnet-mask 255.255.255.0; if option arch = 00:010 { option vendor-class-identifier “HTTPClient”; option bootfile-name “http://192.6.1.1/EFI/Shell.efi”; } else { next-server 192.6.1.1; filename "linux-install/pxelinux.0"; } }
重點就是 if option arch = 00:010 ,如果 PXE Client 是透過 x64 uefi boot from http ( Architecture Type : 0x00:0x10 ) 就使用 Shell.efi 為開機檔案,要不然就是採傳統的開機 pxelinux.0 .
- DHCP IPv6
[root@localhost ~]# cat /etc/dhcp/dhcpd6.conf default-lease-time 600; max-lease-time 7200; log-facility local7; option dhcp6.vendor-class code 16 = {integer 32, integer 16, string}; subnet6 3ffe:501:ffff:100::1/64 { range6 3ffe:501:ffff:100::100 3ffe:501:ffff:100::200 if option dhcp6.arch-type = 00:010 { option dhcp6.vendor-class 0 0 “HTTPClient”; option dhcp6.bootfile-url “http://3ffe:501:ffff:100::1/EFI/Shell.efi”; } else { option dhcp6.bootfile-url “http://3ffe:501:ffff:100::1/EFI/grub64.efi”; } }
重點就是 if option dhcp6.arch-type = 00:010 (如果 isc-dhcp 版本為 4.4 參數需改成 dhcp6.client-arch-type) ,如果 PXE Client 是透過 x64 uefi boot from http ( Architecture Type : 0x00:0x10 ) 就使用 Shell.efi 為開機檔案,要不然就是採 UEFI 的開機檔 grub64.efi .
- DHCP 支援與 HTTP Boot 相關的 Architecture Type 如下:
- 0x00:0x0f – x86 uefi boot from http
- 0x00:0x10 – x64 uefi boot from http
- 0x00:0x11 – ebc boot from http
- 0x00:0x12 – arm uefi 32 boot from http
- 0x00:0x13 – arm uefi 64 boot from http
- 0x00:0x14 – pc/at bios boot from http
- 0x00:0x17 – arm uboot 32 boot from http
- 0x00:0x18 – arm uboot 64 boot from http
- 0x00:0x1a – RISC-V 32-bit UEFI boot from http
- 0x00:0x1c – RISC-V 64-bit UEFI boot from http
- 0x00:0x1e – RISC-V 128-bit UEFI boot from http
使用的開機檔案會有不同.
其他關於 DHCP 支援的 Architecture Type.詳細請參考 整合性的 PXE 環境設定 https://benjr.tw/16194 說明.
遇過的問題
作業系統為 CentOS 8 ISC DHCP v4.4
無法啟動 dhcpd6 服務,透過 # journalctl -xe 顯示以下的錯誤訊息.
no option named arch-type in space dhcp6
檢視官方文件 https://kb.isc.org/docs/isc-dhcp-44-manual-pages-dhcp-options#standard-dhcpv6-options 說明 dhcp6.arch-type 參數需改成 dhcp6.client-arch-type .
請問有機會辨識HTTPS還是HTTP嗎?