Installation guide
114 Chapter 12. Dynamic Host Configuration Protocol (DHCP)
Example 12-5. Static IP Address using DHCP
host apex {
option host-name "apex.example.com";
hardware ethernet 00:A0:78:8E:9E:AA;
fixed-address 192.168.1.4;
}
Tip
You can use the sample configuration file in Red Hat Linux 7.3 as a starting point and then add your
own custom configuration options to it. Copy it to its proper location with the command
cp /usr/share/doc/dhcp-
version-number /dhcpd.conf.sample /etc/dhcpd.conf
(where version-number is the DHCP version you are using).
For a complete list of option statements and what they do, refer to the dhcp-options man
page.
12.2.2. Lease Database
On the DHCP server, the file /var/lib/dhcp/dhcpd.leases stores the DHCP client lease
database. This file should not be modified by hand. DHCP lease information for each re-
cently assigned IP address is automatically stored in the lease database. The information
includes the length of the lease, to whom the IP address has been assigned, the start and
end dates for the lease, and the MAC address of the network interface card that was used to
retrieve the lease.
All times in the lease database are in Greenwich Mean Time (GMT), not local time.
The lease database is recreated from time to time so that it is not too large. First, all known
leases are saved in a temporary lease database. The dhcpd.leases file is renamed
dhcpd.leases~, and the temporary lease database is written to dhcpd.leases.
The DHCP daemon could be killed or the system could crash after the lease database has
been renamed to the backup file but before the new file has been written. If this happens,
there is no dhcpd.leases file that is required to start the service. Do not create a new lease
file if this occurs. If you do, all the old leases will be lost and cause many problems. The
correct solution is to rename the dhcpd.leases~ backup file to dhcpd.leases and then start
the daemon.
12.2.3. Starting and Stopping the Server
Important
Before you start the DHCP server for the first time, it will fail unless there is an existing dhcpd.leases
file. Use the command touch /var/lib/dhcp/dhcpd.leases to create the file if it does not exist.