A DHCP Server object assigns and manages IPv4 addresses taken from a specified IPv4 address pool. These DHCP servers are not limited to serving a single range of IP addresses but can use any IP address range that can be specified by an IP address object.
IPv4 and IPv6 DHCP Servers
The DHCPServer object is used for IPv4 addresses and the DHCPv6Server object is used for IPv6 objects. The two are configured in very similar ways although the underlying implementations are very different. The IPv6 server also provides several options which do not exist for IPv4. DHCP relay and IP pools cannot currently be used with IPv6 DHCP. See Section 5.6.3, DHCPv6 Server for more on this topic.Using Multiple DHCP Servers
The administrator has the ability to set up one or more logical DHCP servers in cOS Core. Filtering of DHCP client requests to different DHCP servers is based on a combination of the following DHCP Server properties:Interface
Each cOS Core interface can have, at most, one single logical DHCP server associated with it. In other words, cOS Core can provision DHCP clients using different address ranges depending on what interface they are located on.
Relay Filter
The value of the Relay Filter property is also used to determine which DHCP Server object to use. The default value of all-nets means that all addresses are accepted and only the interface is considered in making a DHCP server selection. The other options for this parameter are described further below.
Searching the DHCP Server List
Multiple DHCP servers form a list as they are defined, with the most recently defined placed at the top of the list. When cOS Core searches for a DHCP server to service a request, it goes through the list from top to bottom and chooses the first server with a matching combination of interface and relayer IP filter value. If there is no match in the list then the request is ignored.The DHCP server ordering in the list can, of course, be changed through one of the user interfaces.
Setting the Relay Filter Property
As explained above, the DHCP Server object used for a client is selected based on a match of both the Interface and Relay Filter properties of the object. A DHCP Server object must have a Relay Filter value specified and the possible values are the following:0.0.0.0/0
The default value is 0.0.0.0/0 (all-nets). This means all DHCP requests will match this filter value regardless if the DHCP requests comes from a client on the local network or has arrived via a DHCP relayer.
A value of 0.0.0.0
The value 0.0.0.0 will match DHCP requests that come from a local client only. DHCP requests that have been relayed by a DHCP relayer will be ignored.
A specific IP address.
This is the IP address of the DHCP relayer through which the DHCP request has come. Requests from local clients or other DHCP relayers will be ignored.
IPv4 DHCP Options
The following options can be configured for a DHCP server:General Parameters
A symbolic name for the server. Used as an interface reference but also used as a reference in log messages.
The source interface on which cOS Core will listen for DHCP requests. This can be a single interface or a group of interfaces.
If an IP Pool that is configured in cOS Core is going to request IP addresses from the server then the interface filter must be set to the value core. The IP pool's IP address for the DHCP server must be set to the localhost address object (the loopback address 127.0.0.1). Detailed setup of an internal DHCP server that provides IPs to an IP pool is described in an article in the Clavister Knowledge Base at the following link:
A filter for the relay address. The possible values for this and their meanings are listed earlier in this section.
An IP range, group or network that the DHCP server will use as an IP address pool for handing out DHCP leases.
The netmask which will be sent to DHCP clients.
Optional Parameters
This specifies what IP should be sent to the client for use as the default gateway (the router to which the client connects).
The domain within which users are situated. When a user types a simple string into a browser instead of a valid URL, the domain property value can be appended by the browser to form a URL. For example, if the Domain value is "example.com", when the user types just the word "wiki", the browser can try the URL "wiki.example.com".
The time, in seconds, for which a DHCP lease is provided. After this time the DHCP client must renew the lease.
The IP of the primary and secondary DNS servers.
IP of the Windows Internet Name Service (WINS) servers that are used in Microsoft environments which uses the NetBIOS Name Servers (NBNS) to assign IP addresses to NetBIOS names.
Specifies the IP address of the next server in the boot process. This is usually a TFTP server.
Auto Save Policy
The policy for saving the lease database to disk. The options are:
Lease Store Interval
The number of seconds between auto saving the lease database to disk. The default value is 86400 seconds.
Example 5.2. Setting up an IPv4 DHCP server
This example shows how to set up a DHCP server called DHCPServer1 which assigns and manages IP addresses from an IPv4 address pool called DHCPRange1.
This example assumes that an IP range for the DHCP Server has already been created.
Command-Line Interface
Device:/>
add DHCPServer DHCPServer1
Interface=LAN
IPAddressPool=DHCPRange1
Netmask=255.255.255.0
InControl
Follow similar steps to those used for the Web Interface below.
Web Interface
Displaying IP to MAC Address Mapping
To display the mappings of IP addresses to MAC addresses that result from allocated DHCP leases, the dhcpserver command can be used. Below is some typical output:
Device:/>
dhcpserver -show -mappings
DHCP server mappings:
Client IP Client MAC Mode
--------------- ------------------- -------------
10.4.13.240 <00-1e-0b-a0-c6-5f> ACTIVE(STATIC)
10.4.13.241 <00-0c-29-04-f8-3c> ACTIVE(STATIC)
10.4.13.242 <00-1e-0b-aa-ae-11> ACTIVE(STATIC)
10.4.13.243 <00-1c-c4-36-6c-c4> INACTIVE(STATIC)
10.4.13.244 <00-00-00-00-02-14> INACTIVE(STATIC)
10.4.13.254 <00-00-00-00-02-54> INACTIVE(STATIC)
10.4.13.1 <00-12-79-3b-dd-45> ACTIVE
10.4.13.2 <00-12-79-c4-06-e7> ACTIVE
10.4.13.3 [00-a0-f8-23-45-a3] ACTIVE
10.4.13.4 [00-0e-7f-4b-e2-29] ACTIVE
When the MAC address is shown surrounded by square brackets ([.....]) it means that the DHCP server does not track the client using the MAC address but instead tracks the client through a client identifier which the client has given to the server. Angled brackets (<.....>) surrounding the MAC address indicates that tracking is done using the address.
To display all DHCP information use the dhcpserver command with no options. Each individually configured DHCP server is referred to as a Rule which is given a unique number. This number is used to identify which lease belongs to which server in the CLI output. To see just the configured DHCP servers, use the command:
Device:/>
dhcpserver -show -rules
Viewing Detailed DHCP Client Information
All DHCP clients that are allocated an IPv4 lease by cOS Core will have an entry created in the neighbor cache.. If enabled, the device intelligence feature can "fingerprint" these clients and provide detailed client information when the neighbor cache is viewed. This is described further in Section 3.5.6, Device Intelligence.The DHCP Server Blacklist
Sometimes, an IP address offered in a lease is rejected by the client. This may be because the client detects that the IP address is already in use by issuing an ARP request. When this happens, the cOS Core DHCP server adds the IP address to its own blacklist.The CLI can be used to clear the DHCP server blacklist with the command:
Device:/>
dhcpserver -release=blacklist
Additional Server Settings
A DHCP server in cOS Core can have two other sets of objects associated with it:The illustration below shows the relationship between these objects.
The following sections discuss these two DHCP server options.
Where the administrator requires a fixed relationship between a client and the assigned IP address, cOS Core allows the assignment of a given IP to a specific MAC address. In other words, the creation of a static host.
Static Host Parameters
Many such assignments can be created for a single DHCP server and each object has the following parameters:This is the IP address that will be handed out to the client.
This is the MAC address of the client. Either the MAC address can be used or the alternative Client Identified parameter can be used.
If the MAC address is not used for identifying the client then the client can send an identifier in its DHCP request. The value of this identifier can be specified as this parameter. The option exists to also specify if the identifier will be sent as an ASCII or Hexadecimal value.
Example 5.3. Static IPv4 DHCP Host Assignment
This example shows how to assign the IPv4 address 192.168.1.1 to the MAC address 00-90-12-13-14-15. The example assumes that the DHCP server DHCPServer1 has already been defined.
Command-Line Interface
Device:/>
cc DHCPServer DHCPServer1
Device:/DHCPServer1>
add DHCPServerPoolStaticHost
Host=192.168.1.1
MACAddress=00-90-12-13-14-15
Device:/DHCPServer1>
show
# Comments
- -------
+ 1 <empty>
Device:/DHCPServer1>
show DHCPServerPoolStaticHost 1
Property Value
----------- -----------------
Index: 1
Host: 192.168.1.1
MACAddress: 00-90-12-13-14-15
Comments: <empty>
Device:/DHCPServer1>
set DHCPServerPoolStaticHost 1
Host=192.168.1.12
MACAddress=00-90-12-13-14-15
InControl
Follow similar steps to those used for the Web Interface below.
Web Interface
Adding a Custom Option to the DHCP server definition allows the administrator to send specific pieces of information to DHCP clients in the DHCP leases that are sent out.
An example of this is certain switches that require the IP address of a TFTP server from which they can get certain extra information.
Custom Option Parameters
The following parameters can be set for a custom option:This is the code that describes the type of information being sent to the client. A large list of possible codes exists.
This describes the type of data which will be sent. For example, if the type is String then the data is a character string.
This is the actual information that will be sent in the lease. This can be one value or a comma separated list.
The meaning of the data is determined by the Code and Type. For example, if the code is set to 66 (TFTP server name) then the Type could be String and the Data would then be a site name such as tftp.example.com.
There is a large number of custom options which can be associated with a single DHCP server and these are described in:
RFC-2132 - DHCP Options and BOOTP Vendor Extensions
The code is entered according to the value specified in RFC-2132. The data associated with the code is first specified in cOS Core as a Type followed by the Data.