CentOS 7: Install dhcpd and run DHCP server

This article will describe running DHCP server.


1 Install dhcpd

Install dhcpd with yum.

$ sudo yum install -y dhcp

2 /etc/dhcp/dhcpd.conf

Define domain name, DHCP server IP address and gateway IP address.

Mapping MAC address 52:54:00:61:e4:e7 to IP address

$ cat /etc/dhcp/dhcpd.conf
subnet netmask {
  option domain-name "my.net";
  option domain-name-servers,;
  option routers;

host debian-8 {
  hardware ethernet 52:54:00:61:e4:e7;

3 firewalld

Open port 67/udp with using service file in /usr/lib/firewalld/services/dhcp.xml.

$ sudo firewall-cmd --add-service=dhcp --permanent
$ sudo firewall-cmd --reload

4 Run dhcpd

Run dhcpd with systemctl.

$ sudo systemctl enable dhcpd
$ sudo systemctl restart dhcpd

5 Execution result

Checking IP address on MAC address 52:54:00:61:e4:e7 machine.

$ ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet  netmask  broadcast
        inet6 fe80::5054:ff:fe61:e4e7  prefixlen 64  scopeid
        ether 52:54:00:61:e4:e7  txqueuelen 1000  (Ethernet)
        RX packets 212  bytes 25859 (25.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 150  bytes 20382 (19.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

$ cat /etc/resolv.conf
# Generated by NetworkManager
search my.net