半自动版本 PXE批量装windows( 二 )


设置dhcp服务器
[root@localhost windows]# vim /etc/dhcp/dhcpd.conf
设置:
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.example
#   see dhcpd.conf(5) man page
#
subnet 192.168.40.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.40.200 192.168.40.250;
option broadcast-address 192.168.40.255;
option routers 192.168.40.1;
option subnet-mask 255.255.255.0;
next-server 192.168.40.254;
filename "pxelinux.0";
}
从上而下解释:
设置dhcp服务器网段和子网掩码,再设置ip地址动态范围,设置广播地址,设置路由地址,设置子网掩码,设置tftp服务器地址,最后设置下bootlocader文件名
启动dhcp服务并纳入开机自启
[root@localhost windows]# systemctl enable dhcp && systemctl start dhcp

  1. 服务端1搭建tftp服务器
下载tftp
[root@localhost windows]# yum –y install tftp
设置tftp服务器(简单文本传输)
[root@localhost windows]# vim /etc/xinetd.d/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 /var/lib/tftpboot
disable                 = yes
per_source              = 11
cps                     = 100 2
flags                   = IPv4
}
将disable=yes改为disable=no 意思是启用tftp启动tftp服务并纳入开机自启
[root@localhost windows]# systemctl enable xinetd && systemctl start xinetd
查询tftp状态:
[root@localhost windows]# netstat -a| grep tftpudp6       0      0 [::]:tftp               [::]:*          [::]:*
  1. 服务端1安装syslinux服务(pxe)
安装
[root@localhost windows]# yum -y install syslinux
将pxelinux0、memdisk、menu.c32复制到tftp默认共享目录
[root@localhost windows]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/[root@localhost windows]# cp /usr/share/syslinux/menu.c32 /var/lib/tftpboot/[root@localhost windows]# cp /usr/share/syslinux/memdisk /var/lib/tftpboot/创建默认的pxe启动配置菜单,winpe_amd64.iso是windows7_x64的pe镜像
[root@localhost windows]# mkdir /var/lib/tftpboot/pxelinux.cfg[root@localhost windows]# vim /var/lib/tftpboot/pxelinux.cfg/defaultUI menu.c32

经验总结扩展阅读