The software described in this documentation is either in Extended Support or Sustaining Support. See https://www.oracle.com/us/support/library/enterprise-linux-support-policies-069172.pdf for more information.
Oracle recommends that you upgrade the software described by this documentation as soon as possible.

12.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 192.168.2.0/24 subnet from 192.168.2.101 through 192.168.2.254 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 192.168.2.1, 10.0.1.4;
    option broadcast-address 192.168.2.255;
    option routers 192.168.2.1;
    
    subnet 192.168.2.0 netmask 255.255.255.0 {
      range 192.168.2.101 192.168.2.254;
      default-lease-time 10800;
      max-lease-time 43200;
    }
    
    host svr01 {
      hardware ethernet 80:56:3e:00:10:00;
      fixed-address 192.168.2.100;
      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.