ISC DHCP - User-Defined Options

The ISC DHCP server provides the flexibility to define your own options. Many VOIP devices utilize specific options for device configuration for example. This functionality also enables definition of new options without having to wait for a new ISC DHCP release. Options are declared within the configuration file using the option keyword specifying the user-defined option name code data type and any data type restrictions according to this syntax:

option option-name code option-code = option-type;

The option-name must be unique from server defined options and consist of alphanumeric characters and '-'. The option-code is typically between 128 and 254. Supported option-types include boolean integer string text and IPv4 or IPv6 address and domain list as well as arrays records and encapsulation.

Boolean Type Options

The declaration format is shown below along with an example definition of a boolean option named my-option with code 209.

Declaration: option my-option code 209 = boolean;

Once declared this option setting can be defined within the appropriate scope as:

Setting: option my-option true;

Integer Type Options

Options of data type integer include specification of signed or unsigned (or blank) and integer length of either 8 16 or 32 bits.

Declaration: option bits-per-sec code 210 = unsigned integer 32;

Setting: option bits-per-sec 1544000;

String Type Options

A string type option consists of a hexadecimal-encoded colon-separated octet string.

Declaration: option mac-manufacturer code 211 = string;

Setting: option mac-manufacturer a4:80:1f;

Text Type Options

Text type options specify values encoded as ASCII text strings.

Declaration: option your-help-contact code 212 = text;

Setting: option your-help-contact 'John Smith';

IPv4 Address Type Options

The IP-address data type enables specification of an IPv4 address or resolvable domain name.

Declaration: option our-file-server code 213 = ip-address;

Setting: option our-file-server 10.0.209.12;

option our-file-server fileserv1.ipamww.com;

IPv6 Address Type Options

The IP6-address data type enables specification of an IPv6 address

Declaration: option our-video-server code 214 = ip6-address;

Setting: option our-video-server fc01:273e:90a:2::b1 ;

Domain List Type Options

The domain-list data type enables specification of an IPv4 address or resolvable domain name.

Declaration: option our-server-domain code 215 = domain-list;

Setting: option our-server-domain fileserv1.ipamww.com. ;

Array Type Options

Array options provide a way to specify multiple values for boolean integer or IP address data type values (all of the same type) by simply inserting 'array of' before the data type. Array elements are defined when setting the option values using comma-separated values.

Declaration: option my-ip-array code 198 = array of ip-address;

Setting: option my-ip-array 10.0.100.1 10.100.0.1;

Record Type Options

While array options provide specification of multiple elements of the same type record types options enable specification of multiple elements of different types. Each element of the record is specified in order within curly brackets. Thus the following example defines an option of data type record including an integer (16 bit) text boolean and IP address. Note that unlike arrays record element values are space separated not comma separated.

Declaration: option my-rec code 198 = { integer 16 text boolean ip-address };

Setting: option my-rec 4096 'cio' true 10.10.99.12;

Encapsulated Type Options (Option Spaces)

An option space consists of a grouping of options typically with a common purpose. This grouping of options can be 'encapsulated' within a single user-defined option code. This is similar to the construct of the Client FQDN and Relay Agent Information options described earlier where the option space 'fqdn' defined the Client FQDN option space and 'agent' defined the Relay Agent Information option space. With the fqdn and agent options the option space was specified along with the option name separated by a dot. For example agent.remote-id defined the remote-id option within the agent option space. Similarly you may define encapsulated options within a user-defined option space. Consider the example of creating a db option space to specify some database connection suboptions.

Declaration: option space db;

option db.db-server code 1 = ip-address;

option db.loginid code 2 = text;

option db.db-name code 3 = text;

option database-encapsulated code 221 = encapsulate db;

Before illustrating statements to set values let'™s review the above declaration. The first line option space db; defines the db option space[1]. Next three suboptions are defined within this space. Each suboption has a unique code which is typically numbered from 1 since these are suboption code values. These suboptions are encapsulated within the parent option of code 221 named database-encapsulated. The setting statements below would set values to suboptions 1 2 and 3 encapsulated within option 221.

Setting: option db.db-server 10.199.200.37;

option db.loginid 'database';

option db.db-name 'mydatabase';

This enumeration of option space and constituent options can be contrasted to the brute force method of specifying unencapsulated options in the form of a hex string. In this format an unencapsulated option string can be defined using vendor encapsulated options such as:

option vendor-encapsulated-options a4:5:f:ff:e4:bc:8a:63:9d:e:d7:ca:a2;



[1] The full syntax of the option space declaration is:

option space name [code width bytes] [length width bytes] [hash size buckets]

where the optional parameters define the bytes per option code per option length and size of hash table to hold this space's options.