CDRouter has the capability to simulate both a DHCP server and multiple DHCP clients simultaneously on different physical interfaces within the Linux host PC. On one interface CDRouter may act as a DHCP server, terminating the WAN connection of the device under test (DUT). CDRouter’s DHCP server is used to test the DUT’s DHCP client functionality. On a second physical interface, CDRouter will act as a DHCP client (or multiple DHCP clients) terminating one or more LAN connections on the DUT. CDRouter’s DHCP client(s) are used to test the DUT’s DHCP server functionality.
As a result, there are up to four distinct DHCP implementations in a test setup where DHCP is utilized on both the WAN and LAN sides of the DUT:
Many of the DHCP options defined in RFC 2132 are not included in the default CDRouter configuration file. As a result, the dhcp-c.tcl (client/WAN side) and dhcp-s.tcl (server/LAN side) DHCP test modules include validation of a limited number of DHCP options (only those that are included by default). CDRouter’s DHCP server and client(s) however, may be configured to explicitly request or provide any of the DHCP options defined in IETF RFC 2132.
In a typical test setup, CDRouter’s DHCP server communicates directly with the DHCP client on the WAN interface of the DUT. Three testvars control the behavior of CDRouter’s DHCP server (enabled when the testvar wanMode is set to ‘DHCP’):
dhcpLeaseTime: defines the duration of the lease provided by CDRouter’s DHCP server to the DUT’s DHCP client
dhcpServerBroadcast: defines whether or not responses to DHCP broadcast packets are sent to the broadcast address 255.255.255.255; when set to ‘no’, responses are sent to the unicast address being assigned (note that this behavior will be overridden if the if the ‘flags’ field of the preceding DHCP message has been set to BROADCAST by the client)
dhcpConnectOnDemand: specifies the behavior of the DUT’s DHCP client; if set to ‘yes’ the DUT’s DHCP client is configured to connect when traffic is forwarded to one of its LAN interfaces; if set to ‘no’ the DUT’s DHCP client is configured to connect after reboot
There are also a number of additional testvars that define the IP address-related information assigned by CDRouter’s DHCP server to the DUT’s DHCP client. Specifically:
wanIspAssignIp: defines the IP address assigned by CDRouter to the DUT
wanIspMask: defines the subnet mask assigned by CDRouter to the DUT
wanDomainName: defines the domain name assigned by CDRouter to the DUT
wanDnsServer: defines the primary DNS server assigned by CDRouter to the DUT
wanBackupDnsServer: defines the secondary or backup DNS assigned by CDRouter to the DUT
CDRouter’s DHCP server can also be configured to provide additional DHCP options to the DUT’s DHCP client. These options are configured using the testvars dhcpServerOptionCodedhcpServerOptionData
Example:
The code below configures CDRouter’s DHCP server to provide DHCP options 69 and 70 to the DUT’s DHCP client.
# testvar dhcpServerOptionCode1 69 # testvar dhcpServerOptionData1 04040404 # testvar dhcpServerOptionCode2 70 # testvar dhcpServerOptionData2 0404040504040406
CDRouter will typically create multiple DHCP clients which communicate directly with the DUT’s DHCP server via one or more LAN interface(s). The following testvars define the configuration of the DUT’s DHCP server or control the behavior of CDRouter’s DHCP client(s):
dhcpClientTimeout: defines the timeout period (in seconds) of CDRouter’s DHCP client(s)
dhcpInform: defines whether or not the DUT’s DHCP server supports the DHCPINFORM message
dhcpClientStart: the first address in the DHCP address pool configured on the DUT’s DHCP server
dhcpClientEnd: the last address in the DHCP address pool configured on the DUT’s DHCP server; the number of addresses in the DHCP pool determines the number of DHCP clients created by CDRouter for certain tests
dhcpClientExclude: defines addresses that should be excluded from the DUT’s DHCP server address pool (the address pool is defined by the dhcpClientStart and dhcpClientEnd testvars)
dhcpCreateDelay: defines the delay between creation of each CDRouter DHCP client; typically this value is zero, but can be increased to simulate different scenarios
dhcpReleaseDelay: similar to the testvar dhcpCreateDelay; defines the delay between the release of each CDRouter DHCP client
useInternalDHCP: this testvar allows CDRouter to act as the DHCP server on the LAN side; this testvar should only be enabled if the DUT does not support DHCP on the LAN side (i.e. the DUT does not have a DHCP server on the LAN side)
internalDHCPdns: if the testvar useInternalDHCP is enabled, CDRouter will by default assign the LAN side address of the DUT as the DNS address for all clients created on the LAN side; the testvar internalDHCPdns can be used to define an alternative DNS server in these circumstances (the DNS server specified by internalDHCPdns should match the wanDnsServer testvar)
winsServer1: if the DUT is configured to provide a primary WINS server to DHCP clients on the LAN side, this testvar should be configured to match the primary specified WINS server configured on the DUT
winsServer2: if the DUT is configured to provide a secondary/backup WINS server to DHCP clients on the LAN side, this testvar should be configured to match the secondary/backup specified WINS server configured on the DUT
dhcpClientVendorClass: defines the Vendor Class Identifier provided by the DUT’s DHCP server to all DHCP clients
DNStoDHCP: specifies the behavior of the DUT’s DHCP server; if set to ‘yes’ the DUT’s DHCP server forwards the DNS information learned on its WAN interface directly to the DHCP clients on its LAN interface(s); if set to ‘no’ the DUT provides its LAN address as the DNS address for all DHCP clients on its LAN interface(s); if set to ‘no’ all DNS traffic from the LAN side is fowarded to the DNS server on the WAN side
When a DHCP client is created by CDRouter, the initial DHCPDISCOVER message includes only options 53 (DHCP Message Type), 12 (Host Name), 61 (Client Identifier), and 55 (Parameter Request List). Option 60 (Vendor Class Identifier) may be included if the testvar dhcpClientVendorClass is enabled.
The default Parameter Request List transmitted by CDRouter’s DHCP clients in the initial DHCPDISCOVER message includes only options 1 (Subnet Mask), 2 (Router), 6 (Domain Name Server), and 15 (Domain Name). DHCP options 44 (NetBIOS over TCP/IP Name Server), 45 (NetBIOS over TCP/IP Node Type), and 47 (NetBIOS over TCP/IP Scope) may also be enabled and requested in the initial Parameter Request List if the winsServer1/winsServer2 testvars are enabled. CDRouter’s dhcp-s.tcl modules validates that all of the above requested values are received.
CDRouter also has the ability to include additional DHCP options, as shown in the next section. Note that additional options not explicitly included in the default configuration will not be validated by CDRouter.
CDRouter’s DHCP clients can be configured to both provide and request additional DHCP options when communicating with the DUT’s DHCP server. Additional DHCP options may be provided directly or requested from the server using DHCP option 55 (Parameter Request List).
Providing additional DHCP options
CDRouter’s DHCP clients can be configured to provide additional DHCP options when communicating with the DUT’s DHCP server. These options are configured using the testvars dhcpClientOptionCodedhcpClientOptionData
Example:
The code below configures CDRouter’s DHCP clients to provide DHCP options 124 and 125.
# testvar dhcpClientOptionCode1 124 # testvar dhcpClientOptionData1 000000000401020304 # testvar dhcpClientOptionCode2 125 # testvar dhcpClientOptionData2 000000000401020304
Requesting additional DHCP options in the parameter request list
The testvar dhcpExtraClientParams can be used to request additional DHCP options from the DUT’s DHCP server. These options are communicated to the DUT as additional fields in DHCP option 55 (Parameter Request List).
Example:
The code below configures CDRouter’s DHCP clients to request DHCP options 69 and 70 in the Parameter Request List (option 55).
# testvar dhcpExtraClientParams "69 70"