Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Considering the complete lack of luck I've had googling any terms related to this question, this may not even be possible, but:

Is there a reasonably standard way to set a hostname on a machine, and have that hostname "pushed" to a BIND-based DNS server instead of the other way around?

Background:

DHCP is banned in this particular environment, so I need to come up with an alternate way to deploy systems quickly. I'm close to just hacking together something with Puppet and a web UI to automate populating hostnames, but a push from the client would be easier to automate (since then all I'd have to touch is one dialog in the installer).

All of the client systems in question are Linux based.

share|improve this question
    
what OS are your client systems running? –  Rex Dec 18 '13 at 22:56
    
@Rex all various flavors of Linux, mostly Ubuntu –  Mikey T.K. Dec 18 '13 at 22:57

1 Answer 1

up vote 1 down vote accepted

I don't know if there a set standard way, but assuming the BIND server is configured to allow dynamic updates, you could run a shell script on startup (or on a cron job) to run nsupdate to update the record.

#!/bin/bash

ECHO server <mydnsserver> > /tmp/dnsupdate

ECHO "zone <mydomain>" >> /tmp/dnsupdate
ECHO "update delete my.fqdn.com A" >> /tmp/dnsupdate
ECHO "update add my.fqdn.com 60 A myipaddress" >> /tmp/dnsupdate
ECHO "send" >> /tmp/dnsupdate

ECHO "zone <ipnetwork-inaddr.arpa.>" >> /tmp/dnsupdate
ECHO "update delete <myip.in-addr.arpa> PTR <my.fqdn.com>" >> /tmp/dnsupdate
ECHO "update add <myip.inaddr.arpa. 60 PTR <my.fqdn.com>" >> /tmp/dnsupdate
ECHO "send" >> /tmp/dnsupdate

nsupdate -v /tmp/dnsupdate

If you need secured updates, you can create a keypair and specify the key nsupdate -k <keyfile> -v /tmp/dnsupdate. You could also make the script more generic and usable by pulling the hostname and IP info as part of the script into variables.

share|improve this answer
    
You should also update the PTR record if possible. –  Fred the Magic Wonder Dog Dec 18 '13 at 23:18
    
@FredtheMagicWonderDog updated -it should work but might still need some modification. –  Rex Dec 18 '13 at 23:27
    
This is awesome - never heard of this tool before, but it works perfectly for my needs! Thanks! –  Mikey T.K. Dec 18 '13 at 23:40
    
Actually, the ptr portion isn't great as it would not account for an IP address change. You would need to query for the old/original ip before making any updates and delete the old ptr record. –  Rex Dec 18 '13 at 23:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.