OS X equivalent to ipconfig /registerdns?

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?


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

#!/bin/sh

# 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.


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.