dhcp
yum install dhcp-server -y
cat > /etc/dhcp/dhcpd.conf << EOF
#
## DHCP Server Configuration file.
## see /usr/share/doc/dhcp-server/dhcpd.conf.example
## see dhcpd.conf(5) man page
##
subnet 192.168.60.0 netmask 255.255.255.0 {
range 192.168.60.100 192.168.60.110;
option routers 192.168.60.2;
option subnet-mask 255.255.255.0;
default-lease-time 21600;
max-lease-time 43200;
}
EOF
//模板在`/usr/share/doc/dhcp-server/dhcpd.conf.example`
dhcpd -t -cf /etc/dhcp/dhcpd.conf //检查
systemctl start dhcpd.service
systemctl restart dhcpd.service
tftp
dnf install -y tftp tftp-server xinetd
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 = no
per_source = 11
cps = 100 2
flags = IPv4
}
systemctl start xinetd
systemctl start tftp
syslinux
yum -y install syslinux
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
cp -a /var/www/html/centos8/isolinux/* /var/lib/tftpboot/
mkdir -p /var/lib/tftpboot/pxelinux.cfg
cp /var/www/html/centos8/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
查看服务启动结果
netstat -anpu
[root@localhost data]# netstat -anpu
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
udp 0 0 0.0.0.0:67 0.0.0.0:* 5543/dhcpd
udp 0 0 0.0.0.0:69 0.0.0.0:* 6336/xinetd
udp6 0 0 :::69 :::* 1/systemd
测试
[root@localhost tftpboot]# netstat -anpu
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
udp 704 0 192.168.60.3:43248 192.168.60.100:49171 ESTABLISHED 7658/in.tftpd
udp 0 0 192.168.60.3:58823 192.168.60.100:49170 ESTABLISHED 7657/in.tftpd
udp 0 0 0.0.0.0:67 0.0.0.0:* 5543/dhcpd
udp 0 0 0.0.0.0:69 0.0.0.0:* 6336/xinetd
udp6 0 0 :::69 :::* 1/systemd