LSPro建立PXE环境

一、安装和配置tftp服务

1、安装tftp-hpa

ipkg install tftp-hpa
 
  

 

tftp-hpa主要的配置文件有两个:

/opt/etc/xinetd.conf

/opt/etc/xinetd.d/tftp

前者的内容如下,基本无需作任何修改:

# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Sample configuration file for xinetd

defaults
{
        only_from      = localhost 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16
        instances      = 60
        log_type       = SYSLOG authpriv info
        log_on_success = HOST PID
        log_on_failure = HOST
        cps            = 25 30
}

includedir /opt/etc/xinetd.d

后者的内容如下:

#
# ftp://ftp.kernel.org/pub/software/network/tftp/
#
service tftp
{
       flags            = REUSE
       socket_type      = dgram
       protocol         = udp
       instances        = 30
       wait             = yes
       user             = root
       server           = /opt/sbin/in.tftpd
       server_args    = -s /opt/tftpboot
       cps        = 100 2
       log_on_success   = HOST PID
       log_on_failure   = HOST
       disable          = no
}

一般只需要server_args这个参数值,它定义tftp服务的默认工作目录。

2、配置tftp服务

               2.1   设置tftp工作目录

      先在根目录下建立工作目录tftpboot

mkdir /tftpboot

      修改配置文件/opt/etc/xinetd.d/tftp,将server_args的值改为/tftpbooot.

               2.2   建立tftp配置文件目录

     先在tftp工作目录下,建立配置文件目录

mkdir -p /tftpboot/pxelinux.cfg

    再创建一个配置文件

vi /tftpboot/pxelinux.cfg/default

    文件内容如下:

default menu.c32
 
prompt 0
timeout 50
ONTIMEOUT localboot
 
MENU TITLE PXE Menu
 
LABEL localboot
MENU LABEL Boot From Hard Disk
LOCALBOOT  0
 
LABEL CentoS 5.4 i386 Installer
MENU LABEL CentOS 5.4 i386 Installer
KERNEL images/centos/i386/5.4/vmlinuz
append vga=normal initrd=images/centos/i386/5.4/initrd.img ramdisk_size=32768

3、启动tftp服务

/opt/etc/init.d/S10xinetd
 
如果无法启动,可查看/var/log/message寻找原因进行排除。

二、安装和配置DHCP服务

1、安装dhcp服务

ipkg install dhcp

2、配置dhcp服务

dhcp服务的配置文件为:/opt/etc/dhcpd.conf

先备份一下

cp /opt/etc/dhcpd.conf /opt/etc/dhcpd.conf.bak
 
打开dhcpd.conf
vi /opt/etc/dhcpd.conf
 
输入以下内容:
 
 

要配合PXE引导,dhcp的配置文件中必须包含以下几行配置

allow booting;
allow bootp;
option option-128 code 128 = string;
option option-129 code 129 = text;
next-server xxx.xxx.xxx.xxx;  //IP of My PXE Server
filename "/pxelinux.0";
 
然后重新启动dhcp服务
/opt/etc/init.d/S56dhcp
posted @ 2015-02-20 12:48  心哲  阅读(229)  评论(0编辑  收藏  举报