How to build linux PXE server

system: Fedora11

參考了網上一些資料,具體網址忘了,請原諒

You need install tftp, xinetd, nfs, dhcp service
if your dhcp server isn't the same with PXE server, you may need to do some change. I don't do that test.
1. setup tftp
#vim /etc/xinetd.d/tftp
    service tftp
    {
    disable                                 = no       #default is yes, change to no
    socket_type             = dgram
    protocol                = udp
    wait                    = yes
    user                    = root
    server                  = /usr/sbin/in.tftpd
    server_args             = -u nobody -s /tftpboot  #everyone can access
    per_source              = 11
    cps                     = 100 2
    flags                   = IPv4
    }

#/etc/init.d/xinetd restart
Check tftp is work
#chkconfig --list |grep tftp
tftp:           on

2. setup nfs
#mkdir /PXE
#vim /etc/exports
    /tftpboot *(ro,sync)
    /PXE *(ro,sync)

#/etc/init.d/nfs restart
check share directory
#Showmount –e localhost   
Export list for localhost:
/PXE      *
/tftpboot *

3. setup dhcp
#vim /etc/dhcpd.conf
    ddns-update-style interim;
    ignore client-updates;
    allow booting;
    allow bootp;
    subnet 192.168.1.0 netmask 255.255.255.0 {
    option routers 192.168.1.1;  #this IP is your PXE server IP address
    option subnet-mask 255.255.255.0;
    option domain-name-servers 192.168.1.1;
    option time-offset -18000;
    range dynamic-bootp 192.168.1.2 192.168.1.254;
    default-lease-time 21600;
    max-lease-time 43200;
    next-server 192.168.1.1;
    filename "/pxelinux.0";  
    }

#/etc/init.d/dhcpd restart

4. setup PXE
#mkdir /tftpboot/pxelinux.cfg
create fold under /PXE for the system you want to install
#mkdir /PXE/fedora12
you can use iso or copy DVD or CD file to fedora12 fold
#mount yourpath/fedora12.iso /PXE/fedora12 -o loop
#cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
#cp /PXE/fedora12/isolinux/vmlinuz /tftpboot/
#cp /PXE/fedora12/isolinux/initrd.img /tftpboot/
#cp /PXE/fedora12/isloinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
vesamenu.c32 only fedora12 use, centOS doesn't need
cp /PXE/fedora12/vesamenu.c32 /tftpboot/

5. Install system
power on other PC, press F12 to boot from PXE server
select NFS, and input your IP and directory /PXE/fedora12
if you want to use cd, you need copy each cd to /PXE/yourfold/, if disk2 has the same file in disk1, cover it.


dhcpd.conf配置的有關說明:
parameters(參數):
ddns-update-style 配置DHCP-DNS互動更新模式
default-lease-time 指定缺省租賃時間的長度,單位是秒
max-lease-time 指定最大租賃時間長度,單位是秒
hardware 指定網卡接口類型和MAC地址
server-name 通知DHCP客戶服務器名稱
get-lease-hostnames flag 檢查客戶端使用的IP地址
fixed-address ip 分配給客戶端一個固定的地址
authritative 拒絕不正確的IP地址的要求
declarations(聲明):
shared-network 用來告知是否一些子網絡分享相同網絡
subnet 描述一個IP地址是否屬於該子網
range 起始IP 終止IP 提供動態分配IP 的範圍
host 主機名稱 參考特別的主機
group 爲一組參數提供聲明
allow unknown-clients或deny unknown-client 是否動態分配IP給未知的使用者
allow bootp或deny bootp 是否響應激活查詢
allow booting或deny booting 是否響應使用者查詢
filename 開始啓動文件的名稱,應用於無盤工作站
next-server 設置服務器從引導文件中裝如主機名,應用於無盤工作站
option(選項):
subnet-mask 爲客戶端設定子網掩碼
domain-name 爲客戶端指明DNS名字
domain-name-servers 爲客戶端指明DNS服務器IP地址
host-name 爲客戶端指定主機名稱
routers 爲客戶端設定默認網關
broadcast-address 爲客戶端設定廣播地址
ntp-server 爲客戶端設定網絡時間服務器IP地址

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章