11.2 Configuring a DHCP Server

To configure an Oracle Linux system as a DHCP server:

  1. Install the dhcp package:

    #  yum install dhcp
  2. Edit the /etc/dhcp/dhcpd.conf file to store the settings that the DHCP server can provide to the clients.

    The following example configures the domain name, a range of client addresses on the subnet from through together with the IP addresses of the default gateway and the DNS server, the default and maximum lease times in seconds, and a static IP address for the application server svr01 that is identified by its MAC address:

    option domain-name "mydom.org";
    option domain-name-servers,;
    option broadcast-address;
    option routers;
    subnet netmask {
      default-lease-time 10800;
      max-lease-time 43200;
    host svr01 {
      hardware ethernet 80:56:3e:00:10:00;
      max-lease-time 86400;

    The DHCP server sends the information in the option lines to each client when it requests a lease on an IP address. An option applies only to a subnet if you define it inside a subnet definition. In the example, the options are global and apply to both the subnet and host definitions. The subnet and host definitions have different settings for the maximum lease time.


    In Oracle Linux 7, the DHCP server no longer reads its configuration from /etc/sysconfig/dhcpd. Instead, it reads /etc/dhcp/dhcpd.conf to determine the interfaces on which it should listen.

    For more information and examples, see /usr/share/doc/dhcp-version/dhcpd.conf.sample and the dhcpd(8) and dhcp-options(5) manual pages.

  3. Touch the /var/lib/dhcpd/dhcpd.leases file, which stores information about client leases:

    # touch /var/lib/dhcpd/dhcpd.leases
  4. Enter the following commands to start the DHCP service and ensure that it starts after a reboot:

    # systemctl start dhcpd
    # systemctl enable dhcpd

For information about configuring a DHCP relay, see the dhcrelay(8) manual page.