Differentiating Between Clients
The DHCP server differentiates between clients based on what each client sends to
the server in its messages. Chapter 16, “Client Identification and Fixed-Address
Allocation,” discusses how the DHCP server identifies a specific client by using either
the DHCP
client identifier option or the client’s link-layer address.
The DHCP server can also make decisions about a client based on other options the
client sends or on the other contents of the client’s packet. Unlike the
client iden-
tifier option and link-layer address, the other contents of a DHCP packet generally
aren’t guaranteed to be unique. Configuring the server to use them to differentiate
between clients enables you to control the server’s behavior with respect to classes of
clients, rather than just to specific individual clients.
Conditional Statements
The simplest way to differentiate between clients is to use conditional statements.
Conditional statements work by testing some logical expression; if the result of evalu-
ating that expression is
true, the statements that are enclosed in the conditional
statement are executed (for example, some special configuration parameters or
options might be defined). If the result of evaluating an expression is
false or null,
the statements are not executed.
NOTE
You can use many different kinds of expressions to determine what sort of client sent a
request. Appendix B, “ISC DHCP Server Configuration File Reference,” provides a complete list
of the different kinds of expressions that the DHCP server recognizes.
If you provide an else clause, the parameters or options within the else clause are
defined. You can chain together a series of
if statements by using the elsif state-
ment as well.
Consider an installation where IP addresses are in somewhat short supply, so the
administrator needs to configure the DHCP server not to allocate leases for longer
than they will be used. At this site, all site-owned computers are registered with the
DHCP server by using
host declarations. The site owns a number of printers that
support TCP/IP. These printers send the vendor class identifier
acme-printers. The
site administrators don’t register these printers because they’re easy to identify. The
site also provides IP addresses to visiting mobile clients. Example 20.1 shows how to
give long leases to the printers, shorter leases to site-owned machines, and very short
leases to visiting mobile clients.
CHAPTER 20 Programmable DHCP Server Customization338
024 3273 CH20 10/3/02 5:00 PM Page 338