2

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.

2
  • what OS are your client systems running?
    – Rex
    Dec 18, 2013 at 22:56
  • @Rex all various flavors of Linux, mostly Ubuntu
    – Mikey T.K.
    Dec 18, 2013 at 22:57

1 Answer 1

1

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.

4
  • You should also update the PTR record if possible. Dec 18, 2013 at 23:18
  • @FredtheMagicWonderDog updated -it should work but might still need some modification.
    – Rex
    Dec 18, 2013 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, 2013 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, 2013 at 23:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .