22-20
Cisco CNS Network Registrar User’s Guide
OL-6240-02
Chapter 22 Advanced DHCP Server Properties
Setting DHCP Forwarding
As the DHCP server processes these scripts, it checks the environment dictionary for this string:
cnr-forward-dhcp-request
3. When it finds that string and it has the value true (enabled), the server calls its forwarding code.
4. The forwarding code checks the environment dictionary for a string with this key:
cnr-request-forward-address-list
It expects a list of comma-separated IP addresses with an optional colon-delimited port number, as
in this example:
192.168.168.15:1025,192.168.169.20:1027
By default, the server forwards to port 67. It sends a copy of the entire client request to each IP
address and port in turn. If any element in the list is invalid, the server stops trying to parse the list.
5. After the forwarding code returns, the server stops processing the request. In the post-client-lookup
extension point script, however, this action might create an optional log message with client-entry
details.
The following example of a portion of a TCL extension script tells the DHCP server to forward a request
to another server based on the information in the request. You can use such a script if there are multiple
device provisioning systems in the same environment. In this case, you would run the extension script
on the DHCP server to which routers forward broadcast requests. The script would determine which (if
any) other server or servers should handle the request, and tell the original server to forward the request.
The sample script uses a static mapping of MAC address prefix to send modems from a specific vendor
to a specific system:
proc postPktDecode {req resp env} {
set mac [$req get chaddr]
set addrs ""
;# Very simple, static classifier that forwards all requests from devices
;# with a vendor-id of 01:0c:10 to the DHCP servers at 10.1.2.3 and 10.2.2.3:
switch -glob -- $mac {
01:0c:10* {
set addrs "10.1.2.3,10.2.2.3"
}
}
;# If we decide to forward the packet, the $addrs var will have the IP addresses
;# where to forward the packet:
if {$addrs != ""} {
;# Tell the DHCP server to forward the packet...
$env put cnr-forward-dhcp-request true
;# ...and where to forward it:
$env put cnr-request-forward-address-list $addrs
;# No more processing is required.
return
}
}
A more flexible script could use a per-client configuration object, such as the Network Registrar client
entry, to indicate which DHCP server should get the request.