22-9
Cisco CNS Network Registrar User’s Guide
OL-6240-02
Chapter 22 Advanced DHCP Server Properties
Using Extensions to Affect DHCP Server Behavior
You can solve the problem of the two IP addresses by writing either of these extensions:
• One that causes the DHCP server to drop the Token Ring (6) hardware type packet.
• One that changes the Token Ring packet to an Internet packet and then switches it back again on
exit. Although this extension would be more complex, the DHCP client could thereby use either
return from the DHCP server.
You can write extensions in TCL or C/C++:
• TCL—Makes it a bit easier and quicker to write an extension. If the extension is short, the
interpreted nature of TCL does not have a serious effect on performance. When you write an
extension in TCL, you are less likely to introduce a bug that can crash the server.
• C/C++—Provides the maximum possible performance and flexibility, including communicating
with external processes. However, the complexity of the C/C++ API is greater and the possibility of
a bug in the extension crashing the server is more likely than with TCL.
You create extensions at specific extension points. Extension points include three types of
dictionaries—request, response, and environment. One or more of these dictionaries are available for
each of the following extension points:
1. init-entry—Extension point that the DHCP server calls when it configures or unconfigures the
extension. This occurs when starting, stopping, or reloading the server. This entry point has the same
signature as the others for the extension. Dictionaries: environment only.
2. post-packet-decode—Rewrites the input packet. Dictionaries: request and environment.
3. post-class-lookup—Evaluates the result of a client-class-lookup-id operation on the client-class.
Dictionaries: request and environment.
4. pre-client-lookup—Affects the client being looked up, possibly by preventing the lookup or
supplying data that overrides the existing data. Dictionaries: request and environment.
5. post-client-lookup—Reviews the operation of the client-class lookup process, such as examining
the internal server data structures filled in from the client-class processing. You can also use it to
change any data before the DHCP server does additional processing. Dictionaries: request and
environment.
6. check-lease-acceptable—Changes the results of the lease acceptability test. Do this only with
extreme care. Dictionaries: request, response, and environment.
7. lease-state-change—Determines when the lease state changes this only with extreme care.
Dictionaries: response and environment.
8. pre-packet-encode—Changes the data sent back to the DHCP client in the response, or change the
address to which to send the DHCP response. Dictionaries: request, response, and environment.
9. pre-dns-add-forward—Alters the name used for the DNS forward (A record) request. Dictionaries:
environment only.
10. post-send-packet—Used after sending a packet for processing that you want to perform outside of
the serious time constraints of the DHCP request-response cycle. Dictionaries: request, response,
and environment.
To extend the DHCP server, do the following:
Step 1 Write the extension in Tcl, C or C++ and install it in the server extensions directory, on:
• UNIX:
–
Tcl—/opt/nwreg2/extensions/DHCP/tcl
–
C or C++—/opt/nwreg2/extensions/DHCP/dex