CentOS 7: Install dhcpd and run DHCP server

Table of Contents

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.confsubnet netmask { option domain-name “my.net”; option domain-name-servers,; option routers;}host debian-8 { hardware ethernet 52:54:00:61:e4:e7; fixed-address;}

3 firewalld

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

$ sudo firewall-cmd –add-service=dhcp –permanentsuccess$ sudo firewall-cmd –reloadsuccess

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 eth0eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet netmask broadcast192.168.11.255 inet6 fe80::5054:ff:fe61:e4e7 prefixlen 64 scopeid0x20<link> 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 NetworkManagersearch my.netnameserver

Android | Linux | SDL - Narrow Escape