The Dynamic Host Configuration Protocol (DHCP) is a network management protocol used on UDP/IP networks whereby a DHCP server dynamically assigns an IP address and other network configuration parameters to each device on a network so they can communicate with other IP networks. A DHCP server enables computers to request IP addresses and networking parameters automatically from the Internet service provider (ISP), reducing the need for a network administrator or a user to manually assign IP addresses to all network devices. In the absence of a DHCP server, a computer or other device on the network needs to be manually assigned an IP address, or to assign itself an APIPA address, which will not enable it to communicate outside its local subnet.
DHCP can be implemented on networks ranging in size from home networks to large campus networks and regional Internet service provider networks. A router or a residential gateway can be enabled to act as a DHCP server. Most residential network routers receive a globally unique IP address within the ISP network. Within a local network, a DHCP server assigns a local IP address to each device connected to the network.
In every segment there is only one dhcp-server active. When you use the router dhcp-server, stop it before you start this one.
To install the dchp-server enter:
dnf install dhcp-server
The IPv4 and IPv6 are installed now.
We had made the rndc.key file when we configured the dns.
vi /etc/dhcp/dhcpd.conf
We can split the range 192.168.1.51 192.168.1.249; in:
range 192.168.1.51 192.168.1.127;
range 192.168.1.135 192.168.1.249;
When you use the Fritz!box, its use the section 128-134 for VPN.
# DHCP Server Configuration file. # see /usr/share/doc/dhcp*/dhcpd.conf.sample # see 'man 5 dhcpd.conf' #Global options option domain-name "example.com"; option domain-name-servers 192.168.1.11; option netbios-name-servers 192.168.1.11; option ntp-servers 192.168.1.11; #Subnets subnet 192.168.1.0 netmask 255.255.255.0 { authoritative; range 192.168.1.51 192.168.1.249; option routers 192.168.1.1; option broadcast-address 192.168.1.255; default-lease-time 604800; max-lease-time 1209600; ddns-domainname "example.com."; ddns-rev-domainname "in-addr.arpa."; } #DDNS updating ddns-update-style interim; ddns-updates on; allow client-updates; include "/etc/rndc.key"; zone example.com. { primary 192.168.1.11; key rndc-key; } zone 1.168.192.in-addr.arpa. { primary 192.168.1.11; key rndc-key; }
When you want you can use dhcp for static address distribution, but I put it manually in the dns zone files and configure machines manually.
# dhcpd configtest
Open the port for dhcp.
# firewall-cmd --zone=public --permanent --add-port=67/udp # firewall-cmd --reload
# systemctl start dhcpd # systemctl enable dhcpd