Configure PXE network startup server in RHEL/CentOS 7
PXE Server -- pre-start execution environment -- instructs the client computer to Start, Run, or install the operating system directly from the network interface, without burning a CD/DVD or using a certain physical media, it can reduce the workload of installing the Linux release on multiple machines on your network at the same time.
Set PXE network startup in RHEL/CentOS 7
Pre-reading
- CentOS 7 minimal installation steps
- RHEL 7 minimal installation steps
- Configure static IP addresses in RHEL/CentOS 7
- Remove services not in RHEL/CentOS 7
- Install the NTP server to set the correct time for RHEL/CentOS 7
This article describes how to install and configure a PXE Server on RHEL/CentOS 7 64-bit with a local image installed repository. The repository source is provided by the ISO image of CentOS 7 DVD, DNS is provided by the DNSMASQ server.
This machine provides DNS and DHCP services for the Syslinux package for network boot and guidance, TFTP-Server-provides a boot image that can be downloaded using the small File Transfer Protocol over the network, and the VSFTPD server that provides locally Mounted DVD images-it will assume the role of the Official RHEL/CentOS 7 image installation repository, where the installer will extract the required package.
Step 1: install and configure the DNSMASQ Server
1. you do not need to be reminded to determine your network interface card. Unless your server has multiple network interface cards, the NIC must have a static IP address, the IP address must be in the network segment where you want to provide the PXE service.
Then, after you have configured the static IP address, update your system and perform other initial settings. Run the following command to install the DNSMASQ process.
- # Yum install dnsmasq
Install the dnsmasq package
2. The default main configuration file of DNSMASQ is located in the/etc directory. Although it can be understood without any instructions, it is indeed quite difficult to edit, even if there are detailed descriptive annotations.
First, make sure that you have backed up the file so that you can recover it later. Then, use your favorite text editor to create a new empty configuration file. The command is as follows.
- # Mv/etc/dnsmasq. conf/etc/dnsmasq. conf. backup
- # Nano/etc/dnsmasq. conf
3. copy and paste the following configuration to the dnsmasq. conf file, and make sure to modify the configuration according to the following instructions to adapt to your network settings.
- Interface = eno16777736, lo
- # Bind-interfaces
- Domain = centos7.lan
- # DHCP range-leases
- Dhcp-range = eno16777736, 192.168.1.3, 192.168.1.253, 255.255.255.0, 1 h
- # PXE
- Dhcp-boot = pxelinux.0, pxeserver, 192.168.1.20
- # Gateway
- Dhcp-option = 3, 192.168.1.1
- # DNS
- Dhcp-option = 6, 92.161.1, 8.8.8.8
- Server = 8.8.4.4
- # Broadcast Address
- Dhcp-option = 28, 10.0.0.255
- # NTP Server
- Dhcp-option = 42, 0.0.0.0
-
- Pxe-prompt = "Press F8 for menu.", 60
- Pxe-service = x86PC, "Install CentOS 7 from network server 192.168.1.20", pxelinux
- Enable-tftp
- Tftp-root =/var/lib/tftpboot
Dnsmasq Configuration
The statements you need to modify include the following:
- Interface-the network interface that the server needs to listen to and provide services.
- Bind-interfaces-uncomment to bind to this network interface
- Domain-Replace with your domain name.
- Dhcp-range-replace the network segment defined for your network mask.
- Dhcp-boot-replace this IP address with your network interface IP address.
- Dhcp-option = 3, 192.168.1.1-replace this IP address with the gateway of your network segment.
- Dhcp-option = 6, 92.161.1-replace this IP address with your DNS server IP-you can define multiple IP addresses.
- Server = 8.8.4.4-the IP address of the DNS forwarding server is placed here.
- Dhcp-option = 28, 10.0.0.255-replace the IP address with the network broadcast address-optional.
- Dhcp-option = 42, 0.0.0.0-put the network clock server here -- Optional (0.0.0.0 Address indicates refer to itself ).
- Pxe-prompt-keep default -- press F8 to enter the menu and wait for 60 seconds.
- Pxe = service-use x86PC as the 32/64-bit architecture, and enter the menu description prompt in the string quote. Other types of values can be: PC98, IAEFI, Alpha, ArcX86, IntelLeanClient, IA32EFI, BCEFI, XscaleEFI and X86-64EFI.
- Enable-tftp-enable the built-in TFTP server.
- Tftp-root-use/var/lib/tftpboot-location of all network startup files.
For other advanced options related to the configuration file, see the dnsmasq manual.
Step 2: Install SYSLINUX Boot Loader
4. After editing and saving the main configuration file of DNSMASQ, we will continue to install Syslinux PXE to start the loader. The command is as follows.
- # Yum install syslinux
Install Syslinux Boot Loader
5. the PXE Boot Loader file is located in the absolute path of the/usr/share/syslinux system. You can view it by listing the content in this path. This step is not required, but you may need to know the path, because in the next step, we will copy all the content under this path to the TFTP server path.
- # Ls/usr/share/syslinux
Syslinux File
Step 3: Install TFTP-Server and add SYSLINUX to load the starter
6. Now, let's go to the next step and install TFTP-Server. Then, copy the Syslinux package in the above location to provide all the boot loader files to the/var/lib/tftpboot path. The command is as follows.
- # Yum install tftp-server
- # Cp-r/usr/share/syslinux/*/var/lib/tftpboot
Install the TFTP Server
For more details, please continue to read the highlights on the next page: