guarantee RFC standardized hostname

Kevin Fitzgerald kwfitzgerald at
Wed Aug 24 21:25:08 UTC 2011

Hi Group,

For quite some time we have been generating DHCP ddns hostnames as follows:

if exists host-name {
        ddns-hostname = concat (lcase (option host-name) , "-" ,
binary-to-ascii(10 , 8 , "-" , leased-address));
    else {
        ddns-hostname = concat("dhcp-" , binary-to-ascii(10 , 8 , "-" ,

This is not an uncommon format.  It helps us ensure unique host names on our
network.  Lately I notice a handful of user devices that present host names
with invalid characters, such as android_blah or "nintendo 3ds" with a space
in the middle (no quotes).
What are you folks doing to mitigate this?  As it stands these users do not
receive valid NS records and we get a bevy of log messages when illegal
characters are in the hostname.

- I have seen mention of the use of regex in the man pages for dhcp-eval.
Is there a method to examine the host-name for invalid characters, replacing
them with a hyphen or otherwise?    (Is there REGEX evaluation available
within dhcpd.conf)
- if there is no way to do a character by character replace, can I fail down
to my else condition, simply prepending dhcp- to the front of the IP
K. Fitzgerald
UALR Information Technology Services
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the dhcp-users mailing list