Fedora 28: Install dhcp for DHCP server

This article will describe installing dhcp and running DHCP server.

1 Install dhcp

Install dhcp package with dnf.

$ sudo dnf install -y dhcp
$ sudo firewall-cmd --add-service=dhcp --permanent
$ sudo firewall-cmd --reload
$ sudo systemctl enable dhcpd
$ sudo systemctl restart dhcpd

2 /etc/dhcp/dhcpd.conf

Define domain name, DHCP server IP address and gateway IP address. MAC address 52:54:00:5e:7a:a4 machie is assigned IP address and hostname "client.hiroom2.com".

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

host client {
  hardware ethernet 52:54:00:5e:7a:a4;
  option host-name "client.hiroom2.com";

Restart dhcpd for update confituration.

$ sudo systemctl restart dhcpd

3 Execution result

Run the following command on client machine.

hostname is provided.

$ hostnamectl
   Static hostname: localhost.localdomain
Transient hostname: client.hiroom2.com
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 3ba892070dae45849f0ccc5e362387a9
           Boot ID: f511e759abc144adbb71d996b9c461e0
    Virtualization: kvm
  Operating System: Fedora 28 (Workstation Edition)
       CPE OS Name: cpe:/o:fedoraproject:fedora:28
            Kernel: Linux 4.16.7-300.fc28.x86_64
      Architecture: x86-64

IP address is provided.

$ ip a s
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel
  state UP group default qlen 1000
    link/ether 52:54:00:5e:7a:a4 brd ff:ff:ff:ff:ff:ff
    inet brd scope global dynamic ens3
       valid_lft 43069sec preferred_lft 43069sec
    inet6 fe80::6501:7500:7614:8a9f/64 scope link
       valid_lft forever preferred_lft forever

DNS servers are provided.

$ cat /etc/resolv.conf
# Generated by NetworkManager
search hiroom2.com