### DHCP Sunucunun Kurulumu:
dnf -y install dhcp-server
### dhcpd.conf ###
[root@ns01 root]# cat /etc/dhcp/dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp-server/dhcpd.conf.example
# see dhcpd.conf(5) man page
#
#
option domain-name “osinetworks.net”;
option domain-name-servers ns1.osinetworks.net;
# Declare DHCP Server
authoritative;
# The default DHCP lease time
default-lease-time 86400;
# Set the maximum lease time
max-lease-time 604800;
subnet 192.168.10.0 netmask 255.255.255.0 {
#range dynamic-bootp 192.168.10.200 192.168.10.210;
### Provide broadcast address
#option broadcast-address 192.168.10.255;
### Provide NTP server
#option ntp-servers 192.168.10.13;
### Set default gateway
#option routers 192.168.10.1;
}
# Set Network address, subnet mask and gateway
subnet 192.168.20.0 netmask 255.255.255.0 {
# Range of IP addresses to allocate
range dynamic-bootp 192.168.20.10 192.168.20.100;
### Provide broadcast address
option broadcast-address 192.168.20.255;
### Provide NTP server
option ntp-servers 192.168.10.13;
### Set default gateway
option routers 192.168.20.1;
host server1{
hardware ethernet 00:50:56:a2:7b:16;
fixed-address 192.168.20.21;
}
host server2 {
hardware ethernet 00:50:56:a2:10:c1;
fixed-address 192.168.20.22;
}
host server3 {
hardware ethernet 00:50:56:a2:f7:2a;
fixed-address 192.168.20.23;
}
}
log-facility local7;
### End of dhcpd.conf ###
### Starting the DHCP server. Enabled for startup.
systemctl start dhcpd
systemctl enable dhcpd
### Allow dhcp port permanently.
firewall-cmd –add-service=dhcp –permanent
firewall-cmd –reload
### install dhcp-client test tool:
dnf -y install dhcp-client
### test via dhcpclient.
dhcplient ens33
### To control ip address and lease time.
tail -n 20 -f /var/log/messages
cat /var/lib/dhcpd/dhcpd.leases
