How do I configure additional DHCP options in CDRouter?
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.
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.
Overview of CDRouter’s built-in DHCP server functionality
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 clientdhcpServerBroadcast
: defines whether or not responses to DHCP broadcast packets are sent to the broadcast address255.255.255.255
; when set tono
, responses are sent to the unicast address being assigned (note that this behavior will be overridden if the if theflags
field of the preceding DHCP message has been set toBROADCAST
by the client)dhcpConnectOnDemand
: specifies the behavior of the DUT’s DHCP client; if set toyes
the DUT’s DHCP client is configured to connect when traffic is forwarded to one of its LAN interfaces; if set tono
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 DUTwanIspMask
: defines the subnet mask assigned by CDRouter to the DUTwanDomainName
: defines the domain name assigned by CDRouter to the DUTwanDnsServer
: defines the primary DNS server assigned by CDRouter to the DUTwanBackupDnsServer
: defines the secondary or backup DNS assigned by CDRouter to the DUT
Configuring CDRouter’s DHCP server for additional DHCP options
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 dhcpServerOptionCode
and dhcpServerOptionData
.
Up to 255 pairs may be
specified. The option data must be specified in raw hex format, and
should not include the option length, which will be calculated and
included automatically by CDRouter.
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
Overview of CDRouter’s built-in DHCP client functionality
CDRouter will typically create multiple DHCP clients which communicate
directly with the DUT’s DHCP server via one or more LAN
interface(s). This is the default behavior for CDRouter on its LAN
interface(s) or when lanMode
is explicitly set to ‘DHCP’.
The testvar lanMode was introduced in CDRouter 9.2. For more information on disabling DHCP on the LAN. Please see this Knowledge Base article.
When DHCP is enabled, 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 messagedhcpClientStart
: the first address in the DHCP address pool configured on the DUT’s DHCP serverdhcpClientEnd
: 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 testsdhcpClientExclude
: 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 scenariosdhcpReleaseDelay
: similar to the testvar dhcpCreateDelay; defines the delay between the release of each CDRouter DHCP clientwinsServer1
: 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 DUTwinsServer2
: 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 DUTdhcpClientVendorClass
: defines the Vendor Class Identifier used by all DHCP clientsDNStoDHCP
: 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 tono
the DUT provides its LAN address as the DNS address for all DHCP clients on its LAN interface(s); if set tono
all DNS traffic from the LAN side is forwarded 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.
Configuring CDRouter’s DHCP client(s) for additional DHCP options
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 dhcpClientOptionCode
and dhcpClientOptionData
. Up to 10 pairs may be
specified. The option data must be specified in raw hex format, and
should not include the option length, which will be calculated and
included automatically by CDRouter.
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"