DHCP:

  DHCP: Dynamic Host Configuration Protocol

    IP/Netmask

    Gateway

    DNS Server

 

ARP: IP --> MAC

RARP: MAC --> IP

 

  bootp: boot protocol  --> dhcp

    租约:

      2hours:

        50%: hours --> 2hours

          50%: 1hours --> 2hours

            75%: 0.5hours --> 2hours

              87.5%: 0.25hours --> 2hours

        dhcp discover

 

    1、Client: dhcp discover: 发现

    2、Server: dhcp offer: (IP/netmask, gw)

    3、Client: dhcp request

    4、Server: dhcp ack

    续租:

      Client: dhcp request

      Server: dhcp ack

      Server: dhcp nak

    Linux DHCP协议的实现程序:dhcp, dnsmasq

    dhcp:

      /usr/sbin/dhcpd

        /etc/dhcp/dhcpd.conf  --> /etc/rc.d/init.d//dhcpd

        /etc/dhcp/dhcpd6.conf  --> /etc/rc.d/init.d/dhcpd6

      /usr/sbin/dhcrelay

        /etc/rc.d/init.d/dhcrelay

      67/udp

      dhclient: 68/udp

    dhcpd.conf

      subnet {

        ...

      }

      host {

      }

 

    # cat /var/lib/dhcpd/dhcpd.leases  #记录的地址分配结果

 

    其他配置选项:

      filename: 指明引导文件路径;

      next-server: 提供引导文件的服务器IP地址;

 

      filename "pxelinux.0";

      next-server 172.16.100.67; 

 

PXE: preboot execute environment, Intel 

  dhcp, tftp, server(yum repository)

CentOS 6 PXE: 

  yum -y install syslinux tftp-server

 

  cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/

  cp /media/cdrom/images/pxelinux/Pvmlinuz,initrd.img} /var/lib/tftp/boot/

  cp /media/cdrom/isolinux/{boot.cfg,vesamenu.c32,splash.png} /var/lib/tftp/boot/

  mkdir /var/lib/tftpboot/pxelinux.cfg/

  cp /media/cdrom/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default/

 

  systemctl start tftp.service

CentOS 7 PXE:

  yum -y install syslinux tftp-server

 

  cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/

  cp /media/cdrom/images/pxelinux/Pvmlinuz,initrd.img} /var/lib/tftp/boot/

  cp /usr/share/syslinux/{chain.c32,mboot.c32,menu.c32,memdisk} /var/lib/tftpboot/

  mkdir /var/lib/tftpboot/pxelinux.cfg/

  创建/var/lib/tftpboot/pxelinux.cfg/default

    内容类似如下:    

    default menu.c32
      prompt 0
      timeout 30
      MENU TITLE CentOS 7 PXE Menu

      LABEL linux
      MENU LABEL Install CentOS 7 x86_64
      KERNEL vmlinuz
      APPEND initrd=initrd.img inst.repo=http://172.16.100.67/centos7 ks=http://172.16.100.67/centos7.cfg

 

实验环境:

node1:

主机名:node1.smoke.com

操作系统:centos 7.5

内核版本:3.10.0-862.el7.x86_64

网卡1:vmnet8 172.16.100.67/24

node2:

主机名:node1.smoke.com

操作系统:centos 7.5

内核版本:3.10.0-862.el7.x86_64

网卡1:vmnet8 172.16.100.68/24

node3:

主机名:node1.smoke.com

操作系统:centos 7.5

内核版本:3.10.0-862.el7.x86_64

网卡1:vmnet8 172.16.100.69/24

node4:

主机名:node1.smoke.com

操作系统:centos 6.10

内核版本:2.6.32-754.el6.x86_64

网卡1:vmnet8 172.16.100.6/24

 

node1:

[root@node1 ~]# yum info dhcp
可安装的软件包
名称    :dhcp
架构    :x86_64
时期       :12
版本    :4.2.5
发布    :79.el7.centos
大小    :515 k
源    :base/7/x86_64
简介    : Dynamic host configuration protocol software
网址    :http://isc.org/products/DHCP/
协议    : ISC
描述    : DHCP (Dynamic Host Configuration Protocol) is a protocol which allows
         : individual devices on an IP network to get their own network
         : configuration information (IP address, subnetmask, broadcast address,
         : etc.) from a DHCP server. The overall purpose of DHCP is to make it
         : easier to administer a large network.
         : 
         : To use DHCP on your network, install a DHCP service (or relay agent),
         : and on clients run a DHCP client daemon.  The dhcp package provides
         : the ISC DHCP service and relay agent.
[root@node1 ~]# yum -y install dhcp
[root@node1 ~]# rpm -ql dhcp
[root@node1 ~]# yum info dnsmasq
可安装的软件包
名称    :dnsmasq
架构    :x86_64
版本    :2.76
发布    :10.el7_7.1
大小    :279 k
源    :base/7/x86_64
简介    : A lightweight DHCP/caching DNS server
网址    :http://www.thekelleys.org.uk/dnsmasq/
协议    : GPLv2 or GPLv3
描述    : Dnsmasq is lightweight, easy to configure DNS forwarder and DHCP server.
         : It is designed to provide DNS and, optionally, DHCP, to a small network.
         : It can serve the names of local machines which are not in the global
         : DNS. The DHCP server integrates with the DNS server and allows machines
         : with DHCP-allocated addresses to appear in the DNS with names configured
         : either in each host or in a central configuration file. Dnsmasq supports
         : static and dynamic DHCP leases and BOOTP for network booting of diskless
         : machines.
[root@node1 ~]# cd /etc/dhcp/
[root@node1 dhcp]# ls
dhclient.d  dhclient-exit-hooks.d  dhcpd6.conf  dhcpd.conf  scripts
[root@node1 dhcp]# cat dhcpd.conf 
[root@node1 dhcp]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example ./dhcpd.conf 
[root@node1 dhcp]# vim dhcpd.conf 
option domain-name "smoke.com";    #dns查询作用域
option domain-name-servers 114.114.114.114, 8.8.8.8;    #dns服务器
default-lease-time 86400;    #默认租约期限
max-lease-time 86400;    #最大租约期限
log-facility local7;    #日志
subnet 172.16.0.0 netmask 255.255.0.0 {    #网络
    range 172.16.100.151 172.16.100.170;    #地址池
}

:.,$s/^[^#]/#/g
[root@node1 dhcp]# systemctl start dhcpd.service
[root@node1 dhcp]# systemctl status dhcpd.service
[root@node1 dhcp]# netstat -unlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
udp        0      0 127.0.0.1:323           0.0.0.0:*                           685/chronyd         
udp        0      0 0.0.0.0:67              0.0.0.0:*                           41471/dhcpd         
udp6       0      0 ::1:323                 :::*                                685/chronyd         

node4:

[root@node4 ~]# man dhclient
[root@node4 ~]# dhclient -d    #dhclient在前端工作
Internet Systems Consortium DHCP Client 4.1.1-P1
Copyright 2004-2010 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/00:0c:29:e7:1c:38
Sending on   LPF/eth0/00:0c:29:e7:1c:38
Sending on   Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6 (xid=0x4b726c14)
DHCPOFFER from 172.16.100.67
DHCPREQUEST on eth0 to 255.255.255.255 port 67 (xid=0x4b726c14)
DHCPACK from 172.16.100.67 (xid=0x4b726c14)
bound to 172.16.100.151 -- renewal in 41318 seconds.
[root@node4 ~]# netstat -unlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
udp        0      0 0.0.0.0:68                  0.0.0.0:*                               52212/dhclient     

node1:

[root@node1 dhcp]# cat /var/lib/dhcpd/dhcpd.leases
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.2.5

server-duid "\000\001\000\001'*\336\211\000\014)\341\212[";

lease 172.16.100.151 {
  starts 2 2020/10/27 13:44:37;
  ends 3 2020/10/28 13:44:37;
  cltt 2 2020/10/27 13:44:37;
  binding state active;
  next binding state free;
  rewind binding state free;
  hardware ethernet 00:0c:29:e7:1c:38;
}

node4:

[root@node4 ~]# ip addr show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:e7:1c:38 brd ff:ff:ff:ff:ff:ff
    inet 172.16.100.6/24 brd 172.16.100.255 scope global eth0
    inet 172.16.100.151/16 brd 172.16.255.255 scope global eth0
    inet6 fe80::20c:29ff:fee7:1c38/64 scope link 
       valid_lft forever preferred_lft forever
[root@node4 ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
172.16.100.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0
172.16.0.0      0.0.0.0         255.255.0.0     U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth0
0.0.0.0         172.16.100.2    0.0.0.0         UG    0      0        0 eth0

node1:

[root@node1 dhcp]# vim /etc/dhcp/dhcpd.conf 
subnet 172.16.0.0 netmask 255.255.0.0 {
    range 172.16.100.151 172.16.100.170;
    option routers 172.16.100.67;     #分配网关
}
[root@node1 dhcp]# systemctl restart dhcpd.service

node4:

[root@node4 ~]# dhclient -d
Internet Systems Consortium DHCP Client 4.1.1-P1
Copyright 2004-2010 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/00:0c:29:e7:1c:38
Sending on   LPF/eth0/00:0c:29:e7:1c:38
Sending on   Socket/fallback
DHCPREQUEST on eth0 to 255.255.255.255 port 67 (xid=0xcf7a996)
DHCPACK from 172.16.100.67 (xid=0xcf7a996)
bound to 172.16.100.151 -- renewal in 40315 seconds.
[root@node4 ~]# ip addr show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:e7:1c:38 brd ff:ff:ff:ff:ff:ff
    inet 172.16.100.6/24 brd 172.16.100.255 scope global eth0
    inet 172.16.100.151/16 brd 172.16.255.255 scope global eth0
    inet6 fe80::20c:29ff:fee7:1c38/64 scope link 
       valid_lft forever preferred_lft forever
[root@node4 ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
172.16.100.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0
172.16.0.0      0.0.0.0         255.255.0.0     U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth0
0.0.0.0         172.16.100.2    0.0.0.0         UG    0      0        0 eth0
[root@node4 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0 
BOOTPROTO=dhcp
[root@node4 ~]# service network restart
[root@node4 ~]# ip addr show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:0c:29:e7:1c:38 brd ff:ff:ff:ff:ff:ff
    inet 172.16.100.151/16 brd 172.16.255.255 scope global eth0
    inet6 fe80::20c:29ff:fee7:1c38/64 scope link 
       valid_lft forever preferred_lft forever
[root@node4 ~]# ip route show
169.254.0.0/16 dev eth0  scope link  metric 1002 
172.16.0.0/16 dev eth0  proto kernel  scope link  src 172.16.100.151 
default via 172.16.100.67 dev eth0    #获取到的网关
[root@node4 ~]# cat /etc/resolv.conf 
; generated by /sbin/dhclient-script
search smoke.com
nameserver 114.114.114.114
nameserver 8.8.8.8

node1:

[root@node1 dhcp]# man dhcpd.conf
[root@node1 dhcp]# yum info tftp-server
可安装的软件包
名称    :tftp-server
架构    :x86_64
版本    :5.2
发布    :22.el7
大小    :47 k
源    :base/7/x86_64
简介    : The server for the Trivial File Transfer Protocol (TFTP)
网址    :http://www.kernel.org/pub/software/network/tftp/
协议    : BSD
描述    : The Trivial File Transfer Protocol (TFTP) is normally used only for
         : booting diskless workstations.  The tftp-server package provides the
         : server for TFTP, which allows users to transfer files to and from a
         : remote machine. TFTP provides very little security, and should not be
         : enabled unless it is expressly needed.
[root@node1 dhcp]# yum -y install tftp-server
[root@node1 dhcp]# rpm -ql tftp-server
[root@node1 ~]# vim /etc/xinetd.d/tftp 
service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /var/lib/tftpboot
        disable                 = no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}
[root@node1 ~]# service xinetd restart
[root@node1 ~]# netstat -unlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
udp        0      0 127.0.0.1:323           0.0.0.0:*                           685/chronyd         
udp        0      0 0.0.0.0:67              0.0.0.0:*                           41594/dhcpd         
udp        0      0 0.0.0.0:69              0.0.0.0:*                           41760/xinetd        
udp6       0      0 ::1:323                 :::*                                685/chronyd     
[root@node1 ~]# vim /etc/xinetd.d/tftp 
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
}
[root@node1 ~]# service xinetd restart
[root@node1 ~]# netstat -unlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
udp        0      0 127.0.0.1:323           0.0.0.0:*                           685/chronyd         
udp        0      0 0.0.0.0:67              0.0.0.0:*                           41594/dhcpd         
udp6       0      0 ::1:323                 :::*                                685/chronyd    
[root@node1 ~]# systemctl start tftp.service
[root@node1 ~]# netstat -unlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
udp        0      0 127.0.0.1:323           0.0.0.0:*                           685/chronyd         
udp        0      0 0.0.0.0:67              0.0.0.0:*                           41594/dhcpd         
udp6       0      0 ::1:323                 :::*                                685/chronyd         
udp6       0      0 :::69                   :::*                                1/systemd     
[root@node1 ~]# cp /etc/fstab /var/lib/tftpboot/

node2:

[root@node2 ~]# yum -y install tftp
[root@node2 ~]# man tftp
[root@node2 ~]# tftp 172.16.100.67
tftp> help
tftp-hpa 5.2
Commands may be abbreviated.  Commands are:

connect 	connect to remote tftp
mode    	set file transfer mode
put     	send file
get     	receive file
quit    	exit tftp
verbose 	toggle verbose mode
trace   	toggle packet tracing
literal 	toggle literal mode, ignore ':' in file name
status  	show current status
binary  	set mode to octet
ascii   	set mode to netascii
rexmt   	set per-packet transmission timeout
timeout 	set total retransmission timeout
?       	print help information
help    	print help information
tftp> get fstab
tftp> quit
[root@node2 ~]# ls
anaconda-ks.cfg  fstab
[root@node2 ~]# cat fstab 

#
# /etc/fstab
# Created by anaconda on Fri Jun 12 20:37:13 2020
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos-root /                       xfs     defaults        0 0
UUID=dfecc79e-9fc9-4846-8780-f7d2a5973936 /boot                   xfs     defaults        0 0
/dev/mapper/centos-home /home                   xfs     defaults        0 0
/dev/mapper/centos-swap swap                    swap    defaults        0 0

node1:

[root@node1 ~]# yum info syslinux
可安装的软件包
名称    :syslinux
架构    :x86_64
版本    :4.05
发布    :15.el7
大小    :990 k
源    :base/7/x86_64
简介    : Simple kernel loader which boots from a FAT filesystem
网址    :http://syslinux.zytor.com/wiki/index.php/The_Syslinux_Project
协议    : GPLv2+
描述    : SYSLINUX is a suite of bootloaders, currently supporting DOS FAT
         : filesystems, Linux ext2/ext3 filesystems (EXTLINUX), PXE network boots
         : (PXELINUX), or ISO 9660 CD-ROMs (ISOLINUX).
[root@node1 ~]# yum -y install syslinux
[root@node1 ~]# rpm -ql syslinux
/usr/share/syslinux/pxelinux.0
[root@node1 ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
[root@node1 ~]# rm //var/lib/tftpboot/fstab 
[root@node1 ~]# mount -r /dev/cdrom /media/    #装载光盘ISO镜像挂载光盘
[root@node1 media]# cd isolinux/
[root@node1 isolinux]# ls
boot.cat  boot.msg  grub.conf  initrd.img  isolinux.bin  isolinux.cfg  memtest  splash.png  TRANS.TBL  vesamenu.c32  vmlinuz
[root@node1 media]# cd images/
[root@node1 images]# ls
efiboot.img  pxeboot  TRANS.TBL
[root@node1 images]# cd pxeboot/
[root@node1 pxeboot]# ls
initrd.img  TRANS.TBL  vmlinuz
[root@node1 pxeboot]# cp vmlinuz initrd.img /var/lib/tftpboot/
[root@node1 pxeboot]# cd ../../isolinux/
[root@node1 isolinux]# ls
boot.cat  boot.msg  grub.conf  initrd.img  isolinux.bin  isolinux.cfg  memtest  splash.png  TRANS.TBL  vesamenu.c32  vmlinuz
[root@node1 isolinux]# cp boot.cat vesamenu.c32 splash.png /var/lib/tftpboot/
[root@node1 isolinux]# mkdir /var/lib/tftpboot/pxelinux.cfg
[root@node1 isolinux]# cp isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
[root@node1 isolinux]# vim /etc/dhcp/dhcpd.conf 
subnet 172.16.0.0 netmask 255.255.0.0 {
    range 172.16.100.151 172.16.100.170;
    option routers 172.16.100.67;
    filename "pxelinux.0";
    next-server 172.16.100.67;
}
[root@node1 isolinux]# systemctl restart dhcpd.service

创建新的虚拟机,使用网络和node1相同网络,创建完成后开机;

安装系统菜单,点击Install CentOS 7

启动安装过程,没有配置从那加载kickstart文件安装操作系统;

node1:

[root@node1 isolinux]# yum -y install httpd
[root@node1 isolinux]# mkdir /var/www/html/centos7
[root@node1 isolinux]# mount --bind /media/ /var/www/html/centos7/    #挂载其他位置的子树
[root@node1 isolinux]# ll /var/www/html/centos7/
总用量 108
-rw-rw-r--. 1 root root    14 5月   2 2018 CentOS_BuildTag
drwxr-xr-x. 3 root root  2048 5月   4 2018 EFI
-rw-rw-r--. 1 root root   227 8月  30 2017 EULA
-rw-rw-r--. 1 root root 18009 12月 10 2015 GPL
drwxr-xr-x. 3 root root  2048 5月   4 2018 images
drwxr-xr-x. 2 root root  2048 5月   4 2018 isolinux
drwxr-xr-x. 2 root root  2048 5月   4 2018 LiveOS
drwxrwxr-x. 2 root root 71680 5月   4 2018 Packages
drwxrwxr-x. 2 root root  4096 5月   4 2018 repodata
-rw-rw-r--. 1 root root  1690 12月 10 2015 RPM-GPG-KEY-CentOS-7
-rw-rw-r--. 1 root root  1690 12月 10 2015 RPM-GPG-KEY-CentOS-Testing-7
-r--r--r--. 1 root root  2883 5月   4 2018 TRANS.TBL
[root@node1 isolinux]# cd
[root@node1 ~]# perl -e 'print crypt("smoke520",q($1$1234578)),"\n"'    # 其中smoke520为要给用户设置的密码,$1$12345678字符串是自定义字符串,shadow里一般用$1$后面跟8个字符这种格式,当使用特殊字符时,例如@$符时需要在前面加上\,例:\@\$,否则加密
字符串会错误;
$1$12345678$1X.khkQVJbTq3.0kwYfM40
[root@node1 ~]# vim centos7.cfg
#setform=x86, AMD64, 或 Intel EM64T
#version=CentOS7
# Install OS instead of upgrade #全新安装而不是升级
xconfig --startxonboot
keyboard --vckeymap=cn --xlayouts='cn'
reboot
# Root password
rootpw --iscrypted $1$12345678$1X.khkQVJbTq3.0kwYfM40 #采用加密记录
#rootpw --plaintext 123456 #采用明文记录
# System language
timezone Asia/Shanghai
url --url="http://172.16.100.67/centos7"    //这里修改为本地yum源的路径,即httpd服务提供的页面路径
lang en_US

network --bootproto=dhcp --device=eth0
# System authorization information #设定NIS信息
auth  --useshadow  --passalgo=123456
# Use text mode install #安装方式,文本界面,图形的话graphy
text
firstboot --disable
# SELinux configuration #关闭SELinux
selinux --permissive
# Do not configure the X Window System #不配置X图形界面
#skipx

# Use NFS installation media #设定安装方式
#nfs --server=192.168.100.254 --dir=/centos
# Use http installation source
#url --url=http://192.168.100.254/centos/7/
# Network information #采用DHCP获取IP
#network  --bootproto=dhcp
#reboot
# System timezone
#timezone Asia/Shanghai
# System bootloader configuration
ignoredisk --only-use=sda
bootloader --location=mbr --boot-drive=sda
# Partition clearing information #清除原有分区
clearpart --all
# Disk partitioning information
part / --fstype="xfs" --size=10000
part /boot --fstype="xfs" --size=200
part swap --fstype="swap" --size=8000
part /tmp --fstype="xfs" --grow --size=1

%packages #设定所需要的软件包,按需要调整
@base #@表示一组软件包
@network-server
@performance
@system-admin-tools
sdparm
tree
tuned
tuned-utils
ypbind
nfs-utils
vim-enhanced
#-表示从默认软件包的需要去除的软件包
-lvm2
-nano
-pcmciautils
-plymouth
-rfkill
-rsync
-system-config-firewall-tui
-system-config-network-tui
-unzip
-vconfig
-wireless-tools
%end #%packages结尾

%pre #预案装脚本,非必须
date
%end #%pre结尾
%post #安装后脚本,非必须
cat >>/root/.bashrc <>/etc/fstab
%end #%post结尾rver 3.centos.pool.ntp.org iburst     
[root@node1 ~]# cp centos7.cfg /var/www/html/
[root@node1 ~]# systemctl start httpd.service
[root@node1 ~]# cd /var/lib/tftpboot/
[root@node1 tftpboot]# ls
boot.cat  initrd.img  pxelinux.0  pxelinux.cfg  splash.png  vesamenu.c32  vmlinuz
[root@node1 tftpboot]# vim pxelinux.cfg/default 
label linux
  menu label ^Install CentOS 7
  kernel vmlinuz
  append initrd=initrd.img inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 quiet ks=http://172.16.100.67/centos7.cfg
[root@node1 tftpboot]# sync

启动要安装系统的虚拟机,选择第一项Install CentOS 7

通过centos6的pxe方式安装失败,无法启动; 

node1:

[root@node1 tftpboot]# rm -f boot.cat splash.png vesamenu.c32 
[root@node1 tftpboot]# cp /usr/share/syslinux/{chain.c32,mboot.c32,menu.c32,memdisk} /var/lib/tftpboot/
[root@node1 tftpboot]# ll
总用量 57908
-rw-r--r--. 1 root root    20832 11月  1 22:46 chain.c32
-rw-r--r--. 1 root root 52893200 10月 28 22:09 initrd.img
-rw-r--r--. 1 root root    33628 11月  1 22:46 mboot.c32
-rw-r--r--. 1 root root    26140 11月  1 22:47 memdisk
-rw-r--r--. 1 root root    55140 11月  1 22:47 menu.c32
-rw-r--r--. 1 root root    26759 10月 28 21:54 pxelinux.0
drwxr-xr-x. 2 root root       21 11月  1 22:32 pxelinux.cfg
-rwxr-xr-x. 1 root root  6224704 10月 28 22:09 vmlinuz
[root@node1 tftpboot]# vim /var/lib/tftpboot/pxelinux.cfg/default 
default menu.c32
  prompt 0
  timeout 30
  MENU TITLE CentOS 7 PXE Menu

  LABEL centos7 
  MENU LABEL Install CentOS 7 x86_64
  KERNEL vmlinuz
  APPEND initrd=initrd.img inst.repo=http://172.16.100.67/centos7 ks=http://172.16.100.67/centos7.cfg

:1,$d
[root@node1 tftpboot]# cat /media/isolinux/isolinux.cfg 

启动要安装系统的虚拟机;

开始自动安装;