General PXE boot from ETHERNET
[1]. prepareration
1. Install RPMs
yum install dhcp
yum install tftp-server
yum install tftp
yum install ftp
2. configure the firewall
firewall-cmd --permanent --add-service=tftp
firewall-cmd --permanent --add-service=ftp
firewall-cmd --permanent --add-service=dhcp
[2].Configure your DHCP server
1.Configure your DHCP server to use the EFI boot images packaged with shim.
vi /etc/dhcp/dhcpd.conf
option space pxelinux; option pxelinux.magic code 208 = string; option pxelinux.configfile code 209 = text; option pxelinux.pathprefix code 210 = text; option pxelinux.reboottime code 211 = unsigned integer 32; option architecture-type code 93 = unsigned integer 16; allow booting; allow bootp; subnet 192.168.50.0 netmask 255.255.255.0 { range 192.168.50.120 192.168.50.150; option subnet-mask 255.255.255.0; option broadcast-address 192.168.50.255; option routers 192.168.50.254; next-server 192.168.50.101; class "pxeclients" { match if substring (option vendor-class-identifier, 0, 9) = "PXEClient"; if option architecture-type = 00:07 { #filename "uefi/shim.efi";
filename "uefi/grubx64.efi"; } else { filename "pxelinux/pxelinux.0"; } } }
2. make sure client can ping with server before starting the dhcp service
server: ifconfig eno1 192.168.50.101 up client: ifconfig eno1 192.168.50.160 up ping Ok
3.enable dhcp
systemctl status dhcpd.service systemctl start dhcpd.service systemctl enable dhcpd.service
4.check whether dhcp service is available in server.
client: [1]enter the os, redhat 7.3 [2]Application -> system tools -> setting -> network -> eno1: off->on eno1 should get the IP from the DHCP now.
[3].configure your tpftboot/uefi/ shim.efi grubx64.efi vmlinuz initrd.img grub.cfg
1.mkdir /var/lib/tftpboot/uefi
mkdir /var/lib/tftpboot/uefi
2.cope shim.efi/grubx64.efi from CD/Package
cp CD/Packages/shim-version-architecture.rpm /my_dir cp CD/Packages/grub2-efi-version-architecture.rpm /my_dir
Extract the packages: rpm2cpio shim-version-architecture.rpm | cpio -dimv rpm2cpio grub2-efi-version-architecture.rpm | cpio -dimv
cp my_directory/boot/efi/EFI/redhat/shim.efi /var/lib/tftpboot/uefi/
cp my_directory/boot/efi/EFI/redhat/grubx64.efi /var/lib/tftpboot/uefi/
3.cope vmlinuz/initrd.img from CD/Package
cp /root/Desktop/rhel73_cd/images/pxeboot/vmlinuz /var/lib/tftpboot/uefi/ cp /root/Desktop/rhel73_cd/images/pxeboot/initrd.img /var/lib/tftpboot/uefi/
4.Add a configuration file named grub.cfg to the uefi/ directory.
touch a grub.cfg, details in red comment. configure the inst.repo=ftp://192.168.50.101/pub/rhel7u3x64
set timeout=10 menuentry 'RHEL 7.3' { echo "Loading uefi/vmlinuz" linuxefi uefi/vmlinuz ip=dhcp inst.repo=ftp://192.168.50.101/pub/rhel7u3x64 echo "Loading uefi/initrd.img" initrdefi uefi/initrd.img }
5. change the /etc/xinetd.d/tftp
vim /etc/xinetd.d/tftp service tftp { disable = no #默认为yes,改为NO }
# 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 disable = no per_source = 11 cps = 100 2 flags = IPv4 }
systemctl status xinetd.service
systemctl start xinetd.service
6. enable tftp
systemctl status tftp.service systemctl start tftp.service systemctl enable tftp.service
tftp 192.168.50.101
> get one
> quit
#cat one
[4]configure ftp directory
1.copy linux CD to /var/ftp/pub
cp -r ~/Desktop/rhel73_CD /var/ftp/pub/
2.enable ftp
systemctl status vsftpd.service systemctl start vsftpd.service systemctl enable vsftpd.service
3.check whether ftp service is available in server.
test Firefox in server: ftp://127.0.0.1
pub/redhat7u3x64
[5].PXE boot
try to boot from network
Boot mode -> Next one-time boot -> NetworK
server: [1] tail -f /var/log/messages //sytem log [2] tcpdump -i eno1 tcp port 69 //eno1 is your PXE boot port