ISC DHCP version 3 and later support dynamic dns updates for DHCP leases.
I set this up with a seperate forward zone for the dynamic entries. This was mainly to prevent serial and zone file pollution, but also because the dynamic updates create journal files which make editing the static entries hard.
First of all, you need dhcp 3 and above. This is the default dhcp package in recent RedHat, in Debian Woody you want the dhcp3-server package.
$rndc-confgen -r /dev/urandom
key "rndc-key" {
algorithm hmac-md5; secret "bC9Up7x9abx5mnOKujzgEg==";
}; ...
Take the contents of the above snippet, and add an entry into your named.conf for it.
key "DHCP-UPDATER" {
algorithm hmac-md5; secret "bC9Up7x9abx5mnOKujzgEg==";
};
Note: it is very important that you copy the key verbatim! For the zones you wish to enable DDNS updates on, add the following to the zone definition in named.conf
allow-update { key DHCP_UPDATER; };
zone "dyn.mydomain.something" {
type master; file "/etc/bind/zone/db.dyn.mydomain.something"; allow-update { key DHCP_UPDATER; };
};
Note that if you use a new zone (ie, not your normal zone) you'll need to create the basic zone file for it, ie SOA entry and so on. Thats another topic tho.
This assumes you have a working DHCP3 config file.
Add the following entries to your dhcp.conf:
ddns-domainname "dyn.mydomain.something"; ddns-updates off; ddns-update-style interim;
key DHCP_UPDATER {
algorithm hmac-md5; secret "bC9Up7x9abx5mnOKujzgEg==";
}
zone dyn.mydomain.something. {
primary 127.0.0.1; key DHCP_UPDATER;
}
zone 0.0.10.in-addr.arpa. {
primary 127.0.0.1; key DHCP_UPDATER;
}
This sets up the ddns keys, and which zones to use them for. ddns-domainname sets the forward domain name that ddns will update. You can leave this out, but it will then use the value in 'domain-name'. As I wanted to use a seperate forward domain for dynamic names, I set the dynamic zone here. Note that i set dynamic updates off by default - I dont want dynamic updates to run over my static leases. (there is i think a better way of doing this)
subnet 10.0.0.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
option domain-name "mydomain.something"; option domain-name-servers 10.0.0.1; option netbios-name-servers 10.0.0.1;
range dynamic-bootp 10.0.0.150 10.0.0.250; default-lease-time 600; max-lease-time 86400;
authoritative; ddns-updates on;
}
This zone is for the 10.0.0.0/24 network. It specificies dynamic entries between 10.0.0.150 and 10.0.0.250 inclusive, states that it is authoritative for this subnet, and sets ddns-updates on.
Restart both dhcpd3-server and named. You should see log entries in syslog talking about 'if rrset for ... does not exist then create ...'
And doing nslookups on $MACHINENAME.yourdomain should now work. Note that this machinename is the Netbios name in case of windows machines. The reverse zone should also be updated, so that 'nslookup 10.0.0.151' for example, will return '$MACHINENAME.mydomain.something' correctly, instead of '10.0.0.151.dhcp.mydomain.something' which is what it was set to previously :)
3 pages link to DHCPNotes:
lib/main.php:944: Notice: PageInfo: Cannot find action page
lib/main.php:839: Notice: PageInfo: Unknown action
lib/plugin/WlugLicense.php:99: Warning: Invalid argument supplied for foreach()
lib/plugin/WlugLicense.php:111: Warning: in_array() [<a href='function.in-array'>function.in-array</a>]: Wrong datatype for second argument
lib/plugin/WlugLicense.php:111: Notice: Undefined variable: ignore_authors