Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Network is running a number of Mac's with Snow Leopard and having issues with DNS resolution (running Windows Active Directory environment with Windows DHCP handing out leases). Is there a way to get the Mac to force registration of the system name with the DNS server (or some way to get DHCP to register the name with the DNS server) the way Windows can be forced to do so with "ipconfig /registerdns"?

Is there something inherent to the way Windows does DHCP/DNS that isn't quite standard?

share|improve this question
up vote 2 down vote accepted

You can use nsupdate, either in interactive mode or with a script like this one I made :


# en0 = ethernet - en1 = airport - choose the right interface !
IPADDR=`/sbin/ifconfig en0 | grep 'inet ' | awk '{print $2}'`
HOSTNAME=`hostname -f`

# Optionally set the name server (if not present, it uses system default).
#echo server "${DNSSERVER}" > $TMPDIR/nsupdate

# Change > to >> if name server set.
echo update delete "${HOSTNAME}" A > $TMPDIR/nsupdate
echo update add "${HOSTNAME}" 86400 A "${IPADDR}" >> $TMPDIR/nsupdate
echo show >> $TMPDIR/nsupdate
echo send >> $TMPDIR/nsupdate

nsupdate $TMPDIR/nsupdate

This script simply delete any previous A record, then register a new one.

share|improve this answer
You also have to make sure the DNS server will accept non-secured updates. If the record already exists you may have to set permissions on the record so that the OSX client can update the record (or just delete the record). – Chris S Feb 24 '10 at 20:46
When I execute 'hostname -f', I get "mycomputername.local" which doesn't seen to be good to use. I used: HOSTNAME=hostname -s and DOMAIN=networksetup -getsearchdomains ethernet | head -n 1 And then used "${HOSTNAME}.${DOMAIN}" in the update statements. I had to explicitly set the search domain since the one returned from DHCP (which show in gray text in the network preferences panel) is not returned by /usr/sbin/networksetup. – chrish Jul 7 '11 at 13:05

You can get DHCP to update DNS for you when it hands out a lease to a client, by enabling dynamic updates. Take a look at this KB article for details on how to set it up.

share|improve this answer
You can set an option on the DHCP server to update DNS for clients that do not support dynamic updates (MS assumes all non-windows computers do not support it). – Chris S Feb 24 '10 at 20:45

If you use Centrify's AD integration software, you can also use addns --update. See man addns for details.

addns uses kerberos authentication, so probably you don't have to accept non-secured updates. For kerberos to work, the command must be run as the user, not as root.

share|improve this answer

Your Answer


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.