Training

DHCP Server Testing with CDRouter

8 min read

CDRouter’s pre-defined test modules make it easy to quickly test and evaluate a CPE implementation’s integrated DHCP server. In addition, CDRouter’s flexible configuration options allow a wide variety of DHCP server scenarios to be simulated and tested in a consistent and repeatable fashion.

The base version of CDRouter includes two test modules designed specifically for verifying a CPE’s DHCP server functionality. The first module, dhcp-s.tcl, includes targeted functional test cases while the second module, scaling.tcl, includes scaling test cases for verifying a DHCP server’s ability to manage an arbitrary maximum number of simultaneous DHCP clients and connections. In addition, the test case cdrouter_basic_10 in the basic.tcl test module verifies that the gateway and DNS information provided by the DHCP server is accurate, based on the values provided by the ISP on the WAN.

The test case summaries for both modules and the cdrouter_basic_10 test case can be found here.

Both the dhcp-s.tcl and scaling.tcl test modules require the creation of one or more additional DHCP clients on the LAN. As a result, these test modules can only be run with CDRouter configurations that include at least one Ethernet LAN interface.

Basic DHCP Server Testing

The most basic test setup is one in which the DUT’s DHCP server is configured to provide addresses from a single contiguous pool. The testvars lanIp, dhcpClientStart, and dhcpClientEnd are used to define the configuration of the DUT’s DHCP server within CDRouter. By default, CDRouter uses the following values for these testvars:

testvar lanIp                 192.168.1.1
testvar dhcpClientStart       192.168.1.2
testvar dhcpClientEnd         192.168.1.7

NOTE: The DUT’s LAN IP and DHCP server pool range must reside on the same subnet. Furthermore, the DUT’s LAN IP should not be within the DHCP pool range.

These settings imply that the DUT’s LAN IP address is 192.168.1.1, and that the DUT’s DHCP server is configured to provide IP addresses via DHCP from the pool range 192.168.1.2 through 192.168.1.7. In addition to these basic configuration parameters, there are three additional attributes that must be defined before CDRouter can fully characterize the DUT’s DHCP sever:

  1. Does the DHCP server support DHCPINFORM messages?
  2. What WINS servers (if any) will the DHCP server provide?
  3. What DNS server(s) will the DHCP server provide?

If the DHCP server supports DHCPINFORM messages, the testvar dhcpInform should be enabled, and disabled otherwise.

testvar dhcpInform            yes

If the DHCP server is configured to provide specific WINS information, the testvars winsServer1 and winsServer2 should be configured with the appropriate WINS server IP addresses. The dhcp-s.tcl test module CDRouter will verify that these WINS servers were provided by the DHCP server.

testvar winsServer1           3.3.3.4
testvar winsServer2           3.3.3.5

CDRouter must also be configured with the gateway and DNS information that the DHCP server is expected to provide. If the DUT is configured to relay the DNS servers learned on the WAN interface directly to its DHCP clients, the testvar DNStoDHCP should be set to yes. Alternatively, if the DUT is configured to provide its LAN IP address as the primary DNS server to all DHCP clients, the testvar DNStoDHCP should be set to no.

testvar DNStoDHCP             yes

Based on these settings, CDRouter will automatically determine the correct pass or fail metrics for each functional test case. Likewise, during the scaling.tcl test module, CDRouter will attempt to exhaust the DHCP pool by determining the maximum number of DHCP addresses that are available and creating that number of DHCP clients on the LAN.

In this basic test setup, the maximum number of available IP addresses is simply the pool size minus the number of configured LAN interfaces. For CDRouter users, this simply becomes the pool size minus one, since a maximum of one LAN interface can be defined.

NOTE: When running the scaling.tcl test module, the speed with which CDRouter creates and deletes DHCP clients can be decreased using the testvars dhcpCreateDelay and dhcpReleaseDelay. By default no pacing is applied. However, some DHCP server implementations are relatively slow and unable to process the volume of DHCP transactions initiated by CDRouter using the default settings. These implementations ofter require some amount of pacing in order to run scaling.tcl test module. Note that the dhcpCreateDelay and dhcpReleaseDelay testvars are specified in milliseconds.

testvar dhcpCreateDelay       100
testvar dhcpReleaseDelay      300

Address Reservations and Pool Exclusions

CDRouter also supports more advanced configurations in which the DHCP server has address exclusions and reservations defined. An exclusion is simply an address that is excluded from the DHCP pool for any reason. Addresses may be excluded as part of a static IP addressing scheme for specific clients. CDRouter can be configured with a space-separated list of excluded IP addresses using the testvar dhcpClientExclude:

testvar dhcpClientExclude "192.168.1.4 192.168.1.5"

Likewise, CDRouter has the ability to explicitly test up to 10 DHCP reservations using the cdrouter_dhcp_server_3 test case. A reservation is a DHCP address to MAC address mapping. Reservations ensure that specific clients receive the same IP address each time they communicate with the DHCP server. Up to 10 DHCP reservations per pool can be defined within CDRouter using the testvars dhcpClientReservedIpN and dhcpClientReservedMacN, where N represents an instance number between 1 and 10.

testvar dhcpClientReservedIp1 192.168.1.6
testvar dhcpClientReservedMac1 00:11:22:33:33:44

testvar dhcpClientReservedIp2 192.168.1.7
testvar dhcpClientReservedMac2 00:11:22:33:33:55

NOTE: All excluded and reserved addresses must be within the configured DHCP pool range.

If exclusions or reservations are defined, CDRouter will automatically recalculate the number of available addresses in the DHCP pool when running the scaling.tcl test module. Furthermore, CDRouter will ensure that all DHCP clients that are created have unique MAC addresses that do not conflict with any defined reservations, and that all clients obtain addresses from within the expected pool of available IPs.

Calculating the Number of Available Addresses

If exclusions or reservations are defined, the number of available IP addresses within the configured DHCP pool will be automatically recalculated by CDRouter. CDRouter uses this information to determine the maximum number of clients to create during the scaling.tcl test module. The number of available clients is calculated as follows:

Number of available addresses = pool size - number of exclusions - number of reservations - number of LAN interfaces in pool + number of LAN interfaces in pool with reservations

Here’s a simple calculation of the number of available addresses using some example values:

testvar dhcpClientStart         192.168.1.20
testvar dhcpClientEnd           192.168.1.30
testvar dhcpClientExclude       "192.168.1.24 192.168.1.25"
testvar dhcpClientReservedIp1   192.168.1.26
testvar dhcpClientReservedMac1  00:11:22:33:33:44
testvar dhcpClientReservedIp2   192.168.1.27
testvar dhcpClientReservedMac2  00:11:22:33:33:55

Assuming there is only a single LAN interface configured which is on the list of reserved IPs above, the number of available addresses in the pool is: 11 - 2 - 2 - 1 + 1 = 7. The following table illustrates the DHCP pool for the above example in more detail:

IP Address Availability
192.168.1.20 Available
192.168.1.21 Available
192.168.1.22 Available
192.168.1.23 Available
192.168.1.24 Unavailable - excluded
192.168.1.25 Unavailable - excluded
192.168.1.26 Unavailable - reserved for LAN1
192.168.1.27 Unavailable - reserved for 00:11:22:33:33:55
192.168.1.28 Available
192.168.1.29 Available
192.168.1.30 Available

Limiting the Maximum Number of DHCP Clients

Though CDRouter will automatically calculate the number of DHCP clients to create during the scaling.tcl test module, it is possible to limit the maximum number of clients it will create with the ipv4MaxLanClients testvar. This testvar will cap the total number of clients despite what the actual DHCP pool size is. This is useful for situations where it is known that the DUT can only support so many DHCP LAN clients (such as during Wifi scalability testing). This configuration would appear as:

testvar dhcpClientStart                  192.168.1.25
testvar dhcpClientEnd                    192.168.1.224  
testvar ipv4MaxLanClients             50

This would create a DHCP pool of 200, but limit the maximum number of clients to 50.

Testing Multiple DHCP Pools with CDRouter Multiport

Although most CPE do not support multiple DHCP pools, these configurations can be tested using the CDRouter Multiport add-on. CDRouter Multiport allows independent DHCP pools to be defined for each LAN interface. Each DHCP pool can also have an independent list of exclusions and reservations:

testvar_group lan2 {

   testvar lanInterface            eth3
   testvar lanMac                  00:00:cc:cc:01:02
   testvar lanType                 ethernet

   # -- define second DHCP pool
   testvar lanIp                   10.10.1.1
   testvar lanMask                 255.255.255.0
   testvar dhcpClientStart         10.10.1.10
   testvar dhcpClientEnd           10.10.1.19
   testvar dhcpClientExclude       "10.10.1.15"
   testvar dhcpClientReservedIp1   10.10.1.17
   testvar dhcpClientReservedMac1  00:22:22:22:33:33
}

As with any multiport configuration, CDRouter will automatically cycle between the configured LAN and WAN interfaces when running tests. When multiple DHCP pools are configured, CDRouter will adjust each test based on the LAN interface and DHCP pool being tested. To run the same group of DHCP server tests using two different LAN interfaces and DHCP pools, each test should be repeated twice. This will ensure that each test is run once using the first LAN interface and DHCP pool and once against the second LAN interface and DHCP pool.

IPv6

DHCPv6 server implementations can be tested using the CDRouter IPv6 add-on for CDRouter. Many of the same options available for testing IPv4 DHCP servers are also available for DHCPv6. A typical DHCPv6 configuration within CDRouter might look like this:

testvar ipv6MaxLanClients     10
testvar ipv6LanMode           dhcp
testvar ipv6DhcpClientStart   ::2
testvar ipv6DhcpClientEnd     ::1F
testvar ipv6DhcpClientExclude "::3 ::A"

NOTE: The DHCPv6 pool prefix will be automatically determined by CDRouter based on the IPv6 WAN mode used by the DUT.

The CDRouter IPv6 add-on includes the scaling-v6.tcl test module which includes dedicated IPv6 scaling tests. Due to the potentially large size of DHCPv6 address pools, the maximum number of LAN DHCPv6 clients created by CDRouter can be moderated using the testvar ipv6MaxLanClients.

Testing Exercises

CDRouter makes it possible to quickly and easily test a DHCP server implementation under a variety of different conditions. Some common testing exercises include varying the pool size, increasing the number connections creating during the scaling.tcl test module, adjusting timeouts, and generally modifying or customizing the behavior of CDRouter’s DHCP clients.

Some of the DHCP client configuration options available in CDRouter that impact DHCP server testing include:

  • Modifying DHCP client timeout
  • Adding DHCP Vendor Class Identifier
  • Enabling support for DHCPINFORM messages
  • Requesting specific DHCP Options in the parameter request list
  • Providing specific DHCP options to the DHCP server
  • Forcing DHCP clients to request WINS servers
  • Modifying DNS proxy configuration
  • Pacing DHCP client creation and deletion

Get articles like this in your inbox: