My Photo

« Default 10.4 Server Firewall Config | Main | Cannot Change Desktop On Leopard Server »

Generating DNS A & PTR Records for DHCP Range

So you think it would be nice to have all your DHCP range of IPs map to hostnames... something like...

10.0.0.101 = dhcp101.foo.com
10.0.0.102 = dhcp102.foo.com
10.0.0.103 = dhcp103.foo.com etc etc

...but cannot be bothered to type them all in to your zone files? Well why not use the $GENERATE directive?

Stick the likes of the following at the end of your zone file...

$GENERATE 101-199    dhcp$    IN    A    10.0.0.$

And the following at the end of the domain's reverse zone file to get corresponding PTR records...

$GENERATE 101-199    $    IN    PTR    dhcp$.foo.com.

Also works for CNAME records!


NB. You will be unable to use the Server Admin GUI to modify DNS records after entering a $GENERATE directive. If you add it at the end of your zone file then you will be able to view other records in the GUI but do NOT hit save button!

Comments

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been saved. Comments are moderated and will not appear until approved by the author. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Comments are moderated, and will not appear until the author has approved them.