Configure and Use DHCP Server

Configure DHCP ( Dynamic Host Configuration Protocol ) Server

[1] Install and configure DHCP Server. In this example it is configured for the [] subnet.

[[email protected] ~]# dnf -y install dhcp

[[email protected] ~]# vi /etc/dhcp/dhcpd.conf
# specify domain name
option domain-name "";

# specify DNS server's hostname or IP address
option domain-name-servers;

# default lease time
default-lease-time 600;

# max lease time
max-lease-time 7200;

# this DHCP server to be declared valid

# specify network address and subnet mask
subnet netmask {
    # specify the range of lease IP address
    range dynamic-bootp;
    # specify broadcast address
    option broadcast-address;
    # specify default gateway
    option routers;

[[email protected] ~]# systemctl start dhcpd
[[email protected] ~]# systemctl enable dhcpd
Created symlink /etc/systemd/system/ β†’ /usr/lib/systemd/system/dhcpd.service.

[2] If Firewalld is running, allow DHCP service. DHCP uses 67/UDP.

[[email protected] ~]# firewall-cmd --permanent --add-service=dhcp
[[email protected] ~]# firewall-cmd --reload

Configure DHCP Client. DHCP Client uses 68/UDP.

[1] For Future OS Clients, Configure like follows. (Replace the device name [ens3] to your own device name)

[[email protected] ~]# nmcli connection modify ens3 ipv4.method auto
[[email protected] ~]# nmcli connection down ens3
Connection 'ens3' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/2)
[[email protected] ~]# nmcli connection up ens3
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/3)