Introduce PEX before you introduce the DHCP service.
ARP protocol (Address resolving protocol): IP-to-MAC
RARP Protocol (reverse ARP): MAC---> IP
There are roughly 6 steps to the workflow:
1. Client: DHCP Discover request message broadcast
2, Server: DHCP Offer (IP/MASK,GW .... )
3. Client: DHCP request (using address)
4. Server: DHCP ACK acknowledgement
5, the client: Rquest single wave to the server to renew the lease, 50% time to start, you can customize, if not contacted 75% times continue. (No renewal is triggered by 50% of the remaining time until the lease is renewed)
6. Server: (Ack|nack)
DHCP installation use process
1. Installation
[[email protected] pxeboot]# yum -y install dhcp
2. Configuration files
[[email protected] pxeboot]# cd /etc/dhcp/[[email protected] dhcp]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example ./dhcpd.confoption domain-name "example.org"; #当前主机域名 option domain-name-servers 8.8.8.8,114.114.114.114; #dns 用逗号隔开default-lease-time 6000; #默认续租时间max-lease-time 72000; #最大续租时间log-facility local7; #日志option routers 192.168.1.1; #网关 也可以定义在subnet中subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.230 192.168.1.254;}
3. Start
[[email protected] haproxy]# systemctl restart dhcpd#服务端端口[[email protected] haproxy]# ss -lntup|grep dhcpdudp UNCONN 0 0 *:67 *:* users:(("dhcpd",pid=10216,fd=7))#客户端端口udp UNCONN 0 0 *:68 *:* users:(("dhclient",pid=4981,fd=6))
4, client testing?
#在虚拟机中设置一个桥接模式的网卡, Auto get ip[[email protected] html]# ifdown ens33 && ifup ens33 #如果同一网络有多个dhcp服务器的话 [[email& Nbsp;protected] html]# dhclient-dinternet systems Consortium DHCP Client 4.2.5Copyright 2004-2013 Internet Systems Conso Rtium. All rights reserved. For info, visit https://www.isc.org/software/dhcp/Listening on lpf/ens34/00:0c:29:a8:a5:41sending on lpf/ens34/ 00:0c:29:a8:a5:41listening on lpf/ens33/00:0c:29:a8:a5:37sending in lpf/ens33/00:0c:29:a8:a5:37sending on Socket/ Fallbackdhcprequest on ENS34 to 255.255.255.255 port (xid=0x15cfab63) DHCPREQUEST in Ens33 to 255.255.255.255 port (x ID=0X46D0DEEA) DHCPACK from 192.168.1.200 (XID=0X46D0DEEA) #自定义的dhcp服务器bound to 192.168.1.231 – renewal in 2631 SECONDS.D Hcpack from 192.168.1.1 (xid=0x15cfab63) #家里路由器 Dhcpbound to 192.168.1.108 – renewal in 3416 seconds. [[email protected] html]# IP addr Show ens332:ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU Qdisc Pfifo_f AST State up QlenNk/ether 00:0c:29:a8:a5:37 BRD ff:ff:ff:ff:ff:ff inet 192.168.1.231/24 BRD 192.168.1.255 scope Global Dynamic ENS33 Valid_lft 5882sec preferred_lft 5882sec inet6 fe80::20c:29ff:fea8:a537/64 scope link Valid_lft forever Preferr Ed_lft forever[[email protected] html]# route-nkernel IP routing tabledestination Gateway genmask Flags Metric Ref use Iface0.0.0.0 192.168.1.1 0.0.0.0 UG 101 0 0 Ens33
5. Fixed IP assignment
#服务端配置host passacaglia { hardware ethernet 00:0c:29:a8:a5:37; fixed-address 192.168.1.229;}#客户端地址2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:a8:a5:37 brd ff:ff:ff:ff:ff:ff inet 192.168.1.229/24 brd 192.168.1.255 scope global dynamic ens33 valid_lft 5998sec preferred_lft 5998sec inet6 fe80::20c:29ff:fea8:a537/64 scope link valid_lft forever preferred_lft forever
6. Server View IP Lease status
[[email protected] haproxy]# 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.5lease 192.168.1.230 { starts 5 2018/06/08 07:22:19; ends 5 2018/06/08 09:02:19; cltt 5 2018/06/08 07:22:19; binding state active; next binding state free; rewind binding state free; hardware ethernet 00:0c:29:34:f5:7a; client-hostname "node2";}
Pex
Preboot Execution Environment
The workflow is roughly as follows
1, the client obtains ip/mask,gw,dns,filename,next-server through the DHCP service
2. The client loads the Anaconda configuration file by loading the temporary kernel through the boot file
3, through the Anaconda or pass to the kernel parameter way to download the installation data package, installs
First introduce the next kickstart
Graphical configuration
yum -y install system-config-kickstartsystem-config-kickstart
Centos7 KS
#命令段 # # # #必备命令 # authentication Method Auth--enableshadow--passalgo=sha512#bootloader Append the parameters passed to the kernel quietbootloader--append= " Crashkernel=auto "--location=mbr--boot-drive=sda# keyboard keyboard--vckeymap=us--xlayouts= ' Us ' # language Lang en_US. utf-8# time timezone Asia/shanghai--isutc--nontp# empty partition Clearpart--none--initlabel# Create boot partition part/boot--fstype= "XFS"-- ONDISK=SDA--size=512# Create Pv.idpart pv.156--fstype= "LVMPV"--ONDISK=SDA--size=17411# Create VG by pv.id specify that Pvvolgroup vg0-- pesize=4096 pv.156# Creating a logical Volume Logvol/--fstype= "XFS"--size=15360--name=root--vgname=vg0logvol swap--fstype= "swap"--size =2047--name=swap--vgname=vg0# Administrator password The first paragraph is the encryption method the second paragraph is the third section of the key encryption password generation method OpenSSL passwd-1-salt ' OpenSSL rand-hex 4 ' ROOTPW--iscrypted $6$ch7jvkcfapv4o/ve$qot4bavz72ck5xjceifl1lnv55xhgoobtepenyn79gy1cs52t9bpery8g9a4gif/ 1yiy6jhmtenj4xxzik2mm.## #可选命令install # Network informationnetwork--bootproto=dhcp--device=ens33--onboot=off--ipv6 =auto--activatenetwork--bootproto=dhcp--device=ens34--onboot=off--ipv6=auto--acTivatenetwork--hostname=localhost.localdomain# safely off SELinux--disabledfirewall--disabled# after installation is complete reboot### #安装源 cdrom# cdrom# installation source is the network URL--url= "http://mirrors.aliyun.com/centos/7.4.1708/os/x86_64/" # Install interface image Display Remove is display text graphical# Run the Setup Agent on first bootfirstboot--enableignoredisk--only-use=sda# System servicesservices--disabled= "Chronyd" #程序包段 %packages@^minimal@corekexec-tools%end%addon com_redhat_kdump--enable--reserve-mb= ' auto '%end%anacondapwpolicy Root--minlen=6--minquality=1--notstrict--nochanges--notemptypwpolicy user--minlen=6--minquality=1--notstrict-- Nochanges--emptyokpwpolicy luks--minlen=6--minquality=1--notstrict--nochanges--notempty%end
Check
[[email protected] ~]# ksvalidator ks3.cfg
Introduction to making Image installation
[[email protected] ~]# cd /mnt/t1/[[email protected] t1]# lsCentOS_BuildTag EFI EULA GPL images isolinux LiveOS Packages repodata RPM-GPG-KEY-CentOS-7 RPM-GPG-KEY-CentOS-Testing-7 TRANS.TBL[[email protected] t1]# mkdir /mnt/t2[[email protected] t1]# cp -r isolinux /mnt/t2[[email protected] t1]# cd /mnt/t2/isolinux/
[[email protected] isolinux]# cp /root/ks3.cfg ../ks.cfg[[email protected] t2]# lsisolinux ks.cfg[[email protected] mnt]# vim t2/isolinux/isolinux.cfgtimeout 1label linux menu default menu label ^Install CentOS 7 kernel vmlinuz append initrd=initrd.img inst.ks=cdrom:/ks.cfg text#注意default只能有一个
[[email protected] mnt]# genisoimage -o centos7-boot.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -R -J -T -v --no-emul-boot --boot-load-size 4 --boot-info-table -V "centos7 x86_64 boot" t2/[[email protected] mnt]# ll -h总用量 53M-rw-r--r--. 1 root root 53M 5月 4 22:51 centos7-boot.iso
Configure the network card, DHCP, the direct start is good.
Pex
1. Installing TFTP
[[email protected] haproxy]# yum -y install tftp-server tftp
#udp 69[[email protected] haproxy]# systemctl start tftp.socket#工作目录[[email protected] haproxy]# ls /var/lib/tftpboot/
2. DHCP configuration boot file name, boot file address
subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.230 192.168.1.254; filename "pxelinux.0"; next-server 192.168.1.200;}
3. Mount the disc when the Yum source
[[email protected] ~]# cd /mnt/t2/centos/7.5.1804/os/x86_64/CentOS_BuildTag GPL Packages/ TRANS.TBL.discinfo images/ repodata/ .treeinfoEFI/ isolinux/ RPM-GPG-KEY-CentOS-7EULA LiveOS/ RPM-GPG-KEY-CentOS-Testing-7
Configure Nginx
server{ listen 8081; root /mnt/t2 ; index index.html; autoindex on; autoindex_exact_size on; autoindex_localtime on; location / { #匹配根下面所有,但是优先级是最低的 相当于/* allow all; }}
4. Prepare Kickstart Script
Ari Image Address
http://mirrors.aliyun.com/centos/7.5.1804/os/x86_64/
The URL here can not be configured, after default can be added (CENTOS7)
CENTOS6 words URL must be configured here default cannot be configured
[[email protected] t2]# vim kickstarts/centos7.5.cfgauth--enableshadow--passalgo=sha512#url--url= "/http 192.168.1.200:8081/centos/7.5.1804/os/x86_64/"Graphicalfirstboot--enableignoredisk--only-use=sdakeyboard-- Vckeymap=us--xlayouts= ' us ' lang en_US. Utf-8network--bootproto=dhcp--device=ens33--onboot=off--ipv6=auto--no-activatenetwork--bootproto=dhcp--device= Ens34--onboot=off--ipv6=auto--no-activatenetwork--hostname=localhost.localdomainselinux--disabledfirewall-- DISABLEDREBOOTROOTPW--iscrypted $6$fhrgzbjmxvi3ksbe$35zlny5/ Lzobrfggplem5vnvivcvxdop1nfolrfp.wf6acbzn2dmi1wjrodfb5ayfh6u5ghp10llpfjtu8/vl1services--disabled= "Chronyd" TimeZone Asia/shanghai--ISUTC--nontpuser--name=zander--password=$6$vjpxeszaoetscw4f$ 1xvypzlojbhr71kclgucatwvyl3nyp0top7acrbfubgznvh.jbyzdpvzbztk1phkwcxgbgphwokzzm4sydnn6.--iscrypted--gecos= " Zander "Bootloader--append=" Crashkernel=auto "--location=mbr--boot-drive=sdaclearpart--none--initlabelpart/boot- -fstype= "XFS"--ONDISK=SDA--size=512part pv.156--fstype= "LVMPV"--ondisk=sda--size=17411volgroup vg0--pesize=4096 pv.156logvol/--fstype= "XF S "--grow--maxsize=15360--size=1024--name=root--vgname=vg0logvol swap--fstype=" swap "--size=2047--name=swap--vgna Me=vg0%packages@^minimal@corekexec-tools%end%addon com_redhat_kdump--enable--reserve-mb= ' auto '%end% Anacondapwpolicy root--minlen=6--minquality=1--notstrict--nochanges--notemptypwpolicy user--minlen=6--minquality =1--notstrict--nochanges--emptyokpwpolicy luks--minlen=6--minquality=1--notstrict--nochanges--notempty%end
5. Kernel Boot script configuration
[[email protected] t2]# yum -y install syslinux[[email protected] t2]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/[[email protected] t2]# cp centos/7.5.1804/os/x86_64/images/pxeboot/{initrd.img,vmlinuz} /var/lib/tftpboot/[[email protected] t2]# cp /usr/share/syslinux/{menu.c32,chain.c32,memdisk,mboot.c32} /var/lib/tftpboot/
[[email protected] t2]# cd /var/lib/tftpboot/[[email protected] tftpboot]# mkdir pxelinux.cfg[[email protected] pxelinux.cfg]# vim pxelinux.cfg/defaultdefault menu.c32 prompt 5 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://192.168.1.200:8081/centos/7.5.1804/os/x86_64/ inst.ks=http://192.168.1.200:8081/kickstarts/centos7.5.cfg text
Introduction to Linux Automation installation