DHCP Configuration Files


Most Linux distributions ship with the DHCP server written by the Internet Software Consortium (http://www.isc.org/products/DHCP/). ISC released version 3.0 of its DHCP server in late 2001, but as of early 2002, many Linux distributions still ship with the older 2.0 version. Most of the configuration features described here apply to both 2.0 and 3.0 versions of the DHCP server, but 3.0 adds support for some advanced features, including the DNS integration described in the section "Communicating with a DNS Server."

The DHCP server relies on a configuration file called dhcpd.conf . This file usually resides in the /etc or /etc/dhcp directory. Like other Linux configuration files, dhcpd.conf is a plain text file, so you can edit it with your favorite text editor. In addition to this file, dhcpd creates its own status file, dhcp.leases , which usually resides in /var/lib/dhcp . This file contains information on leases issued by dhcpd . DHCP operates on the principle that the DHCP server orchestrates the allocation of IP addresses. It does this by telling a DHCP client that it may use a particular IP address for a particular period of time ”that is, the DHCP client obtains a lease, which it must periodically renew. The dhcp.leases file also contains information on the Ethernet addresses of the clients . The dhcp.leases file isn't a configuration file per se, though; you won't edit it, although there are a few circumstances in which you might want to examine it, such as when you are troubleshooting or if you need to locate a client's media access control (MAC) address.

The main dhcpd.conf file, like many configuration files, may contain comments, which begin with the pound sign ( # ). The file's noncomment lines are known as statements, and they fall into two broad categories:

  • Parameters ” Parameters tell the DHCP server whether to do something (such as providing addresses to unknown clients), how to do something (such as how long a lease to offer), or what information to provide to clients (such as the network's gateway address).

  • Declarations ” Declarations describe the topology of the network (what addresses are associated with particular interfaces, for instance), specify IP addresses that can be assigned to clients, or associate a set of parameters with a set of declarations.

Some declarations rely on information described in parameters. When this is the case, the parameter must precede the declaration in the file. As described shortly, most configuration files begin with a series of global parameters, then move on to declarations.

Some declarations span multiple lines, and such declarations may include parameters within the grouping. Such multi-line declarations are indicated by the use of curly braces ( {} ) surrounding the enclosed lines. For instance, the following lines define an individual computer and the IP address it's to be given, as discussed in the upcoming section "Assigning Fixed Addresses:"

 host teela {    hardware Ethernet 00:05:02:a7:76:da;    fixed-address 192.168.1.2; } 

The details of what this declaration does are discussed later. For now, you should note that the host keyword begins the declaration, it's followed by an additional option (the name of the computer, teela ), and the curly braces enclose additional configuration lines that define key features needed for this declaration. Such multi-line declarations may be nested within each other in certain circumstances. It's common practice to indent the nested declarations a few spaces in such cases, to help you identify the nested components at a glance. Such indentation isn't required, though; dhcpd ignores extra spaces and lines except when they're enclosed in quotes.



Advanced Linux Networking
Advanced Linux Networking
ISBN: 0201774232
EAN: 2147483647
Year: 2002
Pages: 203

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net