TCPware V5.8 Management Guide

Previous Page TOC Index Next Page



Chapter 4

DHCP/BOOTP Server

Introduction

This chapter describes the DHCP/BOOTP Server. It combines the Dynamic Host Configuration Protocol (DHCP) server with the bootstrap protocol daemon (BOOTPD).

DHCP and BOOTP

DHCP is the Dynamic Host Configuration Protocol. It centralizes and automates TCP/IP network configuration. The DHCP Server dynamically allocates IP addresses for hosts on the network from an available pool of addresses. In this way, new hosts or hosts that are frequently relocated can automatically get new IP addresses for a certain lease period.

DHCP is an extension of the Internet Bootstrap Protocol (BOOTP). DHCP offers a network host a temporary lease rather than an ownership of an IP address. The lease identifies the duration for which the client can safely use its dynamically assigned IP address. Lease lengths generally depend on the number of network users (crowding of the network) and the number of available IP addresses the DHCP server can assign. The network manager sets the lease length through parameters.

BOOTP uses UDP/IP to allow diskless systems to find their IP addresses, addresses of boot servers, and names of boot files. BOOTP can supply other client information, such as the addresses of name servers, gateways, and LPD servers.

In TCPware, the DHCP Server (DHCPD) is combined with the BOOTP Server (BOOTPD) to form the DHCP/BOOTP Server (DHCPD/BOOTPD).

Note! DHCP uses DNS for host names and IP addresses; thus, a malfunction in your DNS server can affect the DHCP server.

DHCP Process

DHCP goes through an initializing, selecting, requesting, binding, renewal, rebinding, and expiration cycle when negotiating for an IP address, as shown in Figure 4-1.The process is basically as follows:

1 The client just added or relocated on the network requests an IP address by broadcasting a DHCPDISCOVER message to the local subnet over the well-known BOOTP server port. (The client can also go through a BOOTP router or relay agent to forward the DHCPDISCOVER to additional remote DHCP servers.) This is the initializing state.

2 The participating DHCP servers respond with a DHCPOFFER message if they have a valid configuration for the client. The client may get many of these messages, which contain the IP address and configuration data. (The servers make sure to reserve the addresses so as not to accidentally offer them to another client.) At this point the client enters the selecting state.

3 After selecting an address, the client broadcasts the selected address and name of the "winning" server (DHCP Server 1 in Figure 4-1) using a DHCPREQUEST message. This is the requesting state. All the other servers can now safely unreserve their addresses.

4 Server 1 sends the client a DHCPACK (acknowledgment) message with the negotiated IP address, the lease, and the network configuration parameters. The client now enters the binding state and can fully use the assigned IP address.

5 About halfway through the lease, the client sends Server 1 another DHCPREQUEST for a lease renewal, and enters the renewal state. If the server deems the lease renewable, it sends back another DHCPACK to update the lease (including any new parameters). The client now returns to the binding state, as in Step 4.

6 If the client cannot renew the lease (such as if Server 1 is down), the client waits until about 87.5% of the way through the lease and broadcasts another DHCPREQUEST to all DHCP servers. Any server can now return a DHCPACK containing the extended lease and updated parameters. This is the rebinding state.

7 When the lease reaches 100% expired, or a server sends back a DHCPNAK negative acknowledgment message, the client must give up the IP address. It then returns to the initializing state and has to start the address negotiation over again.

Figure 4-1 DHCP Address Request and Allocation Process Undisplayed Graphic

DHCP is defined in RFC 2131 and RFC 2132. Refer to them for more information.

Two DHCP servers are recommended for a network. The benefit of having more than one server is if one fails another is available to continue processing requests, ensuring that all hosts (old and new) are serviced continuously. Refer to DHCP Safe-failover Introduction for more information.

DHCP Administration

You can administer the DHCP server using the following TCPware Network Control Utility (NETCU) commands:

Command

Description

RELEASE DHCP ip-address

Forces the DHCP server to act as if it heard a DHCPRELEASE message from the client for the given IP address.

REMOVE DHCP ip-address

Synonym for RELEASE DHCP.

SET DHCP/DEBUG=value

Sets the debug logging level to the given value.

SET DHCP/NEWLOG

Starts a new debug log file.

SET DHCP/PARTNERDOWN

For Safe-failover DHCP: causes the DHCP server to transition into Partner Down state.

STOP/DHCP

Causes the server to shut down.

SHOW DHCP/ALL

Displays SHOW DHCP/SUBNET output for all subnets, plus information about static assignments.

SHOW DHCP/CLIENT_IDENTIFIER=client-id

Displays all lease binding and static assignment details for the given client ID.

SHOW DHCP/CONFIGURATION

Writes all configuration and lease information to a dump file.

SHOW DHCP/HARDWARE_ADDRESS=hardware-address

Displays all lease binding and static assignment details for the given hardware address.

SHOW DHCP/IP_ADDRESS=ip-address

Displays lease binding details for the given IP address. Static assignments are not supported.

SHOW DHCP/ISKNOWN host, subclass

If host is specified, shows whether the given hardware address or client identifier is "known", that is if there is a host declaration for that hardware address or client identifier. If subclass is specified, shows whether the given subclass data exists as a subclass within the given class.

SHOW DHCP/LEASES

Displays brief information about each lease.

SHOW DHCP/POOLS

Displays address pool availability.

SHOW DHCP/STATUS

Checks if the DHCP server is running.

SHOW DHCP/SUBNET=ip-address

Displays brief information about each IP address in the same shared network as the given IP address.

SHOW DHCP/VERIFY

Checks the syntax of the configuration file and optionally the lease file and the update file.

SHOW DHCP/VERSION

Displays the version of the DHCP server.

UPDATE DHCP

Instructs the Dynamic Host Configuration Protocol (DHCP) server to process the update file and add or remove the specified host and subclass declarations.

See the SHOW DHCP, SET DHCP, RELEASE DHCP, REMOVE DHCP, STOP/DHCP, and UPDATE DHCP command descriptions in the NETCU Command Reference.

DHCP Configuration

You can configure the DHCP server using CNFNET by typing @TCPWARE:CNFNET DHCP.

You can configure the following items:

Enable or disable the DHCP server.

Set the debug logging level.

Set the debug log file name.

Include the date in the log file or not.

Log debug messages to OPCOM or not.

See the DHCP configuration description in the Installation and Configuration Guide.

Verifying the DHCP Configuration

Whenever you modify the configuration file, it is good practice to verify the syntax by entering the following NETCU command:

$ NETCU SHOW DHCP/VERIFY[=(config=<config-file>)] -
_$ [/OUTPUT=<output-file>]

This command causes the DHCP server to run enough to read and parse the configuration file. The DHCP server displays a copyright notice and a message for each syntax error encountered. If the DHCP server displays only the copyright notice, the configuration file has no syntax errors.

The CONFIG option optionally specifies where the configuration file is. If you do not specify the CONFIG option, the DHCP server reads the default configuration file TCPWARE:DHCPD.CONF. The /OUTPUT qualifier optionally sends command output to the specified file.

Reloading the DHCP Configuration

If you modify TCPWARE:DHCPD.CONF after starting the DHCP server, reload the DHCP configuration by restarting the DHCP server by using @TCPWARE:RESTART DHCP. When the DHCP server restarts, it rereads the configuration file.

DHCP Conversion Tool

The DHCP_CONVERSION_TOOL assists in changing from the DHCP server in TCPware v5.3 and earlier to the DHCP server in TCPware v5.4 and later. This tool converts the configuration file and lease file from the 5.3 DHCP server to the format of the configuration and lease files of the 5.4 DHCP server. It is run automatically by the command procedure that starts the DHCP server, TCPWARE:DHCP_CONTROL.COM. However, it is recommended that you run the conversion tool and verify the output ahead of time.

The conversion tool reads the old DHCP configuration file or BOOTP configuration file and writes out a configuration file in the new format. All information from the old configuration file is in the new file. Information that does not have an equivalent in the new configuration file is represented with comment lines.

The conversion tool then reads the old lease file and writes out a lease file in the new format.

The old configuration and lease files are retained in their original location so you can use them to validate the new configuration and lease files.

You can also run the conversion tool directly by specifying the names of the input and output files at the command prompt. If they are not specified, the tool prompts you for them. Enter "NONE" for the file name if you do not have the input file. For example: if you do not have a lease file, then enter:

$ dhcpconvert :== $tcpware:dhcp_conversion_tool.exe
$ dhcpconvert dhcptab. none dhcpd.conf dhcpd.leases

Enter a question mark (?) to get help for the tool. The default file names are:

TCPWARE:DHCPTAB.

The old DHCP configuration file.

TCPWARE:BOOTPTAB.

The old BOOTP configuration file. Read only if the DHCPTAB file does not exist.

TCPWARE:DHCPD.CONF

The new DHCP configuration file.

TCPWARE:DHCP_LEASE.DAT

The old DHCP lease file containing the lease status.

TCPWARE:DHCPD.LEASES

The new DHCP lease file.

Warning! Review the output lease file carefully. The old TCPware lease file does not contain the hardware type, so the conversion tool usually uses ethernet. If you are using a token ring network, change the 'hardware ethernet' statements to 'hardware token-ring' statements. The old TCPware lease file also does not contain whether the ID was a hardware address or client identifier, so review carefully all 'uid' and 'hardware' statements.

Introducing the Configuration File

TCPware supplies a template DHCP configuration file, TCPWARE:DHCPD_CONF.TEMPLATE, that contains comments and a number of examples to help you enter information for your hosts. Using this template as a guide, create a DHCP configuration file at TCPWARE:DHCPD.CONF (with any text editor) containing the entries you need for your network and hosts.

The dhcpd.conf file is a free-form ASCII text file. The file may contain extra tabs and new lines for formatting purposes and comments may be placed anywhere within the file (except within quotation marks). Comments begin with the # character and end at the end of the line. See Example 4-2. Keywords in the file are case-insensitive.

The file consists of a list of statements specify which fall into two categories: parameters and declarations.

Parameter statements always specify one of the following:

How to do something (for example, how long a lease to offer)

Whether to do something (for example, should the DHCP server provide addresses to unknown clients)

What parameters to provide to the client (for example, use gateway 220.177.244.7)

Global parameters are at the beginning of the file. Some examples of global parameters are the organization's domain name and the addresses of the name servers (if they are common to the entire organization).

It is legal to specify host addresses in parameters as domain names rather than as numeric IP addresses. If a given hostname resolves to more than one IP address (for example, if that host has two ethernet interfaces), both addresses are supplied to the client.

Both the shared-network statement and the subnet statement can have parameters.

The most obvious reason for having subnet-specific parameters is that each subnet, of necessity, has its own router; for example:

option routers 204.254.239.1;

Note! The address is specified numerically; this is not required. If you have a different domain name for each interface on your router, it is appropriate to use the domain name for that interface instead of the numeric address. However, there may be only one domain name for all a router's IP addresses, and it would not be appropriate to use that name here.

Parameters starting with the option keyword correspond to actual DHCP options. Parameters that do not start with the option keyword either control the behavior of the DHCP server (for example, how long a lease the DHCP server will give out), or specify client parameters that are not optional in the DHCP protocol (for example, server-name and filename).

Each host can have host-specific parameters. These could include such things as the:

Hostname option

Name of a file to upload (the filename parameter)

Address of the server from which to upload the file (the next-server parameter)

In general, any parameter can appear where ever that parameters are allowed, and will be applied according to the scope in which the parameter appears.

All parameters must be specified first before you can specify any declarations that depend on those parameters. Parameters should be set inside declarations so they can be set on a per-subnet or a per-host basis.

Declarations are used to:

Describe the topology of the network.

Describe clients on the network.

Provide addresses that can be assigned to clients.

Apply a group of parameters to a group of declarations.

Declarations about network topology include the subnet and the shared-network declarations.

For every subnet to be served, and for every subnet connected to the DHCP server, there must be one subnet declaration. This declaration tells the DHCP server how to recognize that an address is on that particular subnet. A subnet declaration is required for each subnet even if no addresses is dynamically allocated on that subnet.

There are different declarations required for different situations. The following are the basic declarations in a configuration file.

For clients with dynamically assigned addresses, a range declaration must appear within the subnet declaration, or a pool declaration.

For clients with statically assigned addresses, or for installations where only known clients will be served, each client must have a host declaration.

If parameters are to be applied to a group of declarations that are not related strictly on a per subnet, class, or pool basis, the group declaration can be used.

Some installations have physical networks allowing more than one IP subnet to operate. For example, if your site has a requirement that 8-bit subnet masks be used, but a department with a single physical ethernet network expands beyond 254 nodes, you may have to run two 8-bit subnets on the same ethernet until a new physical network is added. In this case, you can enclose the subnet declarations for the two networks in a shared-network declaration.

Some sites may have departments that have clients on more than one subnet. It may be desirable to offer those clients a uniform set of parameters that are different than what would be offered to clients from other departments on the same subnet.

For clients declared explicitly with host declarations, enclose the declarations in a group declaration using the parameters that are common to that department.

For clients with dynamically assigned addresses, group parameter assignments by network topology. Alternately, host declarations can provide parameters and if they have no fixed-address parameter, the clients get an address dynamically assigned. See Example 4-1.

Clients can be grouped into classes and assigned IP addresses from specific pools.

When a client is to be booted, its boot parameters are determined by consulting the following scopes in this order:

1 Client’s host declaration (if any).

2 Group declaration (if any) that enclosed the host declaration.

3 Subclass declaration for the subclass the client belongs to (if any).

4 Class declaration for the class the client belongs to (if any).

5 Pool declaration that the assigned IP address comes from (if any).

6 Subnet declaration for the subnet on which the client is booting.

7 Shared-network declaration (if any) containing that subnet.

8 Top-level parameters that may be specified outside of any declaration.

When searching for a host declaration, the DHCP server looks for one with a fixed-address parameter that matches the subnet or shared network on which the client is booting. If no such entry is found, it looks for an entry with no fixed-address parameter.

Imagine that you have a site with a lot of NCD X-Terminals. These terminals come in a variety of models, and you want to specify the boot files for each model. You could have host declarations for each server and group them by model:

Example 4-1 Host Declarations

group {
filename "Xncd19r";
next-server ncd-booter;
host ncd1 { hardware ethernet 0:c0:c3:49:2b:57; }
host ncd4 { hardware ethernet 0:c0:c3:80:fc:32; }
host ncd8 { hardware ethernet 0:c0:c3:22:46:81; }
}
group {
filename "Xncd19c";
next-server ncd-booter;
host ncd2 { hardware ethernet 0:c0:c3:88:2d:81; }
host ncd3 { hardware ethernet 0:c0:c3:00:14:11; }
}
group {
filename "XncdHMX";
next-server ncd-booter;
host ncd1 { hardware ethernet 0:c0:c3:11:90:23; }
host ncd4 { hardware ethernet 0:c0:c3:91:a7:8; }
host ncd8 { hardware ethernet 0:c0:c3:cc:a:8f; }
}

Address Allocation

Address allocation is done when a client is in the INIT state and has sent a DHCPDISCOVER message. When the DHCP server is looking for an IP address to allocate to a client, it checks first

if the client has an active lease on an IP address, or

if the client has an expired lease on an IP address that has not been reassigned.

It then follows these rules:

– If a lease was found but the client is not permitted to use it, then the lease is freed (if it was not expired already).

– If no lease is found or a lease was found and the client is not permitted to use the address, then the server looks for an address that is not in use and that the client is permitted to have among the list of address pools on the client’s subnet.

– If no addresses are found that can be assigned to the client, then no response is sent to the client.

– If an address is found that the client is permitted to have, then the address is allocated to the client.

Note! IP addresses that have never been assigned are chosen over those that have previously been assigned to other clients.

If the client thinks it has a valid lease and sends a DHCPREQUEST to initiate or renew that lease, the server has three choices. It can

Ignore the DHCPREQUEST.

Send a DHCPNAK, telling the client to stop using the address.

Send a DHCPACK, telling the client to use the address.

If the server finds the requested address and that address is available to the client, the server sends a DHCPACK.

If the address is no longer available or the client is not permitted to have it, the server sends a DHCPNAK.

If the server knows nothing about the address, the server remains silent. However, if the address is incorrect for the network segment to which the client is attached and the server is authoritative for that segment, the server sends a DHCPNAK.

Address Pools

Pool declarations let you have different allocation policies for different address allocation pools. A client may be denied access to one pool, but allowed access to another pool on the same network segment.

A pool declaration is used to specify how a group of addresses should be treated differently than another group of addresses, even if they are on the same network segment or subnet.

For example, you can provide a large set of addresses assigned to DHCP clients that are known to your DHCP server, while at the same time providing a small set of addresses that are available for unknown clients. If you have a firewall, you can arrange for addresses from one pool to have access to the Internet, while addresses in another pool do not have access to the Internet. The following example illustrates how you could set up a pair of pool declarations.

subnet 10.0.0.0 netmask 255.255.255.0 {
option routers 10.0.0.254;

# Unknown clients get this pool.
pool {
option domain-name-servers bogus.example.com;
max-lease-time 300;
range 10.0.0.200 10.0.0.253;
allow unknown clients;
}

# Known clients get this pool.
pool {
option domain-name-servers ns1.example.com, ns2.example.com;
max-lease-time 28800;
range 10.0.0.5 10.0.0.199;
deny unknown clients;
}
}

You can also set up entirely different subnets for known and unknown clients. This is possible because address pools exist at the level of shared networks, so address ranges within pool declarations can be on different subnets, as long as they are on the same shared network.

Pool Permit Lists

The above example shows that address pools can have permit lists. A permit list controls which clients are allowed access to the address pool and which clients are not allowed access. Each entry in a permit list is introduced with the allow or deny keyword. The following table describes the four possibilities for eligibility to addresses from the address pool.

If a pool has...

Then...

a permit list

only those clients that match specific entries on the permit list are eligible for addresses from the pool.

a deny list

only those clients that do not match any entries on the deny list are eligible for addresses from the pool.

both a permit list and a deny list

only clients that match the permit list and do not match the deny list are eligible for addresses from the pool.

neither a permit list nor a deny list

all clients are eligible for addresses from the pool.

Range declarations that appear outside of pool declarations in the same shared-network are grouped into two pools: one which allows all clients for range statements with the "dynamic-bootp" keyword and one which denies dynamic-bootp clients for range statements without the "dynamic-bootp" keyword.

As described in the Address Allocation section, the DHCP server checks each IP address to see if the client is permitted to use it, in response to both DHCPDISCOVER and DHCPREQUEST messages. The DHCP server checks both the address pool permit lists and the relevant in-scope allow and deny statements.

See Table 4-3 for the recognized allow and deny statements. They can be used to permit or refuse access to known or unknown clients, members of a class, dynamic bootp clients, or all clients.

Note! The DHCP v2.0 (TCPware v5.4) style allow and deny statements (e.g., allow/deny unknown-clients) and range statement dynamic-bootp keyword do not mix well with pool permit lists. A v2.0-style deny statement overrides the pool permit lists, and the dynamic-bootp keyword is ignored inside of pools. Note also that the default for dynamic-bootp changes from deny to allow when pools are used.

Client Classing

You can separate clients into classes, treating each client differently depending on what class it is in. To separate clients into classes, use conditional statements (see the Conditional Behavior section) or a match statement within a class declaration. You can specify a limit on the total number of clients within a particular class or subclass that may hold leases at one time using the lease limit statement. You can specify automatic subclassing based on the contents of the client packet using the spawn with statement.

To add clients to classes based on conditional evaluation, write a conditional statement to match the clients you want in the class. Then, put an add statement in the conditional's list of statements. For example, to identify requests coming from Microsoft(R) NT RAS servers:

if substring (option dhcp-client-identifier, 1, 3) = "RAS" {
add "ras-clients";
}

An equivalent way to do this is to specify the conditional expression as a matching expression in the class statement. For example:

class "ras-clients" {
match if substring (option dhcp-client-identifier, 1, 3) = "RAS";
}

Note! Whether you use matching expressions or add statements (or both) to classify clients, you must write a class declaration for any class that you use.

If you want no match statement and no in-scope statements for a class, the declaration looks like this, for example:

class "ras-clients" {
}

Important! The add statement adds the client to the class after the address assignment has been completed. This means the client will not be affected by pool permits related to that class if the client is a member of a class due to an add statement.

Subclasses

In addition to classes, you can declare subclasses. A subclass is a class having the same name as a regular class but with a specific submatch expression that is hashed for quick matching. It is quicker to find five subclasses within one class than it is to find five classes with match expressions. The following example illustrates how to code for subclasses:

class "allocation-class-1" {
match hardware;
}

class "allocation-class-2" {
match hardware;
}

subclass "allocation-class-1" 1:0:0:c4:aa:29:44;
subclass "allocation-class-1" 1:8:0:2b:4c:39:ad;
subclass "allocation-class-2" 1:8:0:2b:a9:cc:e3;

subnet 10.0.0.0 netmask 255.255.255.0 {
pool {
allow members of "allocation-class-1";
range 10.0.0.11 10.0.0.50;
}
pool {
allow members of "allocation-class-2";
range 10.0.0.51 10.0.0.100;
}
}

The data following the class name in the subclass declaration is a constant value used in matching the match expression for the class. During class matching, the server evaluates the match expression and looks up the result in the hash table. If a match if found, the client is considered a member of both the class and the subclass.

You can specify subclasses with or without scope (i.e., statements). In the above example, the sole purpose of the subclass is to allow some clients access to one address pool, while other clients are given access to the other pool. Thus, these subclasses are declared without any statements (scope). If you wanted to define different parameter values for some clients, you would declare those subclasses with scopes.

For example: if you had a single client needing some configuration parameters, while most did not, you might write the following subclass declaration for that client:

subclass "allocation-class-2" 1:08:00:2b:a1:11:31 {
option root-path "samsara:/var/diskless/alphapc";
filename "/tftpboot/netbsd.alphapc-diskless";
}

In the previous examples, subclassing is being used as a way to control address allocation on a per-client basis. However, it is possible to use subclassing in ways that are not specific to clients. For example, to use the value of the vendor-class-identifier option to determine what values to send in the vendor-encapsulated-options option. See the Vendor Encapsulated Options section.

Note! If you are using match hardware, the hardware address is preceded by the hardware type. In this example, the "1:" indicates Ethernet.

Per-Class Limits on Dynamic Address Allocation

The number of clients in a class that can be assigned leases can be limited. This limiting makes it difficult for a new client in a class to get an address. Once a class has reached its limit, the only way a new client in that class can get a lease is for an existing client to relinquish its lease, either by

letting it expire, or

sending a DHCPRELEASE packet.

The following example illustrates how to specify classes with lease limits.

class "limited-1" {
lease limit 4;
}

This produces a class in which a maximum of four members may hold leases at one time.

If you want to provide clients at a particular site with more than one IP address, but do not want to provide these clients with their own subnet, nor give them an unlimited number of IP addresses from the network segment to which they are connected, you can create a spawning class and use lease limits. A spawning class is a class that produces subclasses automatically based on what the client sends.

Many cable modem head-end systems can be configured to add a Relay Agent Information option to DHCP packets when relaying them to the DHCP server. These systems typically add a circuit ID or remote ID option that uniquely identifies the customer site. The following example illustrates how to write a class declaration to take advantage of these relay agent options to create lease limited classes on the fly:

class "customer" {
match if exists agent.circuit-id;
spawn with option agent.circuit-id;
lease limit 4;
}

With this class declaration, whenever a request comes in from a customer site, the circuit ID option is checked against the class's hash table.

If a subclass matches the circuit ID, the client is classified in that subclass.

If no subclass matches the circuit ID, a new subclass is created and logged in the dhcpd.leases file and the client is classified in the new subclass.

Once a client is classified, it is treated according to the rules of the class; as in the example above, being subjected to the per-site limit of four leases.

Note! The use of the subclass spawning mechanism is not restricted to relay agent options. This particular example is given only because it is a straightforward one.

Conditional Behavior

The DHCP server can be configured to perform conditional behavior depending on the packets it receives.

Conditional behaviour is specified using the if statement and the else or elsif statements. A conditional statement can appear anywhere that a regular statement can appear, and can enclose one or more such statements. The following is an example of a conditional statement.

if option dhcp-user-class = "accounting" {
max-lease-time 17600;
option domain-name "accounting.example.org";
option domain-name-servers ns1.accounting.example.org,
ns2.accounting.example.org;
} elsif option dhcp-user-class = "engineering" {
max-lease-time 17600;
option domain-name "engineering.example.org";
option domain-name-servers ns1.engineering.example.org,
ns2.engineering.example.org;
} else {
max-lease-time 600;
option domain-name "misc.example.org";
option domain-name-servers ns1.misc.example.org,
ns2.misc.example.org;
}

Both the if statement and the elsif continuation statement take expressions that, when evaluated, produce a boolean result. See the Expressions section for more information.

If the expression evaluates to true, then the statements enclosed in braces following the if statement are executed. All subsequent elsif and else clauses are skipped.

If the expression evaluates to false, then the statements enclosed in braces following the if statement are not executed and each subsequent elsif clause is checked until an elsif clause is encountered that evaluates to true.

If such an elsif clause is found, then the statements in braces following it are executed. Any subsequent elsif and else clauses are skipped.

If all the if and elsif clauses are checked but none of their expressions evaluate to true, then if there is an else clause, then the statements enclosed in braces following the else clause are evaluated.

Note! Boolean expressions that evaluate to null are treated as false in conditionals.

DNS Dynamic Updates Within DHCP

The DHCP server performs dynamic updates to DNS using DNS's dynamic updating functionality. To be sure that updates are allowed from the DHCP server, see Chapter 1, Domain Name Services. The allow-update { <address_match_list> }; statement in the Zone section enables the DNS server to allow updates from that system.

The following statements in the DHCP server configuration file are related to dynamic updating:

allow/deny dynamic-update;

allow/deny update-A-record;

allow/deny name-by-client;

invalid-ddns-chars {fail | discard | replace ["chars"]};

Dynamic updates can be enabled or disabled by using the allow/deny dynamic-update statement in the configuration file. The default is to not perform dynamic updates. Dynamic updates can be turned on or off on a per subnet basis.

Note! Dynamic updates are not done at all for static assignments to BOOTP clients, and the support for static assignments to DHCP clients is to add DNS entries only.

When dynamic updating is enabled, the DHCP server determines the client's Fully Qualified Domain Name (FQDN) and assigns it an IP address. The FQDN is determined either by what the client sends or by what is in the configuration file. This behavior is controlled by the allow/deny name-by-client statement in the configuration file.

If you use the deny name-by-client statement or if the client does not send a name, you must specify the host name in the configuration file using one of the following methods:

Using option host-name "name" (see the Host Name Generation section)

Specifying use-host-decl-names on in conjunction with host declarations.

If the hostname specified by the client contains invalid characters for DNS, the DHCP server can handle them one of three ways:

Consider it a failure and not do the dynamic update.

Throw away the invalid characters.

Replace the invalid characters with specified valid characters.

This behavior is controlled by the invalid-ddns-chars statement in the configuration file.

The FQDN and IP address are used in the dynamic update to create a PTR resource record (RR). The DHCP server also optionally creates an A RR. This option is enabled or disabled by using the allow/deny update-A-record statement in the configuration file. The default is to not create the A RR. This can be set on a per subnet basis. See Chapter 1, Domain Name Services for information about PTR resource records and A resource records.

When dynamic updating is allowed, the DHCP server adds the resource records whenever an IP address is leased to a client. The RRs are deleted if the IP address is released or if the IP address is leased to a different client. Also, the RRs are deleted for expired leases periodically.

Host Name Generation

Some DHCP clients require that the server send them a host name. The TCPware DHCP server can generate a host name if it cannot get the host name in another way. The generated host name can contain parts of the host's IP address, client ID, and/or MAC address. This host name is sent to the client and is combined with the domain name to create the Fully Qualified Domain Name (FQDN) required for dynamic DNS updates. See the DNS Dynamic Updates Within DHCP section. As described in the DNS updates section, the allow/deny name-by-client statement in the configuration file controls whether the DHCP server uses information from the client to determine the host name and FQDN.

The DHCP server generates a host name if it is enabled to do so and either of the following is specified:

allow name-by-client and the client does not send a host name

deny name-by-client and the DHCP server does not find a host name in the configuration file or in DNS (if get-lease-hostnames is set)

To enable the DHCP server to generate host names, specify in the configuration file an option host-name statement with a value containing certain key values in addition to any characters that are valid for the host-name option (see Table 4-2). The option host-name statement can be specified for example at the top level in a subnet statement, or in a host statement.

The key values are as follows. You can include more than one in the same host-name value.

Note! Some of these do not by themselves generate a unique identifier.

Key

Meaning

%A

First byte of the host's IP address.Example: for address 10.24.25.201, the key would return 10.

%B

Second byte of the host's IP address.Example: for address10.24.25.201, the key would return 24.

%C

Third byte of the host's IP address.Example: for address 10.24.25.201, the key would return 25.

%D

Fourth byte of the host's IP address.Example: for address 10.24.25.201, the key would return 201.

%H

Host part of the host's IP address.Example: for address 10.24.25.201 with subnet mask 255.255.0.0, the key would return 6601.

%I

Client Identifier sent by the host.

%-I

Client ID as above, except that hyphens (-) are used to separate each byte.

%M

MAC address of the host.

%-M

MAC address of the host, as above, except that hyphens (-) are used to separate each byte.

%N

Host name sent by the client, if any. If none, "Host".

%P

Printable characters from the client ID. For example: if the client ID was 0174657374, the 01 is thrown away and the resulting hostname is "test".

%S

Subnet part of the host's IP address.Example: for address 10.24.25.201 with subnet mask 255.255.0.0, the key would return 102400.

%-S

Subnet part of the host's IP address, as above, except that hyphens (-) are used to separate each byte. For example: 10-24-0-0.

You can intersperse string constants such as hyphens between key definitions. However, if the generated host name exceeds 63 characters, it is truncated. Here is an example host-name statement:

option host-name "Host%H-%-S";

For a lease pool defined with an address range of 192.168.11.6 through 192.168.11.10 and a subnet mask of 255.255.255.0, the DHCP server generates the following host names:

Host6-192-168-11-0
Host7-192-168-11-0
Host8-192-168-11-0
Host9-192-168-11-0
Host10-192-168-11-0

The %N key allows you to use the host name as sent by the client (option 12) and then add something unique to it to generate a unique name. For example, if multiple clients all send the name "dilbert" you can make them unique by appending the MAC (hardware) address, as follows:

deny name-by-client;
option host-name "%N-%M";

This would generate the host name "dilbert-010203040506" for a client with hardware address 01:02:03:04:05:06.

Configuration File Declarations and Parameters

Table 4-1 describes the declarations and parameters you can use in a configuration file.

See Table 4-9 for a list of DHCP Safe-failover-related configuration file statements.

Table 4-1 DHCP Statements (Continued)

Statement

Description

add

Use the add statement to add a client to the class whose name is specified in class-name.

Important! Because this statement executes after IP address allocation is completed, class membership caused by this statement cannot be used in the address allocation process.

add "class-name";

allow and deny

Use the allow and deny statements to control the behavior of the DHCP server.

The allow and deny keywords have different meanings depending on the context.

In a pool context, use these keywords to set up access lists for address allocation pools.

In other contexts, use these keywords to control general server behaviour with respect to clients based on scope.

allow and deny in scope

These allow and deny statements work the same way whether the client is sending a DHCPDISCOVER or a DHCPREQUEST message,

an address is allocated to the client (either the old requested address or a new address), and then,

that address is tested to see if it is okay for the client to have it.

If the client requested it, and it is not okay, the server sends a DHCPNAK message. Otherwise, the server does not respond to the client. If it is okay to give the address to the client, the server sends a DHCPACK message.

Note! These are not recommended for use inside pool declarations. See thePool Permit Lists section for an important note.

Use the unknown-clients flag to tell the DHCP server to dynamically assign addresses to unknown clients or to not assign addresses to unknown clients. An unknown client is one that does not have a host declaration. The default is to allow dynamic address assignments to unknown clients.

allow unknown-clients; deny unknown-clients;

Use the bootp flag to tell the DHCP server to respond to bootp queries or to not respond to bootp queries. The default is to allow bootp queries.

allow bootp; deny bootp;

Use the dynamic-bootp flag to tell the DHCP server to dynamically assign addresses to bootp clients or to not do so. The default is to allow dynamic bootp for IP addresses declared in pool declarations. The default for range statements outside of pool declarations is set by the presence or absence of the dynamic-bootp keyword. Deny dynamic-bootp overrides the dynamic-bootp range key word.

allow dynamic-bootp; deny dynamic-bootp;

Use the booting flag to tell the DHCP server to respond to queries from a particular client or to not respond to queries from a particular client. The default is to allow booting. If it is disabled for a particular client, that client will not be able to get an address from the DHCP server.

allow booting; deny booting;

allow and deny in scope (cont’d)

Use the dynamic-update flag to tell the DHCP server to perform dynamic DNS updates or to not perform them. The default is to deny dynamic DNS updates.

allow dynamic-update; deny dynamic-update;

Use the name-by-client flag to tell the DHCP server to determine the hostname and Fully Qualified Domain Name (FQDN) for dynamic DNS updates from information sent by the client or from information in the configuration file. The default is to deny use of client-specified information.

allow name-by-client; deny name-by-client;

Use the dhcpinform flag to tell the DHCP server to respond to DHCPINFORM messages or to not respond. The default is to allow DHCPINFORM messages for authoritative subnets, and to deny DHCPINFORM messages for non-authoritative subnets.

allow dhcpinform; deny dhcpinform;

Use the update-A-record flag to tell the DHCP server to update the A resource record or not when performing DNS updates (the PTR resource record is always updated). The default is to deny updating the A resource record.

allow update-A-record; deny update-A-record;

Use the ras-servers flag to tell the DHCP server to respond to queries from Microsoft (R) NT RAS Servers or to not respond to NT RAS queries. The default is to allow NT RAS queries.

allow ras-servers; deny ras-servers;

Allow/deny ras-servers is supported for backward compatibility. The way to do deny ras-servers in version 3.0 of DHCP (TCPware v5.5) is to use a conditional statement:

if substring (option dhcp-client-identifier, 1,3) = "RAS" { deny booting;}

allow and deny in pool declarations

See the Pool Permit Lists section for discussion, defaults, and important notes.

Use known clients to allow or prevent allocation from this pool to any client that has a host declaration. A client is known if it has a host declaration in any scope.

allow known clients; deny known clients;

Use unknown clients to allow or prevent allocation from this pool to any client that has no host declaration.

allow unknown clients; deny unknown clients;

Use members of "class" to allow or prevent allocation from this pool to any client that is a member of the named class.

allow members of "class-name";deny members of "class-name";

Use dynamic bootp clients to allow or prevent allocation from this pool to any BOOTP client.

allow dynamic bootp clients;deny dynamic bootp clients;

Use all clients to allow or prevent allocation from this pool to all clients. You can use this, for example, when you want to write a pool declaration but you want to hold it in reserve; or when you want to renumber your network quickly, and thus want the server to force all clients that have been allocated addresses from this pool to obtain new addresses immediately when they next renew their leases.

allow all clients; deny all clients;

always-broadcast

Use the always-broadcast statement to cause the DHCP server to always broadcast its responses. This feature is to handle clients who do not set the broadcast flag in their requests and yet require a broadcast response. We recommend you restrict the use of this feature to as few clients as possible.

always-broadcast flag;

always-reply-rfc1048

Some BOOTP clients expect RFC 1048-style responses, but do not follow RFC 1048 rules when sending their requests. You can determine if a client is having this problem:

if it is not getting the options you have configured for it.

and

if you see in the server log the message "(non-rfc1048)" printed with each BOOTREQUEST that is logged.

If you want to send RFC 1048 options to this kind of client, set the always-reply-rfc1048 option in that client's host declaration. The DHCP server responds with an RFC 1048-style vendor options field. This flag can be set in any scope, and affects all clients covered by that scope.

always-reply-rfc1048 flag;

[not] authoritative

When the DHCP server receives a DHCPREQUEST message from a DHCP client requesting a specific IP address, the DHCP protocol requires that the server determine whether the IP address is valid for the network to which the client is attached. If the address is not valid, the DHCP server should respond with a DHCPNAK message, forcing the client to acquire a new IP address.

To make this determination for IP addresses on a particular network segment, the DHCP server must have complete configuration information for that network segment. Unfortunately, it is not safe to assume that DHCP servers are configured with complete information. Therefore, the DHCP server normally assumes that it does not have complete information, and thus is not sufficiently authoritative to safely send DHCPNAK messages as required by the protocol.

This default assumption should not be true for any network segment that is in the same administrative domain as the DHCP server. For such network segments, the authoritative statement should be specified, so that the server sends DHCPNAK messages as required by the protocol. If the DHCP server receives requests only from network segments in the same administrative domain, you can specify the authoritative statement at the top of the configuration file (in the global scope).

Note! Version 2.0 (TCPware v5.4) of the DCHP server makes the opposite assumption: that the DCHP server is configured with all configuration information for all network segments of which it is aware. If this assumption is not valid for your configuration, you must write not authoritative statements for all network segments where this assumption is not true (or at the top of the configuration file).

authoritative;not authoritative;

class

This statement groups clients together based on information they send. A client can become a member of a class in the following ways:

through an add statement

based on the class’s matching rules

because the client matches a subclass of that class

Class-name is the name of the class and is used in:

add statements

members of permit statements

subclass declarations for subclasses of the named class

When a packet is received from a client, every class declaration is examined for a match, match if, or spawn statement. That statement is checked to see if the client is a member of the class.

The class declaration statements are lease limit, match, match if, and spawn with.

class "class-name" {[ statements ][ declarations ]}

default-lease-time

Time is the length (in seconds) that the DHCP server assigns to a lease if the requesting client did not ask for a specific amount of time for the lease to be active. The infinite lease value is "infinite". The default is 12 hours.

You should set the value of default-lease-time no larger than the value of max-lease-time.

default-lease-time time;

dynamic-bootp-lease-cutoff

Use the dynamic-bootp-lease-cutoff statement to set the ending time for all leases dynamically assigned to BOOTP clients. By default, the DHCP server assigns infinite leases to all BOOTP clients because they do not have any way of renewing leases, and do not know that their leases could expire. However, it may make sense to set a cutoff date for all BOOTP leases. For example, the end of a school term, or the time at night when a facility is closed and all machines are required to be powered off.

Date should be the date all assigned BOOTP leases will end. The date is specified in the form:

W YYYY/MM/DD HH:MM:SS

W is the day of the week, from zero (Sunday) to six (Saturday).YYYY is the year, including the century.MM is the number of the month, from 01 to 12.DD is the day of the month, counting from 01.HH is the hour, from 00 to 23. MM is the minute, from 00 to 59.SS is the second, from 00 to 59.The time is always in Greenwich Mean Time, not local time.

dynamic-bootp-lease-cutoff date;

dynamic-bootp-lease-length

Use the dynamic-bootp-lease-length statement to set the length of leases dynamically assigned to BOOTP clients. You may be able to assume that a lease is no longer in use if its holder has not used BOOTP or DHCP to get its address within a certain time period. The length of the time period is your judgment call.

Specify length in seconds. The infinite lease value is 0. If a BOOTP client reboots during a timeout period, the lease duration is reset to length so a BOOTP client that boots frequently never loses its lease. This parameter should be adjusted with extreme caution. The default is an infinite lease.

dynamic-boot-lease-length length;

filename

Use the filename statement to specify the name of the initial boot file that is to be loaded by a client. The filename should be recognizable to whatever file transfer protocol the client can be expected to use.

filename filename;

fixed-address

To make a static IP address assignment for a client, the client must match a host declaration, as described later. In addition, the host declaration must contain a fixed-address declaration. A fixed-address declaration specifies one or more IP addresses or domain names that resolve to IP addresses. If a client matches a host declaration, and one of the IP addresses specified in the host declaration is valid for the network segment to which the client is connected, the client is assigned that IP address.

A static IP address assignment overrides a dynamically assigned IP address that is valid on that network segment. That is, if a new static mapping for a client is added after the client has a dynamic mapping, the client cannot use the dynamic mapping the next time it tries to renew its lease. The DHCP server will not assign an IP address that is not correct for the network segment to which the client is attached and will not override a valid dynamic mapping for one network segment based on a static mapping that is valid on a different network segment.

You can specify a domain name instead of an IP address in a fixed-address declaration. However, you should do this only for long-lived domain name records the DHCP server only looks up the record on startup. So, if the record changes while the server is running, the server continues to use the record’s former value.

fixed-address address [,...,address];

get-lease-hostnames

Use the get-lease-hostnames statement to tell the DHCP server to look up the domain name corresponding to each address in the lease pool and use that address for the DHCP hostname option.

If flag is true, the lookup is done for all addresses in the current scope.

If flag is false (the default), lookups are not done.

get-lease-hostnames flag;

group

Use the group statement to apply one or more parameters to a group of declarations. You can use it to group hosts, shared networks, subnets, or other groups.

group {[parameters] [declarations]}

hardware

Use the hardware clause inside a host statement to specify the network hardware address of a BOOTP or DHCP client.

hardware-type must be the name of a physical hardware interface type. Ethernet, Token-Ring, and FDDI are the only recognized types.

The hardware-address should be a set of hexadecimal octets (numbers from 0 through ff) separated by colons (:).

hardware hardware-type hardware-address;

host

The host declaration provides information about a particular client.

Name should be a unique name for the host declaration, but a specific meaning is not required. If the use-host-decl-names flag is enabled, name is sent in the host-name option if no host-name option is specified.

Host declarations match DHCP or BOOTP clients based on either the client's hardware address or the dhcp-client-identifier option that the client sends. BOOTP clients do not normally send a dhcp-client-identifier option. So, you must use the hardware address for all clients that might send BOOTP protocol requests.

The host declaration has three purposes:

to assign a static IP address to a client

to declare a client as "known"

to specify a scope in which statements can be executed for a specific client

You can make the DHCP server treat some DHCP clients differently from others if host declarations exist for those clients. Any request coming from a client that matches a host declaration is considered to be from a "known" client. Requests that do not match any host declaration are considered to be from "unknown" clients. You can use this knowledge to control how addresses are allocated.

It is possible to write more than one host declaration for a client. If you want to assign more than one static address to a given client, you can either specify more than one address in the fixed-address statement or you can write multiple host declarations.

Multiple host declarations are needed if the client has different requirements (scopes) on different subnets. For each IP address that requires a different scope, one host declaration should exist. A client can be in the scope of only one host declaration at a time. Host declarations with static address assignments are in scope for a client only if one of the address assignments is valid for the network segment to which the client is connected. If you want to boot a client using static addresses on some subnets, and using dynamically assigned addresses on other subnets, you need to write a host declaration with no fixed-address statement. There can be only one such host declaration per client. Its scope is used whenever that client receives a dynamically assigned address.

host name { [statements] [declarations] }

if

The if statement conditionally executes statements based on the values the client sends or other information. See the Conditional Behavior section for more information.

if boolean-expression { [statements] }[elsif boolean-expression { [statements] }][else { [statements] } ]

invalid-ddns-chars

This statement specifies how DHCP should handle invalid characters in the hostname for Dynamic DNS updates (DDNS).

fail tells DHCP to display a message and not perform any DNS updates if there are any invalid characters in the hostname. This is the same as the behavior of the DHCP server in TCPware V5.4. This is the default.

invalid-ddns-chars fail;

discard tells DHCP to throw away the invalid characters in the hostname.

invalid-ddns-chars discard;

replace tells DHCP to replace the invalid characters with the specified character(s). If none are specified, the default replacement character is the hyphen ('-').

invalid-ddns-chars replace ["characters"];

lease limit

This statement causes the DHCP server to limit the number of members of a class that can hold a lease at any one time. This limit applies to all addresses the DHCP server allocates in the class, not just addresses on a particular network segment.

If a client is a member of more than one class with lease limits, the server assigns the client an address based on either class.

If a client is a member of one or more classes with limits and one or more classes without limits, the classes without limits are not considered.

lease limit limit;

lease-scan-interval

This statement specifies how frequently to scan for expired leases. The default is 60 seconds.

lease-scan-interval seconds;

match

data-expression is evaluated using the contents of a client’s request. If it returns a value that matches a subclass of the class in which the match statement appears, the client is considered a member of both the subclass and the class.

match data-expression;

match if

boolean-expression is evaluated when the server receives a packet from the client. If it is true, the client is considered a member of the class. The boolean-expression may depend on the contents of the packet the client sends.

match if boolean-expression;

max-delayed-acks

Use the max-delayed-acks statement to specify the maximum number of DHCPACKs to batch up. The default is 8. To disable the delaying of DHCPACKs, specify a value of 1.

To improve performance under very heavy loads, the DHCP server delays sending DHCPACK messages by up to 2 seconds. All DHCPACKs accumulated in that time are sent in a batch.

max-delayed-acks count;

max-lease-time

Use the max-lease-time statement to assign the maximum amount of time (in seconds) to a lease. The only exception to this is Dynamic BOOTP lease lengths because they are not specified by the client and are not limited by this maximum. The infinite lease value is "infinite". The default is 86,400 seconds (24 hours).

Note! You should set the value of max-lease-time at least as large as default-lease-time.

max-lease-time time;

min-lease-time

Use the min-lease-time statement to assign the minimum length in seconds to a lease. The infinite lease value is "infinite". By default, there is no minimum.

min-lease-time should be less than or equal to default-lease-time and max-lease-time.

min-lease-time time;

min-secs

Use the min-secs statement to assign the minimum amount of time (in seconds) it takes for the DHCP server to respond to a client’s request for a new lease.

The number of seconds is based on what the client reports in the secs field of the requests it sends. The maximum value is 255 seconds. Usually, setting this to one second results in the DHCP server not responding to the client's first request, but always responding to the client’s second request.

You can use the min-secs statement to set up a secondary DHCP server to never offer an address to a client until the primary server has been given a chance to do so. If the primary server is down, the client binds to the secondary server; otherwise, clients should always bind to the primary.

Note! This does not permit a primary server and a secondary server to share a pool of dynamically-allocatable addresses.

See information about Safe-failover in this chapter.

min-secs seconds;

next-server

Use the next-server statement to specify the host address of the server from where the client will load the initial boot file (specified in the filename statement).

server-name should be a numeric IP address or a domain name. The DHCP server’s IP address is used if no next-server parameter applies to a given client.

next-server name;

one-lease-per-client

Use the one-lease-per-client statement to have the server free any other leases the client holds when the client sends a DCCPREQRUEST for a particular lease.

This presumes the client has forgotten any lease not mentioned in the DHCPREQUEST. For example, the client has only a single network interface and it does not remember leases it is holding on networks to which it is not currently attached. Neither of these assumptions are guaranteed or provable, so use caution in the use of this statement.

one-lease-per-client flag;

option

This statement specifies actual DHCP protocol options to send to the client. The option statement is described in the next section.

option definition

This statement assigns a name and a type to an option code. See the Defining New Options section for more information.

option name code code = definition;

option space

This statement specifies a new option space. This declaration must precede all definitions for options in the space being specified. Space-name should be the name of the option space. Currently three option space names are predefined:

dhcp (default)

agent

server

If an option name is specified without an option space, it is assumed the name refers to an option in the dhcp option space. For example, the option names dhcp.routers and routers are equivalent.

option space space-name;

ping

The DHCP server uses ping to check if a particular IP address is in use by sending a packet of information and waiting for a response. This statement turns ping on and off. The default is on.

ping flag;

ping-retries

This statement defines the number of times the DHCP server pings an IP address before it concludes that the address is not in use. The default is 1.

ping-retries count;

ping-timeout

This statement defines the time (in seconds) that ping should wait for a response. The default is 1 second.

ping-timeout time;

pool

This statement specifies an address pool from which IP addresses can be allocated. This pool can be customized to have its own permit list to control client access and its own scope to declare pool-specific parameters. You can put pool declarations within subnet declarations or within shared-network declarations. You can use the range declaration to specify the addresses in a particular pool.

For subnet declarations: specified addresses must be correct within the pool declaration within which it is made.

For shared-network declarations: specified addresses must be on subnets that were previously specified within the same shared-network declaration.

pool {[permit list][range declaration][statements]}

range

For any subnet on which addresses are assigned dynamically, there must be at least one range declaration. The range declaration specifies that the server may allocate to DHCP clients every address, from low-address to high-address. You can specify a single IP address by omitting high-address.

All IP addresses in the range should be on the same subnet. If the range declaration appears within a subnet declaration, all addresses should be on the declared subnet. If the range declaration appears within a shared-network declaration, all addresses should be on subnets already declared within the shared-network declaration.

You may specify the dynamic-bootp flag if addresses in the specified range can be dynamically assigned to both BOOTP and DHCP clients.

Note! The dynamic-bootp flag was deprecated in version 3.0 (TCPware v5.5) of the DHCP server in favor of declaring the address within a pool and specifying in the permit list that dynamic allocation for BOOTP clients is permitted.

range [dynamic-bootp] low-address [high-address];

requested-options-only flag;

Use the requested-options-only statement to send just the options requested by the client. To send a specific set of options, set requested-options-only to true and specify the dhcp-parameter-request-list option.

The following sends only the subnet-mask, routers, and domain-name-servers options to the client (assuming they are defined in the configuration file):

host restricted { hardware ethernet 01:02:03:04:05:06; option dhcp-parameter-request-list 1, 3, 6; requested-options-only true;}

We recommend you restrict the use of this feature to as few clients as possible.

requested-options-only flag;

server-identifier

The server-identifier statement is equivalent to the dhcp-server-identifier option. See the dhcp-server-identifier option for more information

server-identifier hostname;

server-name

Use the server-name statement to inform the client of the server’s name from which it is booting. name should be the name provided to the client.

server-name name;

shared-network

Use this statement to inform the DHCP server that some IP subnets share the same physical network. Declare all subnets in the same shared network within a shared-network statement.

Parameters specified in the shared-network statement will be used when booting clients on those subnets unless parameters provided at the subnet or host level override them. If more than one subnet in a shared network has addresses available for dynamic allocation, those addresses are collected into a common pool. There is no way to specify which subnet of a shared network a client should boot on.

Name should be the name of the shared network. Make the name descriptive as it will be used when printing debugging messages. Give it a syntax of a valid domain name (although it will never be used as such), or any arbitrary name enclosed in quotation marks.

shared-network name {[parameters] [declarations]}

site-option-space

Use the site-option-space statement to determine the option space from which site-local options are taken. Site-local options have codes ranging from 128 to 254. If no site-option-space is specified, site-specific options are taken from the default option space.

site-option-space option-space;

spawn with

data-expression must evaluate to a non-null value for the server to look for a subclass of the class that matches the evaluation.

If such a subclass exists, the client is considered a member of both the subclass and the class.

If no such subclass exists, one is created and recorded in the lease database, and the client is considered a member of the new subclass as well as the class.

spawn with data-expression;

subclass

This statement specifies a subclass of the class named by class-name. Class-data should be either

a text string enclosed in quotes, or

a list of bytes expressed in hexadecimal, separated by colons.

Clients match subclasses after evaluating the match or spawn with statements in the class declaration for class-name. If the evaluation matches class-data, the client is a member of the subclass and the class.

subclass "class-name" class-data;subclass "class-name" class-data { [statements]}

subnet

This statement contains information specific to a subnet. The information communicates the following to DHCP:

Enough information for DHCP to determine if an IP address is on that subnet.

What the subnet-specific parameters are.

What addresses may be dynamically allocated to clients booting on that subnet.

Use the range declaration to specify what addresses are available to be dynamically allocated to clients booting on the subnet.

Two things are required to define a subnet:

The subnet-number

The netmask

The subnet-number and the netmask entry is an IP address or domain name that resolves to the subnet-number or the netmask of the subnet being described. The subnet-number and the netmask are enough to determine if any given IP address is on the specified subnet.

Note! A netmask must be given with every subnet declaration. If there is any variance in subnet masks at a site, use a subnet-mask option statement in each subnet declaration to set the desired subnet mask. The subnet-mask option statement overrides the subnet mask declared in the subnet statement.

subnet subnet-number netmask netmask{[parameters][declarations]}

use-host-decl-names

If the use-host-decl-names parameter is true, the name provided for each host declaration is given to the client as its hostname. The default is false. For example,

group { use-host-decl-names on; host joe { hardware ethernet 08:00:2b:4c:29:32; fixed-address joe.fugue.com; }}

is equivalent to

host joe { hardware ethernet 08:00:2b:4c:29:32; fixed-address joe.fugue.com; option host-name "joe";}

An option host-name statement within a host declaration overrides the use of the name in the host declaration.

use-host-decl-names flag;

use-lease-addr-for-default-route

If the use-lease-addr-for-default-route parameter is true in a given scope, the IP address of the lease being assigned is sent to the client instead of the value specified in the routers option (or sending no value at all). This causes some clients to ARP for all IP addresses, which can be helpful if your router is configured for proxy ARP.

If use-lease-addr-for-default-route is enabled and an option routers statement are both in scope, use-lease-addr-for-default-route is preferred.

use-lease-addr-for-default-route flag;

user-class

This statement has been deprecated in favor of the more powerful class statement. See the example in the Vendor Encapsulated Options section.

vendor-class

This statement has been deprecated in favor of the more powerful class statement. See the example in the Vendor Encapsulated Options section.

vendor-option-space

Use the vendor-option-space statement to instruct the server to construct a vendor-encapsulated-options option using all the defined options in the option space. If no vendor-encapsulated-options option is defined, the server sends this option to the client, if appropriate.

vendor-option-space option-space;

Expressions

The DHCP server can evaluate expressions while executing statements. The DHCP server’s expression evaluator returns the following types:

A boolean, a true or false (on or off) value.

An integer, a 32-bit quantity that may be treated as signed or unsigned, depending on the context.

A string of data, a collection of zero or more bytes. Any byte value is valid in a data string — the DHCP server maintains a length rather than depending on a NUL termination.

Expression evaluation is performed when a request is received from a DHCP client. Values in the packet sent by the client can be extracted and used to determine what to send back to the client. If the expression refers to a field or option in the packet for which there is no value, the result is null. Null values are treated specially in expression evaluation. A Boolean expression that returns a null value is considered false. A data expression that returns a null value generally results in the statement using the value not having any effect.

The following is an example of using four types of expressions to produce the name of a PTR record for the IP address being assigned to a client:

concat (binary-to-ascii (10, 8, ".", reverse (1, leased-address)),
".in-addr.arpa.");

BOOLEAN EXPRESSIONS

The following are the boolean expressions supported by DHCP.

boolean-expression-1 and boolean-expression-2

The and operator evaluates to true if both boolean expressions evaluate to true. The and operator evaluates to false if either boolean expression does not evaluate to true. If either of the boolean expressions is null, the result is null.

boolean-expression-1 or boolean-expression-2

The or operator evaluates to true if either of the boolean expressions evaluate to true. The or operator evaluates to false if both of the boolean expressions evaluate to false. If either of the boolean expressions is null, the result is null.

check "class-name"

The check operator evaluates to true if the packet being considered comes from a client in the specified class. Class-name must be a string that corresponds to the name of a defined class.

data-expression-1 = data-expression-2

The = operator compares the results of evaluating two data expressions, evaluating to true if they are the same; evaluating to false if they are not. If one of the expressions is null, the result is null.

exists option-name

The exists expression evaluates to true if the specified option exists in the incoming DHCP packet.

known

The known expression evaluates to true if the client whose request is being processed is known; that is, if the client has a host declaration.

not boolean-expression

The not operator evaluates to true if the boolean expression evaluates to false. The not operator evaluates to false if the boolean expression evaluates to true. If the boolean expression evaluates to null, the result is null.

DATA EXPRESSIONS

The following are the expressions supported by DHCP that return a data string.

binary-to-ascii (numeric-expr1, numeric-expr2, data-expr1, data-expr2)

numeric-expr1, numeric-expr2, data-expr1, and data-expr2 are all evaluated as expressions and the results of those evaluations are used as follows.

The binary-to-ascii operator converts the binary data in data-expr2 into an ASCII string, using data-expr1 as a separator. How the conversion is done is controlled by numeric-expr1 and numeric-expr2.

numeric-expr1 specifies the base to convert into. Any value 2 through 16 is supported. For example, a value of 10 would produce decimal numbers in the result.

numeric-expr2 specifies the number of bits in data-expr2 to treat as a single unit. The value can be 8, 16, or 32.

This example converts the binary value of an IP address into its dotted decimal equivalent:

binary-to-ascii(10, 8, ".", 168364039)

The result would be the string "10.9.8.7".

colon-separated hexadecimal list

A list of hexadecimal octet values, separated by colons, may be specified as a data expression. A single hexadecimal number, appearing in a context where a data string is expected, is interpreted as a data string containing a single byte.

concat (data-expr1, data-expr2)

data-expr1 and data-expr2 are evaluated and the concatenated result of these two evaluations is returned.

If either subexpression evaluates to null, the result is the value of the expression that did not evaluate to null.

If both expressions evaluate to null, the result is null.

encode-int (numeric-expr, width)

numeric-expr is evaluated and encoded as a data string of the specified width, in network byte order (with the most significant byte first). If numeric-expr evaluates to null, the result is null.

hardware

The hardware operator returns a data string whose first element is the htype field of the packet being considered, and whose subsequent elements are the first hlen bytes of the chaddr field of the packet.

If there is no packet, or if the RFC 2131 hlen field is invalid, the result is null.

Supported hardware types are:

ethernet (1)

token-ring (6)

fddi (8)

leased-address

In any context where the processing client request has been assigned an IP address, this data expression returns that IP address.

option option-name

The option operator returns the contents of the specified option in the incoming DHCP packet.

packet (offset, length)

The packet operator returns the specified portion of the packet being considered. The packet operator returns a value of null where no packet is being considered. Offset and length are applied to the contents of the packet as in the substring operator. The link-layer, IP, and UDP headers are not available.

reverse (numeric-expr1, data-expr2)

numeric-expr1 and data-expr2 are evaluated. The result of data-expr2 is reversed in place, using chunks of the size specified in numeric-expr1.

For example, if numeric-expr1 evaluates to four and data-expr2 evaluates to twelve bytes of data, the reverse expression evaluates to twelve bytes of data constructed in the following way:

the last four bytes of the input data,

followed by the middle four bytes,

followed by the first four bytes.

substring (data-expr, offset, length)

The substring operator evaluates the data expression and returns the substring of the result of that evaluation that starts offset bytes from the beginning and continues for length bytes. Offset and length are numeric expressions.

If data-expr, offset, or length evaluate to null, the result is null.

If offset is greater than or equal to the length of the evaluated data, a zero-length data string is returned.

If length is greater than the remaining length of the evaluated data after offset, a data string containing all data from offset to the end of the evaluated data is returned.

suffix (data-expr, length)

The suffix operator evaluates data-expr and returns the last length bytes of that evaluation. Length is a numeric expression.

If data-expr or length evaluate to null, the result is null.

If length evaluates to a number greater than the length of the evaluated data, the evaluated data is returned.

"text"

A text string, enclosed in quotes, may be specified as a data expression. The string returns the text between the quotes, encoded in ASCII.

NUMERIC EXPRESSIONS

Numeric expressions evaluate to an integer. In general, the precision of numeric expressions is at least 32 bits. However, the precision of such integers may be more than 32 bits.

extract-int (data-expr, width)

The extract-int operator extracts an integer value in network byte order after evaluating data-expr. Width is the width in bits (either 8, 16, 32) of the integer to extract. If the evaluation of data-expr does not provide an integer of the specified size, a value of null is returned.

number

Number can be any numeric value between zero and the maximum representable size.

DHCP Options

The Dynamic Host Configuration protocol allows the client to receive options from the DHCP server describing the network configuration and various services that are available on the network. When configuring the DHCP server, options must often be declared. The syntax for declaring options, and the names and formats of the options in the default dhcp option space that can be declared, are in Table 4-2.

DHCP option statements always start with the keyword option, followed by an option name, followed by option data. Only options needed by clients must be specified.

An option name is an optional option space name followed by a period (".") followed by the option name. The default option space is dhcp. There are two other predefined option spaces: agent and server. You can also define option spaces of your own. See the sections Relay Agent Information Option and Defining New Options in this chapter.

Option data comes in these formats:

The ip-address data type can be entered either as an explicit IP address (e.g., 239.254.197.10) or as a domain name (e.g., haagen.isc.org). When entering a domain name, be sure that the domain name resolves to the single IP address.

The int32 and uint32 data types specify signed and unsigned 32-bit integers.
The int16 and uint16 data types specify signed and unsigned 16-bit integers.
The int8 and uint8 data types specify signed and unsigned 8-bit integers. Unsigned 8-bit integers are also sometimes referred to as octets.

The string data type specifies an NVT ASCII string. It must be enclosed in quotation marks. For example, option domain-name "isc.org";

The flag data type specifies a boolean value. Booleans can be either true (ON) or false (OFF). You can use TRUE and FALSE, or ON and OFF.

The data-string data type specifies either an NVT ASCII string enclosed in quotation marks, or a series of octets specified in hexadecimal, separated by colons. For example, option dhcp-client-identifier "CLIENT-FOO"; or option dhcp-client-identifier 43:4c:49:54:2d:46:4f:4f;

Strings and data-strings when enclosed in quotation marks can contain normal C-type characters such as "\t" for a tab.

If the option value is a list (such as for the routes option), you must list them in the configuration file in the order you want the client to use the values. The DHCP server does not re-order them.

Also, option data may be specified using an expression that returns a data string (see the Expressions section). The syntax is

option option-name = data-expression;

Standard DHCP Options

Table 4-2 describes the standard DHCP options. Underlined items indicate user input items.

Note! All of these options could be specified with the dhcp option space listed explicitly. For example:

option dhcp.bootfile-name "bootfile.lis";

Table 4-2 DHCP Option Space Options (Continued)

Option

Description

option all-subnets-local flag;

Use this option to indicate whether or not to assume all subnets of the client’s IP network use the same MTU as the client’s subnet.ON means assume all subnets share the same MTU.OFF means assume some subnets have smaller MTUs.

option arp-cache-timeout uint32;

Use this option to identify the timeout (in seconds) for ARP cache entries.

option bootfile-name string;

Use this option to identify a bootstrap file. If this option is supported by the client, it should have the same effect as the filename declaration. BOOTP clients are unlikely to support this option. Some DHCP clients support it; others require it.

option boot-size uint16;

Use this option to specify the length in 512-octet blocks of the client’s default boot image.

option broadcast-address ip-address;

Use this option to identify the broadcast address in use on the client’s subnet. See STD 3 (RFC 1122), section 3.2.1.3 for legal values for broadcast addresses.

option cookie-serversip-address [, ip-address ...];

Use this option to list RFC 865 cookie servers in order of preference.

option default-ip-ttl uint8;

Use this option to identify the default time-to-live the client should use on outgoing datagrams.

option default-tcp-ttl uint8;

Use this option to identify the default TTL to use when sending TCP segments. The minimum value is 1.

option dhcp-client-identifier data-string;

Use this option to specify a DHCP client identifier only in a host declaration. The DHCP server uses it to locate the host record by matching against the client identifier.

option dhcp-max-message-size uint16;

Use this option to specify the maximum length DHCP message that the client is able to accept. Use this option in the DHCP configuration file to supply a value when the client does not.

Note! Use this option with caution. Make sure that the client can accept a message of the specified size.

option dhcp-parameter-request-listuint8[,uint8...];

Use this option to request that the server return certain options. Use this option in the DHCP configuration file to override the client's list, or to supply a list when the client does not. The value is a list of valid DHCP option codes as listed in RFC 2132.

option dhcp-server-identifier ip-address;

Use this option to identify the value sent in the DHCP Server Identifier option. The value must be an IP address for the DHCP server, and must be reachable by all clients it is sent to.

It is recommended to NOT use the dhcp-server-identifier option. The only reason to use it is to force a value other than the default value to be sent on occasions where the default value would be incorrect. The default value is the first IP address associated with the physical network interface on which the request arrived. The usual case where the dhcp-server-identifier option needs to be sent is when a physical interface has more than one IP address, and the one being sent by default is not appropriate for some or all clients served by that interface.

Another case is when an alias is defined for the purpose of having a consistent IP address for the DHCP server, and it is desired that the clients use this IP address when contacting the server.

option domain-name-serversip-address [, ip-address ...];

Use this option to list Domain Name System (STD 12, RFC 1035) name servers in order of preference.

option domain-name string;

Use this option to identify the domain name the client should use when resolving hostnames via the Domain Name System.

option extensions-path string;

Use this option to indicate the path-name of a file the client should load containing more options.

option finger-serverip-address [, ip-address ...];

Use this option to list the Finger servers in order of preference.

option font-servers ip-address [, ip-address ...];

Use this option to list X Window System Font servers in order of preference.

option host-name string;

Use this option to name the client. The name may or may not be qualified with the local domain name. It is preferable to use the domain-name option to specify the domain name. See RFC 1035 for character set restrictions.

The host-name option is also used to specify a template for hostname generation. See the Host Name Generation section.

option ieee802-3-encapsulation flag;

If the interface is an Ethernet, use this option to indicate whether the client uses Ethernet Version 2 (RFC 894) or IEEE 802.3 (RFC 1042) encapsulation.OFF means use RFC 894 encapsulation.ON means use RFC 1042 encapsulation.

option ien116-name-servers ip-address [, ip-address ...];

Use this option to list IEN 116 name servers in order of preference.

option impress-serversip-address [, ip-address ...];

Use this option to list Imagen Impress servers in order of preference.

option interface-mtu uint16;

Use this option to identify what MTU value to use on this interface. The minimum legal value is 68.

option ip-forwarding flag;

Use this option to indicate if the client should configure its IP layer for packet forwarding.ON means disable forwarding.OFF means enable forwarding.

option irc-serverip-address [, ip-address ...];

Use this option to list the IRC servers in order of preference.

option log-serversip-address [, ip-address ...];

Use this option to list MIT-LCS UDP log servers in order of preference.

option lpr-serversip-address [, ip-address ...];

Use this option to list RFC 1179 line printer servers in order of preference.

option mask-supplier flag;

Use this option to indicate whether or not the client should respond to subnet mask requests using ICMP.ON means do not respond to subnet mask requests.OFF means respond to subnet mask requests.

option max-dgram-reassembly uint16;

Use this option to indicate the maximum size datagram the client should be prepared to reassemble. The minimum legal value is 576.

option merit-dump string;

Use this option to indicate the path-name of a file to which the client’s core image should be dumped in the event of a client crash. The path is formatted as a character string using the NVT ASCII character set.

option mobile-ip-home-agentip-address [, ip-address ...];

Use this option to list mobile IP home agents in order of preference. Usually there will be only one agent.

option nds-context data-string;

Use this option to identify the initial NDS context the client should use.

option nds-servers ip-address [, ip-address...];

Use this option to list Novell Directory Services servers in order of preference.

option nds-tree-name data-string;

Use this option to name the NDS tree the client will be contacting.

option netbios-dd-serverip-address [, ip-address ...];

Use this option to list RFC 1001/1002 NetBIOS Datagram Distribution servers in order of preference.

option netbios-name-serversip-address [, ip-address ...];

Use this option to list RFC 1001/1002 NetBIOS Name Server name servers in order of preference.

Note! NetBIOS is the same as WINS.

option netbios-node-type uint8;

Use this option to configure configurable NetBIOS over TCP/IP clients as described in RFC 1001/1002. The value is a single octet identifying the client type. Possible node types are1 B-node: BroadcastNo WINS2 P-node: PeerWINS only4 M-node: MixedBroadcast, then WINS8 H-node: HybridWINS, then Broadcast

option netbios-scope string;

Use this option to specify the NetBIOS over TCP/IP scope parameter for the client as specified in RFC 1001/1002. See RFC1001, RFC1002, and RFC1035 for character-set restrictions.

option nis-domain string;

Use this option to specify the client’s NIS (Sun Network Information Services) domain. Use the NVT ASCII character set to define the domain character string.

option nis-serversip-address [, ip-address ...];

Use this option to list NIS servers in order of preference.

option nisplus-domain string;

Use this option to specify the client's NIS+ domain. Use the NVT ASCII character set to define the domain character string.

option nisplus-servers ip-address [, ip-address ...];

Use this option to list NIS+ servers in order of preference.

option non-local-source-routing flag;

Use this option to indicate if the client should configure its IP layer to allow forwarding of datagrams with non-local source routes.ON means disable forwarding.OFF means enable forwarding.

option nntp-serverip-address [, ip-address ...];

Use this option to list NNTP servers in order of preference.

option ntp-serversip-address [, ip-address ...];

Use this option to list NTP (RFC 1035) servers in order of preference.

option option-nnn data-string;

Use this option to identify any DHCP option not listed here. nnn is the number of the option.

option path-mtu-aging-timeout uint32;

Use this option to specify the timeout to use (in seconds) when aging Path MTU values that were discovered by the mechanism defined in RFC 1191.

option path-mtu-plateau-table uint16 [, uint16 ...];

Use this option to specify a table of MTU sizes to use when performing Path MTU Discovery as defined in RFC 1191. The table is a list of 16-bit unsigned integers. You must list them in order from smallest to largest. The minimum MTU value cannot be smaller than 68.

option perform-mask-discovery flag;

Use this option to indicate whether or not the client should perform subnet mask discovery using ICMP.ON means do not perform mask discovery.OFF means perform mask discovery.

option policy-filter ip-address ip-address [, ip-address ip-address ...];

Use this option to indicate the policy filters for non-local source routing. The filters consist of IP addresses and masks that indicate which destination/mask pairs to use when filtering incoming source routes.

The client should discard any source routed datagram whose next-hop address does not match one of the filters. See STD 3 (RFC 1122) for more information.

option pop-serverip-address [, ip-address ...];

Use this option to list POP3 servers in order of preference.

option resource-location-servers ip-address [, ip-address ...];

Use this option to list RFC 887 Resource Location servers in order of preference.

option root-path string;

Use this option to specify the path-name that contains the client’s root disk. The path is formatted as a character string using the NVT ASCII character set.

option router-discovery flag;

Use this option to indicate whether or not the client should solicit routers using the Router Discovery mechanism defined in RFC 1256.ON means do not perform router discovery.OFF means perform router discovery.

option routersip-address [, ip-address ...];

Use this option to list IP addresses for routers on the client’s subnet, listing the routers in order of preference.

option router-solicitation-addressip-address;

Use this option to identify the address where the client transmits router solicitation requests.

option smtp-serverip-address [, ip-address ...];

Use this option to list SMTP servers in order of preference.

option static-routes ip-addressip-address [, ip-address ip-address ...];

Use this option to specify a list of static routes that the client should install in its routing cache. If there are multiple routes to the same destination, you should list them in descending order of priority.

The routes are made up of IP address pairs. The first address is the destination address; the second address is the router for the destination.

The default route (0.0.0.0) is an illegal destination for a static route. Use the routers option to specify the default route.

option streettalk-directory-assistance-server ip-address [, ip-address ...];

Use this option to list the StreetTalk Directory Assistance (STDA) servers in order of preference.

option streettalk-serverip-address [, ip-address ...];

Use this option to list the StreetTalk servers in order of preference.

option subnet-mask ip-address;

Use this option indicate the client’s subnet mask as per RFC 950. If no subnet mask option is in scope, the DHCP server uses the subnet mask from the subnet declaration on which the address is being assigned. If a subnet mask option is in scope for the address being assigned, it overrides the subnet mask specified in the subnet declaration.

option swap-server ip-address;

Use this option to identify the IP address of the client’s swap server.

option tcp-keepalive-garbage flag;

Use this option to indicate whether the client sends TCP keepalive messages with an octet of garbage for compatibility with older implementations.ON means do not send a garbage octet.OFF means send a garbage octet.

option tcp-keepalive-interval uint32;

Use this option to indicate the interval (in seconds) the client TCP waits before sending a keepalive message on a TCP connection. The time is specified as a 32-bit unsigned integer.0 (zero) means do not generate keepalive messages unless requested by an application.

option tftp-server-name string;

Use this option to identify a TFTP server. If this option is supported by the client, it should have the same effect as the server-name declaration. BOOTP clients are unlikely to support this option. Some DHCP clients support it; others require it.

option time-offset int32;

Use this option to specify the offset of the client’s subnet (in seconds) from Coordinated Universal Time (UTC). Use negative numbers for West of UTC and positive numbers for East of UTC.

option time-servers ip-address [, ip-address ...];

Use this option to list RFC 868 time servers in order of preference.

option trailer-encapsulation flag;

Use this option to indicate if the client negotiates the use of trailers (RFC 893) when using the ARP protocol.ON means do not use trailers.OFF means use trailers.

option vendor-encapsulated-options data-string;

Use this option to specify vendor specific information. See the Vendor Encapsulated Options section.

option www-serverip-address [, ip-address ...];

Use this option to list WWW servers in order of preference.

option x-display-manager ip-address [, ip-address ...];

Use this option to list the systems running X Window System Display Manager in order of preference.

Relay Agent Information Option

A relay agent can add a series of encapsulated options to a DHCP packet when relaying that packet to the DHCP server. The server can make address allocation decisions (or whatever decisions it wants) based on these options. The server returns these options in any replies it sends through the relay agent. The relay agent can use the information in these options for delivery or accounting purposes.

The relay agent option has two suboptions. To reference these options in the DHCP server, specify the option space name "agent", followed by a period, followed by the option name.

Note! It is not useful to specify these options to be sent.

Table 4-3 Agent Option Space Options (Continued)

option agent.circuit-id string;

The circuit-id suboption encodes an agent-local identifier of the circuit from which a DHCP client-to-server packet was received. It is intended for agents who will use it in relaying DHCP responses back to the proper circuit. The format of this option is defined to be vendor-dependent.

option agent.remote-id string;

The remote-id suboption encodes