How to set hostname for DNS entry with "on commit" hook

Markus Hubig mhubig at imko.de
Wed Nov 28 15:09:42 UTC 2012


Hi @all,

we are trying to set up a "on commit" hook to dynamically add and remove the
hosts within a group to the djbdns DNS server.

The hook is working, but the hostnames the hook uses are the ones the client
supplies, not the ones we set via the host-name option. Is there something we
misses? How can we "hard-wire" the hostname so the client can not change it?

Our setup looks like this:

| authoritative;
| default-lease-time 3600; # 1 Hour
| max-lease-time 21600;    # 6 Hours
| log-facility local7;
|
| # Disable RFC 2136 dynamic DNS updates.
| ddns-update-style none;
|
| ## DHCP for the IMKO Network
| subnet 192.168.1.0 netmask 255.255.255.0 {
|
|     option domain-name "imko";
|     option domain-name-servers a.ns.imko;
|     option routers router.imko;
|     option netbios-name-servers network.imko;
|     option ntp-servers network.imko;
|     next-server deployment.imko;
|     use-host-decl-names off;
|
|     group { ## WORKSTATIONS KNOWN
|
|         # Define actions to take when leases are committed, released,
|         # or expired to accomplish dynamic DNS updates to djbdns. This
|         # does not use the RFC 2136 update mechanism, because djbdns
|         # does not support it. However, it accomplishes the same thing.
|         on commit {
|             execute ("/usr/bin/sudo",
|                 "/usr/local/bin/dns-update-djb",
|                 "commit",
|                 lcase (option host-name),
|                 config-option domain-name,
|                 binary-to-ascii (10, 8, ".", leased-address));
|
|             on release or expiry {
|                 execute ("/usr/bin/sudo",
|                     "/usr/local/bin/dns-update-djb",
|                     "release",
|                     binary-to-ascii (10, 8, ".", leased-address));
|             }
|         }
|
|         host test {
|             hardware ethernet xx:xx:xx:xx:xx:xx;
|             option host-name "test";
|         }
|     }
| }

Cheers, Markus


More information about the dhcp-users mailing list