I've been hit with this problem, and I think I can see what's going wrong.
I have an internal Active Directory domain which is used for DNS, which is on a .local (we'll call it mydomain.local)
We also have another domain (we'll call it otherdomain.com) which is used for externally accessable resources, we have an internal DNS server with otherdomain.com as an ctive zone with CNAME records pointing to .mydomain.local hosts.
This is a common setup, I work with a lot of businesses and this is a very standard way to do things, so you can give users 1 hostname for access to a service and internally it points to the internal IP and externally it points to your forwarded external IP.
OK, enough history.
I put mDNSResponder into debug mode as per it's man page entry
I then 'pinged' an otherdomain.com address which resolves as a CNAME to a mydomain.local address
Here is the logs:
Thu Nov 25 11:42:36 smlt8001 mDNSResponder[31] <Warning>: 14: DNSServiceCreateConnection START
Thu Nov 25 11:42:36 smlt8001 mDNSResponder[31] <Warning>: 14: Error socket 31 created 00000000 00000001
Thu Nov 25 11:42:36 smlt8001 mDNSResponder[31] <Warning>: 14: DNSServiceQueryRecord(5000, 0, mx2.otherdomain.com., Addr) START
Thu Nov 25 11:42:36 smlt8001 mDNSResponder[31] <Info>: GetServerForQuestion: 0000000101006C88 DNS server 192.168.2.222:53 (Penalty Time Left 0) (Scope None:0000000000000000) found for name mx2.otherdomain.com. (Addr)
Thu Nov 25 11:42:36 smlt8001 mDNSResponder[31] <Info>: mDNS
StartQueryinternal: question 0000000101006C88 mx2.otherdomain.com. (Addr), DNS Server 192.168.2.222:53
Thu Nov 25 11:42:36 smlt8001 mDNSResponder[31] <Warning>: 14: Error socket 31 closed 00000000 00000001 (0)
Thu Nov 25 11:42:36 smlt8001 mDNSResponder[31] <Warning>: 14: DNSServiceQueryRecord(mx2.otherdomain.com., Addr) ADD 23 mx2.otherdomain.com. CNAME app2.mydomain.local.
Thu Nov 25 11:42:36 smlt8001 mDNSResponder[31] <Info>: AnswerCurrentQuestionWithResourceRecord: 0000000101006C88 mx2.otherdomain.com. (Addr) following CNAME referral 0 for 23 mx2.otherdomain.com. CNAME app2.mydomain.local.
Thu Nov 25 11:43:06 smlt8001 mDNSResponder[31] <Warning>: 14: Cancel 00000000 00000001
Thu Nov 25 11:43:06 smlt8001 mDNSResponder[31] <Warning>: 14: DNSServiceQueryRecord(app2.mydomain.local., Addr) STOP
Thu Nov 25 11:43:06 smlt8001 mDNSResponder[31] <Warning>: 14: Error socket 31 created 00000000 00000002
Thu Nov 25 11:43:06 smlt8001 mDNSResponder[31] <Warning>: 14: DNSServiceQueryRecord(5000, 0, mx2.otherdomain.com.mydomain.local., Addr) START
Thu Nov 25 11:43:06 smlt8001 mDNSResponder[31] <Warning>: 14: DNSServiceQueryRecord(mx2.otherdomain.com.mydomain.local., Addr) unicast
Thu Nov 25 11:43:06 smlt8001 mDNSResponder[31] <Info>: GetServerForQuestion: 0000000100837D78 DNS server 192.168.2.222:53 (Penalty Time Left 0) (Scope None:0000000000000000) found for name mx2.otherdomain.com.mydomain.local. (Addr)
Thu Nov 25 11:43:06 smlt8001 mDNSResponder[31] <Info>: mDNS
StartQueryinternal: question 0000000100837D78 mx2.otherdomain.com.mydomain.local. (Addr), DNS Server 192.168.2.222:53
Thu Nov 25 11:43:06 smlt8001 mDNSResponder[31] <Warning>: 14: Error socket 31 closed 00000000 00000002 (0)
Thu Nov 25 11:43:06 smlt8001 mDNSResponder[31] <Info>: mDNSCoreReceiveResponse ignoring 58 mydomain.local. SOA dc.mydomain.local. hostmaster. 47683 900 600 86400 900
Thu Nov 25 11:43:06 smlt8001 mDNSResponder[31] <Info>: Skipping check to see if we need to generate a negative cache entry for mx2.otherdomain.com.mydomain.local. (Addr)
Thu Nov 25 11:43:07 smlt8001 mDNSResponder[31] <Info>: mDNSCoreReceiveResponse ignoring 58 mydomain.local. SOA dc.mydomain.local. hostmaster. 47683 900 600 86400 900
Thu Nov 25 11:43:07 smlt8001 mDNSResponder[31] <Info>: Skipping check to see if we need to generate a negative cache entry for mx2.otherdomain.com.mydomain.local. (Addr)
Thu Nov 25 11:43:08 smlt8001 mDNSResponder[31] <Warning>: 14: Cancel 00000000 00000002
Thu Nov 25 11:43:08 smlt8001 mDNSResponder[31] <Warning>: 14: DNSServiceQueryRecord(mx2.otherdomain.com.mydomain.local., Addr) STOP
Thu Nov 25 11:43:08 smlt8001 mDNSResponder[31] <Warning>: 14: DNSServiceCreateConnection STOP
This is messed up.
It's looking up mx2.otherdomain.com and getting a CNAME of app2.mydomain.local.
It's then trying to look up mx2.otherdomain.com.mydomain.local
Why?
At first I thought it was not handling the '.' on the end of the CNAME and treating it as a relative name rather than a FQDN, but that's not it, because that would resolve to app2.mydomain.local.otherdomain.com NOT mx2.otherdomain.com.mydomain.local
Something is seriously hosed in the part of mDNSResponder in 10.6.5 when it handles a CNAME to a .local domain
Steven
Message was edited by: SBlackery