Title: Configure DHCP
Course: CIS 208: Linux/UNIX III: Intermediate System Administration, Networking, and Security ~ For IGNITE Review > Section: Learning Modules

Configure DHCP

The Dynamic Host Configuration Protocol (DHCP) allows a central location to manage network settings for client devices.  The clients typically request an IP address, a network mask, a gateway, and a set of DNS servers.  The client may also request a domain name, a time server, or a time zone among things.  The server responds with the information including a lease time for which this information will be valid.

The DHCP server must be configured to respond to requests and provide appropriate settings.  For example some hosts will be given static IP addresses based on reservations.  Other stations will be given an address from one or more pools of addresses.  In special cases, some devices may not be given an address, or will be given an address along with instructions for PXE booting.  If the network has been well planned, configuring the DHCP server is rather straight-forward.

Here is a simple dhcpd.conf file with a declaration for one subnet.

subnet 192.168.1.0 netmask 255.255.255.0 {

option routers 192.168.1.254;
option subnet-mask 255.255.255.0;
option domain-search "example.com";
option domain-name-servers 192.168.1.1;
option time-offset -18000; # Eastern Standard Time
range 192.168.1.10 192.168.1.100;

}

To assign a static address to a server, add an entry similar to this example.

host server1 {
hardware ethernet 00:A0:78:8E:9E:AA;
fixed-address 192.168.1.4;
}

To assign an address from the pool, add a similar entry without the fixed-address line.

host apex {
option host-name "apex.example.com";
hardware ethernet 00:A0:78:8E:9E:CC;
}

To prevent the assignment of an IP address to a specific host, consider this example.

host acenet1 {
hardware ethernet 00:90:4b:59:29:be;
deny booting;
}

See the RHEL 6 Deployment Guide for more information about configuring dhcpd.