DHCP and the Dynamic Domain Name System
The DHCP server provides options that enable operation in a Dynamic Domain Name System (DDNS) environment.
To use DHCP in a DDNS environment, you must set and use a Dynamic Zone on a DNS server.
After the DDNS server is configured, decide if the DHCP server is going to do A-record updates, PTR-record updates, updates for both record types, or none at all. This decision depends on whether a client machine can do part or all of this work.
- If the client can share update responsibility, configure the server to do the PTR-record updates and configure the client to do the A-record updates.
- If the client can do both updates, configure the server to do none.
- If the client cannot do updates, configure the server to do both.
The DHCP server has a set of configuration keywords that allow you to specify a command to run when an update is required. These are:
- updatedns
- (Deprecated.) Represents the command to issue to do any type of update. It is called for both the PTR-record and the A-record update.
- updatednsA
- Specifies the command to update the A-record.
- updatednsP
- Specifies the command to update the PTR-record.
These keywords specify executable strings that the DHCP server
runs when an update is required. The keyword strings must contain
four %s
(percent symbol, letter s). The first %s
is
the host name; the second is the domain name; the third is the IP
address; and the fourth is the lease time. These are used as the first
four parameters for the dhcpaction command. The
remaining two parameters for the dhcpaction command
indicate the record to update (A, PTR, NONE, or BOTH) and whether
NIM should be updated (NIM or NONIM). See DHCP and Network Installation Management suggestions for more information
about NIM and DHCP interaction. For example:
updatednsA "/usr/sbin/dhcpaction '%s' '%s' '%s' '%s' '%s' A NONIM"
# This does the dhcpaction command only on the A record
updatednsP "/usr/sbin/dhcpaction '%s' '%s' '%s' '%s' '%s' PTR NONIM"
# This does the command only on the PTR record
updatedns "/usr/sbin/dhcpaction '%s' '%s' '%s' '%s' '%s' BOTH NIM"
# This does the command on both records and updates NIM
The DHCP server also has a set of keywords to remove the DNS entries when a lease is released or expires. The keywords are:
- releasednsA
- Removes the A-record.
- releasednsP
- Removes the PTR-record.
- removedns
- Removes both record types.
These keywords specify executable strings that the DHCP server runs when an address is released or expired. The dhcpremove command works similarly to dhcpaction, but only takes three parameters:
- The IP address, specified as a
%s
in the command string - Which record to remove (A, PTR, NONE, or BOTH).
- Whether NIM should be updated (NIM or NONIM).
releasednsA "/usr/sbin/dhcpremove '%s' A NONIM"
# This does the dhcpremove command only the A record
releasednsP "/usr/sbin/dhcpremove '%s' PTR NONIM"
# This does the command only on the PTR record
removedns "/usr/sbin/dhcpremove '%s' BOTH NIM"
# This does the command on both records and updates NIM
The dhcpaction and dhcpremove scripts do some parameter checking, then set up a call to nsupdate, which has been updated to work with this operating system's servers and with OS/2 DDNS servers. See the nsupdate command description for more information.
If NIM interaction is NOT required by the name update, the DHCP server can be configured to use a socket transfer between the DHCP daemon and the nsupdate command to improve performance and enable DNS updates to be retried upon failure. To configure this option, the updateDNSA, updateDNSP, releaseDNSA, or the releaseDNSP keyword must specify "nsupdate_daemon" as the first quoted word. The parameters and flags for this update are identical to those that are accepted by the nsupdate command. Additionally, the following variable names can be used for substitution:
Item | Description |
---|---|
$hostname | Replaced by the host name of the client on DNS update or the host name previously associated with the client for DNS removal. |
$domain | Replaced by the DNS domain for the update or the previously used domain of the client host name for a DNS removal. |
$ipadress | Replaced by the IP address to be associated or disassociated from the DHCP client name. |
$leasetime | Replaced by the lease time (in seconds). |
$clientid | Replaced by the string representation of the DHCP client identifier or the combination hardware type and hardware address for BOOTP clients. |
For example:
updateDNSA "nsupdate_daemon -p 9.3.149.2 -h $hostname -d $domain
-s"d;a;*;a;a;$ipaddress;s;$leasetime;3110400""
updateDNSP "nsupdate_daemon -p 9.3.149.2 -r $ipaddress
-s"d;ptr;*;a;ptr;$hostname.$domain.;s;$leasetime;3110400""
releaseDNSA "nsupdate_daemon -p 9.3.149.2 -h $hostname -d $domain -s"d;a;*;s;1;3110400""
releaseDNSP "nsupdate_daemon -p 9.3.149.2 -r $ipaddress -s"d;ptr;*;s;1;3110400""
See the nsupdate command description for more information.
Also, administrator-defined policies have been added for hostname exchanges between the server and the clients. By default, the hostname that is returned to the client and used for a DDNS update is option 12 (defined in the server configuration file). Alternatively, the default hostname can be the client-suggested hostname, either through option 81 (the DHCPDDNS option) or through option 12 (the HOSTNAME option). However, the administrator can override the default hostname by using the hostnamepolicy, proxyarec, and appenddomain configuration keywords. These options and their parameters are defined in DHCP server file syntax for db_file database.