ddns: how to set a CNAME entry?

Brian Raaen braaen at zcorum.com
Fri Feb 26 12:48:55 UTC 2010


On Friday 26 February 2010, Simon Hobson wrote:
> Harald Dunkel wrote:
> 
> >I have to generate virtual hosts on the fly by cloning and
> >configuring a template host. The virtual hosts have to get
> >an "official name" like
> >
> >	<department>-<purpose>-<platform>-###
> >
> >and a name that is easy to type, like
> >
> >	vhost###
> >
> >Both names should be set in ddns on request of the dhcp
> >daemon when the virtual host sends a DHCP request.
> >
> >The appropriate dhcp configuration is generated by the
> >software creating the clone. Currently each host gets a
> >config record like
> >
> >host dep1-build-sol10u6-042 {
> >	hardware ethernet 00:16:36:61:74:c4;
> >	ddns-hostname "dep1-build-sol10u6-042";
> >	option host-name "dep1-build-sol10u6-042";
> >}
> >subclass "virtual-host" 1:00:16:36:61:74:c4;
> >
> >The IP address is taken from an address range, of course.
> >
> >How do I get the "vhost042" in?
> 
> Off the shelf, you can't do it.
> 
> Turning it around, could you make your provisioning package add the 
> CNAMEs to DNS and leave DHCP to add the A record ?
> 
> -- 
> Simon Hobson
> 

Have you considered using the new execute command to update the cname at the same time the a record is created.  I don't know if it would work, but if I was trying to 
accomplish what you are doing(creating 2 dns records at the same time) I'd give it a try.

Relevant man page snippet from dhcp-eval attached below.

-- 

----------------------

Brian Raaen
Network Engineer
braaen at zcorum.com


execute (command-path [, data-expr1, ... data-exprN]);

         The execute statement runs an external command.  The first argument is a string literal containing the name or path of the com‐
         mand  to run.  The other arguments, if present, are either string literals or data- expressions which evaluate to text strings,
         to be passed as command-line arguments to the command.

         execute is synchronous; the program will block until the external command being run has finished.   Please  note  that  lengthy
         program  execution  (for  example,  in an "on commit" in dhcpd.conf) may result in bad performance and timeouts.  Only external
         applications with very short execution times are suitable for use.

         Passing user-supplied data to an external application might be dangerous.  Make sure the external application checks input buf‐
         fers  for validity.  Non-printable ASCII characters will be converted into dhcpd.conf language octal escapes ("777"), make sure
         your external command handles them as such.

         It is possible to use the execute statement in any context, not only on events. If you put it in a regular scope in the config‐
         uration file you will execute that command every time a scope is evaluated.




More information about the dhcp-users mailing list