Posted on 03-15-2012 11:22 AM
We are in a dynamic dns project here so users can get to their systems via its name. The goal is to parallel what they are planning to do in the windows world on the Mac. What they are planning to do in windows - in the Advanced TCP/IP Settings (windows) - on the DNS Pane:
Radio button - Append these DNS suffixes (in order) mycompany.com prod.mycompany.com client.mycompany.com
Have the dns suffiix for the connection be: client.mycompany.com,
Register this connection's address in dns (checked)
Use the connection's dns suffix in dns registration (checked)
I have no problem getting the search domains to systems.
I don't know how to get these systems to register with DNS (yet)
There are 10.6 and 10.7 clients around the company.
This command below fails under 10.6, /usr/bin/net doesn't exist in 10.7:
/usr/bin/net -n mycomputer -W client.mycompany.com -P ads register
I found a nsupdate script that I haven't got working yet...
Anyone out there have a solution?
Solved! Go to Solution.
Posted on 03-20-2012 11:23 AM
After a bunch of work, I have an answer and thought I'd share it with all... It is easy to get the info from the mac, harder to script to nsupdate... I was able to work it line by line until I realized all I had to do was create a text file with the commands needed and nsupdate the text file. Updated so you don't try to update your dns if away from the company's network. The kicker - a launchd plist in /Library/LaunchDaemons activates the script on startup, login, or if there are changes in /Library/Preferences/SystemConfiguration
#!/bin/sh
##1st get the domain you are on##
vdomain=`cat /var/run/resolv.conf | awk '/domain/ {print $2}'`
echo $vdomain
##if not on mycompany.com domain exit##
if [ $vdomain != "mycompany.com" ]; then
echo "we are not in kansas"
exit 0
else
echo "run the mycompany.com script"
fi
computernm=`scutil --get ComputerName`
echo $computernm
ipaddr=`/sbin/ifconfig en0 | awk '/inet / {print$2}'`
echo $ipaddr
##if $ipaddr empty - go for en1###
if [ -z "$ipaddr" ]; then
echo "get en1"
ipaddr=`/sbin/ifconfig en1 | awk '/inet / {print$2}'`
echo "$ipaddr en1"
fi
dnsdelete="update delete $computernm.client.mycompany.com A"
echo $dnsdelete
#echo "update add $computernm.client.mycompany.com 86400 A $ipaddr"
dnsupdate="update add $computernm.client.mycompany.com 86400 A $ipaddr"
#echo $dnsupdate
echo $dnsdelete > /tmp/nsupdate
echo $dnsupdate >> /tmp/nsupdate
echo send >> /tmp/nsupdate
echo quit >> /tmp/nsupdate
#cat /tmp/nsupdate
nsupdate -v /tmp/nsupdate
echo "dns updated"
Posted on 03-15-2012 11:59 AM
Your DNS server needs to allow registration either by clients or by DHCP on behalf of clients. Search suffixes don't really have anything to do DNS registration that I'm aware.
In our environment the act of binding a Mac to Active Directory automatically adds a record to DNS with Mac's host name plus our Active Directory domain. Active Directory domains and network domains that are assigned by DHCP aren't always the same.
Posted on 03-15-2012 01:10 PM
Well, in this environment not all systems are bound to AD...and I can't do forward and reverse lookups on systems that I know are bound to AD...
I attempting to tame a wild horse.....
and I've been requested to do as stated above - send a registration - as per the plan for windows clients...
Posted on 03-15-2012 01:10 PM
Well, in this environment not all systems are bound to AD...and I can't do forward and reverse lookups on systems that I know are bound to AD...
I attempting to tame a wild horse.....
and I've been requested to do as stated above - send a registration - as per the plan for windows clients...
Posted on 03-15-2012 01:27 PM
So then, do you know if your DNS servers accept DHCP registrations made on behalf of your clients? I think you'll need this enabled if you're not binding your Macs to your Windows domain.
Posted on 03-15-2012 02:02 PM
Major point of information - NO systems have dns record now. That is why the choice was made above - so, there is a need to register the macs using the client.mycompany.com
Looking for a command to register with systems with dns...(planning to use launchd to run it so dns is updated)
Posted on 03-15-2012 02:33 PM
Hmm... If that doesn't do it then something is more than likely configured wrong on the server side and not the Mac side. If you try to ping a Mac from a Windows machine using just the host name or its FQDN then are you not getting a response?
If DNS isn't getting your registration then use the command line nsupdate and see if that works for you. I really don't think you should need to use this but I don't know your environment either.
Posted on 03-20-2012 11:23 AM
After a bunch of work, I have an answer and thought I'd share it with all... It is easy to get the info from the mac, harder to script to nsupdate... I was able to work it line by line until I realized all I had to do was create a text file with the commands needed and nsupdate the text file. Updated so you don't try to update your dns if away from the company's network. The kicker - a launchd plist in /Library/LaunchDaemons activates the script on startup, login, or if there are changes in /Library/Preferences/SystemConfiguration
#!/bin/sh
##1st get the domain you are on##
vdomain=`cat /var/run/resolv.conf | awk '/domain/ {print $2}'`
echo $vdomain
##if not on mycompany.com domain exit##
if [ $vdomain != "mycompany.com" ]; then
echo "we are not in kansas"
exit 0
else
echo "run the mycompany.com script"
fi
computernm=`scutil --get ComputerName`
echo $computernm
ipaddr=`/sbin/ifconfig en0 | awk '/inet / {print$2}'`
echo $ipaddr
##if $ipaddr empty - go for en1###
if [ -z "$ipaddr" ]; then
echo "get en1"
ipaddr=`/sbin/ifconfig en1 | awk '/inet / {print$2}'`
echo "$ipaddr en1"
fi
dnsdelete="update delete $computernm.client.mycompany.com A"
echo $dnsdelete
#echo "update add $computernm.client.mycompany.com 86400 A $ipaddr"
dnsupdate="update add $computernm.client.mycompany.com 86400 A $ipaddr"
#echo $dnsupdate
echo $dnsdelete > /tmp/nsupdate
echo $dnsupdate >> /tmp/nsupdate
echo send >> /tmp/nsupdate
echo quit >> /tmp/nsupdate
#cat /tmp/nsupdate
nsupdate -v /tmp/nsupdate
echo "dns updated"