PXE Remote Boot --- Linux


作者﹕網中人 <netman@study-area.org>
文件目的﹕ 在 Linux 上建置 PXE server ﹐並利用網路啟動 Windows 系統。 作業系統版本﹕ Server: OS: RedHat Linux 7.3 IP: 192.168.100.73 hostname: rh73.siyongc.domain Client: OS: Microsoft Windows SE IP: 192.168.100.26 hostname: diamond.siyongc.domain 程式版本﹕ Linux: BpBatch (tar.gz) (02/11/2000) http://www.bpbatch.org/downloads/bpb-exe.tar.gz Windows: BpBatch (zip) (02/11/2000) http://www.bpbatch.org/downloads/bpb-exe.zip PXE: 2.0 (built-in NIC) ---------------------------------------------- ----------- Server 實作﹕ 1) 確定在 server 上裝有這些套件﹕ dhcp nfs-utils portmap ttftp-server 如果沒有﹐請用 rpm 安裝好。例如 cd3 的 tftp-server 之安裝如下﹕ rpm -ivh /mnt/cdrom/RedHat/RPMS/tftp-server-0.28-2.i386.rpm 2) 確定 tftp 服務有啟動﹐修改 /etc/xinetd.d/tftp 檔﹕ disable = no 3) 修改 /etc/dhcpd default-lease-time 864000; max-lease-time 1296000; use-host-decl-names on; shared-network siyongc { option domain-name "siyongc.domain"; subnet 192.168.100.0 netmask 255.255.255.0 { range 192.168.100.100 192.168.100.200; option broadcast-address 192.168.100.255; option routers 192.168.100.73; option domain-name-servers 192.168.100.73, 168.95.1.1; option netbios-name-servers 192.168.100.73; group { default-lease-time -1; next-server 192.168.100.73; # option dhcp-class-identifier "PXEClient"; option vendor-encapsulated-options 01:04:00:00:00:ff; host diamond { hardware ethernet 00:50:04:C1:EA:9C; fixed-address 192.168.100.26; option broadcast-address 192.168.100.255; option option-135 "win98"; filename "bpbatch"; } } } } 4) 重新啟動以上 service ﹐並確定在開機的時候能夠啟動﹕ for SRV in network dhcpd portmap nfs nfslock xinetd; do service $SRV restart chkconfig $SRV on done 5) 下載 bpbatch 軟體﹕ cd /tftpboot wget http://www.bpbatch.org/downloads/bpb-exe.tar.gz tar zxvf bpb-exe.tar.gz mv bpbatch.P bpbatch 6) 撰寫 win98 之 batch 檔﹐建立 /tftpboot/win98.bpb ﹐內容如下﹕ hidelog setpartitions "fat32:2000" setbootpart 1 clean 1 fullunzip "win98.imz" 1 hidebootprom hdboot :1 ----------- Client 實作 1) 安裝樣板主機﹐確定系統全部裝在 C﹕磁碟。 2) 完成所有設定。 3) 從網路下載 bpb-exe 壓縮檔﹕ http://www.bpbatch.org/downloads/bpb-exe.zip 4) 建立 c:\temp\bpb-exe 目錄(請不要使用其它路徑)﹐並將檔案解壓之該目錄中。 5) 撰寫壓縮批次檔﹐建立 c:\temp\bpb-exe\zipwin.mrz 檔﹐內容如下﹕ showlog filter -"windows/schedlog.txt" filter -"windows/msimgsiz.dat" filter -"*/index.dat" filter -"*.swp" filter -"*.tmp" filter -"temp/*" fullzip "c:/" "win98.imz" 6) 然後進入 dos 模式﹐並執行如下命令﹕ c: cd c:\temp\bpb-exe mrzip -b zipwin # 注意﹕參數檔去掉 .mrz 副檔名。 6) 如果沒錯誤信息的話﹐上面會產生兩個(或多個)壓縮檔﹐名稱分別為﹕ win98.imz win98.im1 7) 不管使用何種方法﹐將以上兩個檔案複製到 server 端的 /tftpboot 目錄內。 8) 重新啟動系統並進行測試。 *注意﹕ 建議使用另外的硬碟﹐否則原內容全部會被刪除﹗ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ 然而,以上只是一個 draft 而已,仍有許多計術細節須要調整的。比方說: * 必須依賴 bpbatch 程式,並非使用標準 pxe server * client 端必須具備 hd * 尚未解決 ram disk 方案 * 網路磁碟仍未設定 * 未能選擇(協調)開機環境 歡迎有興趣的朋友參考,並分享進一步的心得。 netman 2002/07/28