酷!學園
2010-09-03 13:09 *
歡迎光臨, 訪客. 請先 登入註冊一個帳號.
您忘了 啟用您的帳號嗎?

請輸入帳號, 密碼以及預計登入時間
新聞:
 
   首頁 | Study-Area | 鳥園 | 鳥哥的Linux私房菜   說明 搜尋 日曆 登入 註冊  
頁: [1]
  列印  
作者 主題: [分享]PXE(Pre-eXecuteion Environment) server  (閱讀 21155 次)
0 會員 以及 1 訪客 正在閱讀本篇主題.
HomeSun
可愛的小學生
*
文章: 12


檢視個人資料
« 於: 2003-10-03 10:26 »

PXE 安裝

所需的環境,DHCP server,PXE server以及具有 PXEboot 功能的 client .
Step1 : DHCP Server 的設定
DHCP Server 的設定檔至少要包含以下的設定值
#vi /etc/dhcpd.conf
----------------------------------------------------------------------------------------
ddns-update-style interim;
ignore client-updates;
subnet 192.10.0.0 netmask 255.255.255.0
{
 range dynamic-bootp 192.10.0.10 192.10.0.15;
}
----------------------------------------------------------------------------------------
DHCP,PXE server 預設是不能架在同一台上,需修改 /etc/pxe.conf 檔才能使用在同一台機器上
 
Step2:tftp,mtftp daemon
在架設 PXE server  時還需同時啟動 tftp or mtftp daemon ,mtftp 是具有 Multicast 功能的 tftp(為何只能用 tftp or mtftp ,因為 PXE ROM 只具備 UDP 的功能,所以只能使用以 UDP 為通信協定的  tftp or mtftp)
I.啟動 tftp
chkconfig tftp on
 
II.啟動 mtftp
因為系統並沒有為 mtftp 寫啟動設定檔 /etc/xinetd.d/mtftp ,所以我們將修改 /etc/xinetd.d/tftp 檔
#cp /etc/xinetd.d/tftp  /etc/xinetd.d/mtftp
#vi /etc/xinetd.d/mtftp
--------------------------------------------------------------------------------------------
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol.  The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service mtftp
{
 disable = no
 socket_type  = dgram
 protocol  = udp
 wait   = yes
 user   = root
 server   = /usr/sbin/in.mtftpd
 server_args  = -s /tftpboot
 per_source  = 11
 cps   = 100 2
}

--------------------------------------------------------------------------------------------
只有service mtftp, server = /usr/sbin/in.mtftpd 要修改
 
III.啟動 mtftp
chkconfig mtftp on
 
#chkconfig --list | grep tftp
 mtftp: on
 tftp: on

Step3: PXE Server  的設定
I.安裝 PXE Server 套件
#rpm -ivh pxe-...........rpm
 
II.PXE server 的設定檔 /etc/pxe.conf
預設的設定檔就可以使用了,但是我還要安裝其他版本的 RedHat Linux ,所以還是要修改一下設定檔
#vi /etc/pxe.conf
-------------------------------------------------------------------------------------
# Prompt to display on the user screen
# format of this entry: timeout,<STRING>
[Prompt]
10,Press F8 to view menu ...

# Boot server types supported
[Service_Types]
0,BStrap
13,linux-install-rh73
14,linux-install-rh80
15,linux-install-rh90

# Menu string that will be displayed on the client screen
# after F8 is pressed.
[X86PC/UNDI/MENU]
0,Local Boot
13,RedHat 7.3 Install Linux
14,RedHat 8.0 Install Linux
15.RedHat 9.0 Install Linux

# Image file name for Linux install boot server type
# format :
[X86PC/UNDI/linux-install-rh73/ImageFile_Name]
0
2
linux
[X86PC/UNDI/linux-install-rh80/ImageFile_Name]
0
2
linux
[X86PC/UNDI/linux-install-rh90/ImageFile_Name]
0
2
linux
[X86PC/UNDI/BStrap/ImageFile_Name]
0
0
bstrap
-------------------------------------------------------------------------------------
說明:
I.首先要新增的是 PXE 開機時的選單
[X86PC/UNDI/MENU]
0,Local Boot
13,RedHat 7.3 Install Linux
14,RedHat 8.0 Install Linux
15.RedHat 9.0 Install Linux
II.因為 RedHat Linux 的不同版本所需的開機 kernel,initrd imag 也不同,所以要為每一版 RedHat Linux 建立不同的資料夾
# Boot server types supported
[Service_Types]
0,BStrap
13,linux-install-rh73
14,linux-install-rh80
15,linux-install-rh90
其中的數字必須要和 boot menu ([X86PC/UNDI/MENU] 所指定的)相同,至於目錄下還可以做不同設定,所以還要加上以下的設定.
[X86PC/UNDI/linux-install-rh73/ImageFile_Name]    
0
2
linux
[X86PC/UNDI/linux-install-rh80/ImageFile_Name]
0
2
linux
[X86PC/UNDI/linux-install-rh90/ImageFile_Name]
0
2
linux
路徑部分還要和 Service_Types 相配合(ex:13,linux-install-rh73 時路徑名稱需為 X86PC/UNDI/linux-install-rh73/ImageFile_Name)
而以上的 0,2,linux 所代表的是 PXE 安裝要用到 bootstrap + kernel + initrd 檔
還有其他的組合為
0,0,linux 所代表的是 PXE 安裝要用到 bootstrap 檔
0,1,linux 所代表的是 PXE 安裝要用到 bootstrap + kernel檔
III.重新啟動 PXE
#chkconfig pxe on
#service pxe restart
or
# /etc/init.d/pxe restart
 
IV.確定 /etc/services 中 PXE,mtftp 的相對應 port 已經開啟
#vi /etc/services
----------------------------------------------------------------------------
mtftp                  1759/udp
pxe                     67/udp
pxe                     4011/udp
----------------------------------------------------------------------------    
這些 port number 都是 PXE Boot 所必須的
 
#route add -host 255.255.255.255.255 eth0
我們可以把這一行加到 /etc/rc.local 中,使每次開機時都能執行.
 
V.設定 PXE 安裝所需的光碟內容
我需要 RedHat 90,RedHat 80,RedHat 7.3 等不同板本的 RedHat Linux(以下用 RedHat 9.0為範例)
所以要先建立目錄來安裝 RedHat 90 目錄,並將三片光碟的內容放在此目錄
#mkdir /var/ftp/rh90
放第一片光碟
#mount /mnt/cdrom
#cp -r /mnt/cdrom/*  /var/ftp/rh90
複製第一片光碟內容
#umount /mnt/cdrom
放第二片光碟
#mount /mnt/cdrom
#cp -r /mnt/cdrom/*  /var/ftp/rh90
複製第二片光碟內容
#umount /mnt/cdrom
放第三片光碟
#mount /mnt/cdrom
#cp -r /mnt/cdrom/*  /var/ftp/rh90
複製第三片光碟內容
其他 RedHat 8.0 ,RedHat7.3 方法皆同
 
VI.PXE 開機時所需的 kernel,initrd imag
PXE 開機時會依據 /etc/pxe.conf 設定去存取不同的目錄來得到所許的開機 kernel,initrd imag
I.RedHat 73 所需的 kernel,initrd imag
RedHat 73 使用PXE 開機時所需的 kernel,initrd imag 皆儲存在第一片光碟(我們之前已經將光碟內容複製 /var/ftp/rh73 目錄下,所以從 /var/ftp/rh73/images/pxeboot/ 目錄找即可)
先建立 /tftpboot/X86PC/UNDI/linux-install-rh73 目錄
#cp /var/ftp/rh73/images/pxeboot/vmlinux  /tftpboot/X86PC/UNDI/linux-install-rh73/linux.1
note: linux.1 是 linux kernel
#cp /var/ftp/rh73/images/pxeboot/initrd.img  /tftpboot/X86PC/UNDI/linux-install-rh73/linux.2
note: linux.2 是 linux installation initrd image
note: 還要記得將 linux.0 複製到 /tftpboot/X86PC/UNDI/linux-install-rh73 目錄下
I.RedHat 80 所需的 kernel,initrd imag
RedHat 80 使用PXE 開機時所需的 kernel,initrd imag 皆儲存在第一片光碟(我們之前已經將光碟內容複製 /var/ftp/rh80 目錄下,所以從 /var/ftp/rh80/images/pxeboot/ 目錄找即可)
先建立 /tftpboot/X86PC/UNDI/linux-install-rh80 目錄
#cp /var/ftp/rh80/images/pxeboot/vmlinux  /tftpboot/X86PC/UNDI/linux-install-rh80/linux.1
note: linux.1 是 linux kernel
#cp /var/ftp/rh80/images/pxeboot/initrd.img  /tftpboot/X86PC/UNDI/linux-install-rh80/linux.2
note: linux.2 是 linux installation initrd image
note: 還要記得將 linux.0 複製到 /tftpboot/X86PC/UNDI/linux-install-rh80 目錄下
I.RedHat 90 所需的 kernel,initrd imag
RedHat 90 使用PXE 開機時所需的 kernel,initrd imag 皆儲存在第一片光碟(我們之前已經將光碟內容複製 /var/ftp/rh90 目錄下,所以從 /var/ftp/rh90/images/pxeboot/ 目錄找即可)
先建立 /tftpboot/X86PC/UNDI/linux-install-rh90 目錄
#cp /var/ftp/rh90/images/pxeboot/vmlinux  /tftpboot/X86PC/UNDI/linux-install-rh90/linux.1
note: linux.1 是 linux kernel
#cp /var/ftp/rh90/images/pxeboot/initrd.img  /tftpboot/X86PC/UNDI/linux-install-rh90/linux.2
note: linux.2 是 linux installation initrd image
note: 還要記得將 linux.0 複製到 /tftpboot/X86PC/UNDI/linux-install-rh90 目錄下
Step4: 安裝
I.FTP 安裝
光碟的內容皆存放在 /var/ftp 目錄下,所以用 FTP 安裝時只要指定 /var/ftp 下的子目錄即可(ex:用 FTP 安裝只要指定 /rh73 or /rh80 or /rh90 即可).
 
II.NFS 安裝
若採取 NFS 的安裝法時要分享安裝目錄
#vi /etc/exports
----------------------------------------------------------------
/var/ftp/rh90      192.10.0.*(ro)
/var/ftp/rh80      192.10.0.*(ro)
/var/ftp/rh73      192.10.0.*(ro)
----------------------------------------------------------------

III.HTTP 安裝
若採取 HTTP 的安裝法時要修改 /etc/httpd/conf/httpd.conf
#vi /etc/httpd/conf/http.conf
-----------------------------------------------------------------
Document Root "/var/ftp"
-----------------------------------------------------------------
將 Document Root  改為 "/var/ftp" 即可
 
Step5: PXE Clients 安裝
啟動網路卡的 PXE 功能並將他的開機順序列為最高
..........................................          
接下來的安裝就如同光碟安裝一般
 
Step6: 加入其它 Linux Distribution 至 PXE Server
SuSe 8.2 powered by UnitedLinux
I.同樣的將 SuSe 8.2 五片光碟內容複製到 NFS Server 中所建立的目錄下
#mkdir /var/ftp/SuSE82
放第一片光碟
#mount /mnt/cdrom
#cp -r /mnt/cdrom/* /var/ftp/SuSE82
複製第一片光碟內容
#umount /mnt/cdrom
放第二片光碟
#mount /mnt/cdrom
#cp -r /mnt/cdrom/* /var/ftp/SuSE82
複製第二片光碟內容
#umount /mnt/cdrom
放第三片光碟
#mount /mnt/cdrom
#cp -r /mnt/cdrom/* /var/ftp/SuSE82
複製第三片光碟內容
放第四片光碟
#mount /mnt/cdrom
#cp -r /mnt/cdrom/* /var/ftp/SuSE82
複製第四片光碟內容
放第五片光碟
#mount /mnt/cdrom
#cp -r /mnt/cdrom/* /var/ftp/SuSE82
複製第五片光碟內容
 
II.並將 SuSe 所在目錄設為分享
#vi /etc/exports
----------------------------------------------------------------
/var/ftp/rh90       192.10.0.*(ro)
/var/ftp/rh80       192.10.0.*(ro)
/var/ftp/rh73       192.10.0.*(ro)
/var/ftp/SuSE82     192.10.0.*(ro)
----------------------------------------------------------------
 
III.而SuSE 8.2 的 kernel,initrd 存放在第一片光碟中 boot 目錄下的 bootdisk (我們之前已經將光碟內容複製 /var/ftp/SuSE82 目錄下,所以從 /var/ftp/SuSE82/boot/ 目錄找即可)
#cd /var/ftp/SuSE82/boot
#mount -o loop bootdisk /mnt/floppy
#cp /mnt/floppy/linux  /tftpboot/X86PC/UNDI/linux-install-su82/linux.1
#umount /mnt/floppy
因為 bootdisk 為 image file 所以要用 mount 加 -o loop 參數才能看到 image file 的內容,
linux 是 linux kernel ,接下來要找到 initrd 它是存在 /boot/modules1 中
#mount - o loop modules1 /mnt/floppy
#cp /mnt/floppy/initrd  /tftpboot/X86PC/UNDI/linux-install-su82/linux.2
#umount /mnt/floppy
這個 initrd 只包括 USB,SCSI 的 module 所以在安裝時會找不到網路卡而無法用網路安裝,所以要製作網路 module 的磁片(SuSe 8.2 有提供),名稱為 /boot/modules3(它也是 image file 所以要用 dd 來做磁片)
#dd if=/boot/modules3 of=/dev/fd0
note: 還要記得將 linux.0 複製到 /tftpboot/X86PC/UNDI/linux-install-SuSE82 目錄下

IV. 修改 PXE server 的設定檔 /etc/pxe.conf
# Boot server types supported
[Service_Types]
0,BStrap
13,linux-install-rh73
14,linux-install-rh80
15,linux-install-rh90
16,linux-install-su82
# Menu string that will be displayed on the client screen
# after F8 is pressed.
[X86PC/UNDI/MENU]
0,Local Boot
13,RedHat 7.3 Install Linux
14,RedHat 8.0 Install Linux
15.RedHat 9.0 Install Linux
16.SuSE 8.2    Install Linux
# Image file name for Linux install boot server type
# format :
[X86PC/UNDI/linux-install-su82/ImageFile_Name]
0
2
linux
 
重新啟動 PXE
#service pxe restart
or
# /etc/init.d/pxe restart
Client 端就可以用 PXE 安裝了(記得要上 network modules 喔)
 
所有的項目皆是用 RedHat Linux 為範例
已記錄
bensonwu
懷疑的國中生
**
文章: 33


檢視個人資料
« 回覆文章 #1 於: 2003-10-03 11:16 »

感謝分享 不過這東西的用途 可否介紹一下~
已記錄
HomeSun
可愛的小學生
*
文章: 12


檢視個人資料
« 回覆文章 #2 於: 2003-10-03 13:08 »

主要用在 linux 的網路安裝 "直接使用網路卡來開機"
已記錄
Leo
可愛的小學生
*
文章: 10


檢視個人資料
« 回覆文章 #3 於: 2003-10-04 01:39 »

如果linux.0是用pxelinux.0,
        linux.1是用memdisk,
        linux.2是用軟碟映像檔(如ghost wizard的網路開機片),
就可用來做pxe的ghost server
不過, 我通常都只用DHCP SERVER+TFTP SERVER就可以包辦一切了,不太用PXE SERVER

PXE SERVER好像只是一種DHCP PROXY SERVER是嗎?
已記錄
netman
管理員
俺是博士!
*****
文章: 15246



檢視個人資料 個人網站
« 回覆文章 #4 於: 2003-10-04 01:57 »

PXE 的關鍵是:Preboot ...
是否 relay dhcp 與它無關。
已記錄
山哥
榮譽學長
懷疑的國中生
**
文章: 33


檢視個人資料 個人網站
« 回覆文章 #5 於: 2003-10-17 09:03 »

relay dhcp 是 forward dhcp packet 到 dhcp server

DHCP PROXY SERVER 是傳送其它 dhcp option 以補足 dhcp server 送出 packet 中 options 的不足. 應用在你無法修改 dhcp server 的 options 又想傳送一些 dhcp option (如 dhcp server 是別人管的)
已記錄
lq3028
可愛的小學生
*
文章: 14


檢視個人資料
« 回覆文章 #6 於: 2004-01-16 03:10 »

ㄏㄏㄏ  我想知道 用pxe server 如何boot dos 才可以用作 run ghost
已記錄
ZMAN
酷!學園 學長們
俺是博士!
*****
會員性別: 男
文章: 6090



檢視個人資料 個人網站
« 回覆文章 #7 於: 2004-01-30 13:14 »

我們先來看PXE的簡略流程
這樣可能比較清楚

1.PXE CLIENT 向提供 DHCP/PROXY DHCP 服務的主機
    送出DHCP Discover to Port 67 Contains "PXEClient" extension tags

2.接下來這部主機回應Extended DHCP Offer to port 68 contains:
   PXE server extension tags + [Other DHCP option tags] +
   Client IP addr

3.接下來PXE CLIENT 就向這部主機送出
    DHCP Request to Installation Server port 67
   Contains "PXEClient" extension tags
   + [Other DHCP option tags]

4.主機回應DHCP Ack reply to Port 68

5.這時候PXE CLIENT改向提供BOOT SERVICE的主機發出
    Boot Service Discover to port 67 or 4011
   Contains: “PXEClient” extension tags
   + [Other DHCP option tags]
   
6.這部主機回應Boot Service Ack reply to client source port
   Contains: [ PXE Server extension tags]
   (contains Network Bootstrap Program file name)

7.這時PXE CLIENT向提供M/TFTP SRERVICE的主機發出
    Network Bootstrap Program download
   request to TFTP port 69 or MTFTP port
   (from Boot Service Ack)

8.然後主機回應
   Network Bootstrap Program Download to Client's port
  這裡就是一般所說的下載BOOT IMAGE

再來看當初發展PXE的願景
Make the Network Interface
a standard, industry-accepted
PC Boot Device
(The Network Interface becomes
a boot device in the same sense that a hard  
drive, floppy, or CD-ROM is a boot device.)

接下來看PXE能作啥

Standard Remote New System Setup
----Remote OS installation
----Remote BIOS Update
----Configuration Remote CMOS Configuration

Standard Remote Pre-OS Management
----Via Remote Wake-Up
----On Demand

Standard Remote OS Boot

所以要玩PXE要具備下列元素
DHCP
TFTP
Network Bootstrap Program(這個是關鍵)
支援PXE的網路介面

這是1998年來自INTEL的訓練資料
有點舊了 現在有什麼變動 哇系莫宰羊啦
已記錄

佈線深似海!
網路高如天!
山哥
榮譽學長
懷疑的國中生
**
文章: 33


檢視個人資料 個人網站
« 回覆文章 #8 於: 2004-02-03 16:53 »

基本上沒什麼變動,就像 zman 大大所講的這樣...
已記錄
ato
可愛的小學生
*
文章: 1


檢視個人資料
« 回覆文章 #9 於: 2004-03-24 15:22 »

請問個位大大,那個"linux.0"要從那裡來ㄚ....一直都找不到...謝謝
已記錄
mouse
可愛的小學生
*
文章: 4


檢視個人資料
« 回覆文章 #10 於: 2005-02-13 12:48 »

請問BOOT IMAGE 要如何制作
已記錄
頁: [1]
  列印  
 
前往:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
本頁花了 0.122 秒,以及 15 次的資料庫查詢。