5.3. IPv4 DHCP Server

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:

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:

IPv4 DHCP Options

The following options can be configured for a DHCP server:

General Parameters

Name

A symbolic name for the server. Used as an interface reference but also used as a reference in log messages.

Interface Filter

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:

https://kb.clavister.com/354854609

Relay Filter

A filter for the relay address. The possible values for this and their meanings are listed earlier in this section.

IP Address Pool

An IP range, group or network that the DHCP server will use as an IP address pool for handing out DHCP leases.

Netmask

The netmask which will be sent to DHCP clients.

Optional Parameters

Default GW

This specifies what IP should be sent to the client for use as the default gateway (the router to which the client connects).

Domain

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".

Lease Time

The time, in seconds, for which a DHCP lease is provided. After this time the DHCP client must renew the lease.

Primary/Secondary DNS

The IP of the primary and secondary DNS servers.

Primary/Secondary NBNS/WINS

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.

Next Server

Specifies the IP address of the next server in the boot process. This is usually a TFTP server.

DHCP Server Advanced Settings

There are two advanced settings which apply to all DHCP servers:

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

  1. Go to: Network > Network Services > DHCP Servers > Add > DHCPServer
  2. Now enter:
    • Name: DHCPServer1
    • Interface Filter: LAN
    • IP Address Pool: DHCPRange1
    • Netmask: 255.255.255.0
  3. Click OK

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

[Tip] Tip: The lease database is saved in non-volatile memory

The DHCP lease database is periodically saved to non-volatile memory so that most leases are remembered by cOS Core after a system restart. A DHCP advanced setting can be adjusted by the administrator to control how often the database is saved.

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.

DHCP Server Objects

Figure 5.1. DHCP Server Objects

The following sections discuss these two DHCP server options.

5.3.1. Static IPv4 DHCP Hosts

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:

Host

This is the IP address that will be handed out to the client.

MAC Address

This is the MAC address of the client. Either the MAC address can be used or the alternative Client Identified parameter can be used.

Client Identified

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

  1. First, change the category to the DHCPServer1 context:
    Device:/> cc DHCPServer DHCPServer1
  2. Add the static DHCP assignment:
    Device:/DHCPServer1> add DHCPServerPoolStaticHost
    			Host=192.168.1.1
    			MACAddress=00-90-12-13-14-15
  3. All static assignments can then be listed and each is listed with an index number:
    Device:/DHCPServer1> show
    
       #  Comments
       -  -------
    +  1  <empty>
  4. An individual static assignment can be shown using its index number:
    Device:/DHCPServer1> show DHCPServerPoolStaticHost 1
    
       Property  Value
    -----------  -----------------
         Index:  1
          Host:  192.168.1.1
    MACAddress:  00-90-12-13-14-15
      Comments:  <empty>
  5. The assignment could be changed later to IP address 192.168.1.12 with the following command:
    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

  1. Go to: Network > DHCP Services > DHCP Servers > DHCPServer1
  2. Select Static Hosts
  3. Select Add > Static Host Entry
  4. Now enter:
    • Host: 192.168.1.1
    • MAC: 00-90-12-13-14-15
  5. Click OK

5.3.2. Custom IPv4 Server Options

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:

Code

This is the code that describes the type of information being sent to the client. A large list of possible codes exists.

Type

This describes the type of data which will be sent. For example, if the type is String then the data is a character string.

Data

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.