stargood 发表于 2011-3-5 10:40:04

Red Hat Enterprise Server (rhel) 5.5 下安装PXE服务器

Red Hat Enterprise Server (rhel) 5.5 下安装PXE服务器
本人测试用服务器环境:
系统:rhel 5.5,系统运行在init 3运行级上(非图形界面)
DHCP服务监听的网卡:eth0 IP地址: 192.168.5.252/255.255.255.0   
所需软件包:dhcp, tftp-server
PXE启动文件用有PXE支持的GRUB4DOS(GRLDR)
安装软件包:
yum install dhcp
yum install tftp-server
开启服务:
chkconfig dhcpd --level 3 on
chkconfig xinetd --level 3 on (tftp是xinetd类型的服务)
配置文件(本人喜欢把配置文件用脚本来生成, 脚本和配置内容都在同一文件并设置为可执行,而这个配置脚本则保存到可移动盘或网络上,这样对于备份和在其它系统上配置同样的服务也相当方便):
DHCPD服务的配置如下:
#!/bin/bash
scriptname=$0
exportdata()
{
      service dhcpd stop
      $scriptname export > /etc/dhcpd.conf #rhel5中DHCPD的配置文件路径
      echo "DHCPDARGS=eth0">/etc/sysconfig/dhcpd#rhel5中DHCPD启动参数配置文件路径
      service dhcpd start
      exit
}

[ "$1" = "export" ] || exportdata

IFS=$'\n'
for tmp in `cat $scriptname`
do
      [ "$echostart" = "yes" ] && echo $tmp
      [ "$tmp" = "exit" ] && echostart="yes"
done
exit
#配置文件开始
ddns-update-style none;
ddns-updates off;
ignore client-updates;

subnet 192.168.5.0 netmask 255.255.255.0
{
      default-lease-time 1200;
      max-lease-time 2400;
      option netbios-name-servers 192.168.5.252;
      filename "grldr";#启动文件名
      next-server 192.168.5.252;#tftp服务器
      option routers 192.168.5.1;
      option subnet-mask 255.255.255.0;
      range 192.168.5.41 192.168.5.189;
}

将以上内容保存为任意文件名(如:dhcp), 并执行chmod 755 dhcp加上执行属性, 再执行 ./dhcp
将停止dhcpd服务,将配置文件自动生成到合适的位置后再启动dhcpd服务.
TFTP服务的配置:
TFTP软件包安装后会在/etc/xinetd.d目录下生成tftp这个文件,vi tftp编辑这个文件:
# 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 tftp
{
      socket_type                = dgram
      protocol                = udp
      wait                        = yes
      user                        = root
      server                        = /usr/sbin/in.tftpd
      server_args                = -s /tftpboot
      disable                        = no
      per_source                = 11
      cps                        = 100 2
      flags                        = IPv4
}
把 server_args中的/tftpboot替换成自己的目录或使用默认目录.
将grldr和menu.lst放入tftp目录中.
由于tftp服务是xinetd类型的服务,用chkconfig xinetd --level 3 on启用xinetd服务.
重新开始xinetd服务:service xinetd restart
这样PXE客机就可以出现GRUB4DOS的启动菜单了

下列链接是一个MSDOS映像,能自动安装多数网卡驱动,并通过DHCP获取地址,和一个MAXDOS7.0映像,解压到TFTP服务器的根目录下就行了
http://u.115.com/file/f9e444fce3

xyxb 发表于 2011-9-11 07:05:24

兄弟过期了,麻烦再传一个!!!
页: [1]
查看完整版本: Red Hat Enterprise Server (rhel) 5.5 下安装PXE服务器