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.

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

  3. Edit /etc/sysconfig/dhcpd to configure settings for the DHCP server itself. For example, the following setting specifies the interfaces on which the server listens for DHCP requests:

    DHCPDARGS="eth0 eth1"

    For more information, see the dhcpd(8) manual page.

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

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

    # service dhcpd start
    # chkconfig dhcpd on

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