Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

"An Active Directory Domain Controller for the domain could not be contacted": fixing domain join DNS

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

You try to join a new server to the domain and get:

An Active Directory Domain Controller (AD DC) for the domain "<name>" could not be contacted. Ensure that the domain name is typed correctly.

Microsoft's first rule for any domain join problem is to check DNS, which it calls "the heart of Active Directory" (Microsoft Learn, domain join troubleshooting). This message nearly always means the computer could not find a domain controller through DNS, or found one and could not reach it.

What you see

The join dialog shows the message above. Click Details: the text there tells you which fault you have, and it is also saved in C:\Windows\debug\dcdiag.txt. Microsoft documents these versions:

Details text Error code What it points to
"This operation returned because the timeout period expired" (ERROR_TIMEOUT) and "The DNS servers used by this computer for name resolution are not responding" 0x54b DNS servers not answering, or ports to domain controllers blocked (Microsoft Learn, 0x54b)
"DNS server failure" (RCODE_SERVER_FAILURE), query for _ldap._tcp.dc._msdcs.<name>, with "might be a NetBIOS domain name" 0x0000232A The short (NetBIOS) domain name was typed, or the DNS server has wrong root hints or delegation (Microsoft Learn, 0x0000232A)
"An attempt to resolve the DNS name of a DC in the domain being joined has failed" 0xa8b The DNS server in use does not hold the domain's zones or records (Microsoft Learn, 0xa8b)

0x54b itself means ERROR_NO_SUCH_DOMAIN: the domain could not be contacted.

Why it happens

To join, the computer asks its DNS servers for the service (SRV) record _ldap._tcp.dc._msdcs.<domain>, which lists the domain controllers, then looks up a domain controller's address and talks to it. Any break in that chain gives this message. Microsoft lists these causes across the three pages:

  • The computer points at the wrong DNS servers, such as an internet provider's DNS servers, which do not hold your domain's zone. On a newly built server, check whether DHCP or the build template gave it a provider's or public DNS server. Other examples: a DNS server that no longer exists, or an internal one that does not host the Active Directory zone.
  • The DNS server is missing what the join needs: the forward lookup zone for the domain, the _msdcs zone, the LDAP SRV record for a domain controller, or a correct host (A) record. A host record can also exist but carry an address the joining computer cannot reach, for example one registered by a second network adapter on the domain controller.
  • The short domain name was typed (contoso instead of contoso.com), so the SRV lookup is made for a name that does not exist in DNS.
  • Ports are blocked between the computer and the domain controller: TCP 135, LDAP on TCP and UDP 389, SMB on TCP 445, Kerberos on TCP 88, DNS on 53, or the dynamic RPC ports.
  • Special domain names need extra configuration: single-label names, disjoint namespaces, and top-level domains that contain numbers.
  • Plain network faults: a broken adapter or link at either end.

How to prove the cause

All of these are read-only.

1. Read netsetup.log. It is on by default at %windir%\debug\netsetup.log. A 0x54b failure shows lines such as NetpCheckDomainNameIsValid … returned 0x54b; a 0xa8b failure shows NetpDsGetDcName: failed to find a DC in the specified domain: 0xa8b.

2. Check which DNS servers the computer uses.

ipconfig /all

Every DNS server listed should be one of your own that hosts the domain's zone. Microsoft's guidance for member servers is to point at local DNS servers hosting that zone, or one reachable over a reliable WAN link, and not at an internet provider's DNS servers, which can make joining and signing in fail (Microsoft Learn, DNS client settings).

3. Ask each of those DNS servers for the domain controller record.

nslookup -type=SRV _ldap._tcp.dc._msdcs.<DNS domain name> <DNS server IP>
nslookup <domain controller FQDN> <DNS server IP>

The first should list domain controllers; the second should return an address the joining computer can actually reach.

4. Try to locate a domain controller.

nltest /dsgetdc:<DNS domain name> /force

A good result names a domain controller, its address and flags such as LDAP KDC DNS_DC.

5. Test the ports. For each domain controller:

Test-NetConnection <DC IP address> -Port 389

TcpTestSucceeded : True means TCP 389 is open. Repeat for 135, 445 and 88. PortQry can also test UDP 389 and the RPC range:

portqry -n <DC name> -e 135
portqry -n <DC name> -p UDP -e 389
portqry -n <DC name> -r 49152:65535

FILTERED means something in between is blocking that port (Microsoft Learn, 0x54b).

6. On the domain controller side, run DCDiag /v on the nearest domain controller and check that it has registered its SRV records, such as _ldap._tcp.dc._msdcs.<domain>.

The fix

  • Wrong DNS servers on the joining computer. Set its preferred and alternate DNS servers to your own DNS servers that host the domain's zone, normally your domain controllers. Have those DNS servers forward internet names to your provider, rather than putting the provider's servers on the computer (Microsoft Learn, DNS client settings). If the address came from DHCP, correct the DHCP option too, or the next server built will hit the same fault.
  • Short name typed. Enter the full DNS domain name, for example contoso.com rather than contoso.
  • Missing zones or records. Make sure the domain's zone and _msdcs zone exist on the DNS servers used, and that domain controllers have registered their SRV and host records. Correct host records that point at an address the client cannot reach.
  • Wrong root hints or delegation (0x0000232A). Correct them on the DNS server named in the Details text.
  • Blocked ports. Open the ports Microsoft lists between the computer and the domain controllers: DNS 53 TCP/UDP, Kerberos 88 TCP, RPC endpoint mapper 135 TCP, LDAP 389 TCP/UDP, SMB 445 TCP and the dynamic RPC range (Microsoft Learn, domain join troubleshooting).

Then join again. From an elevated command prompt (Microsoft Learn, join a computer to a domain):

netdom join %COMPUTERNAME% /domain:<DNS domain name> /userd:<domain user> /passwordd:*

or in PowerShell:

Add-Computer -DomainName "<DNS domain name>" -Credential (Get-Credential)
Restart-Computer

How to confirm the fix

  • nltest /dsgetdc:<domain> /force names a domain controller.
  • The join completes, the computer restarts, and you can sign in with a domain account.
  • netsetup.log ends without an error status for the join.

What to watch afterwards

  • Server templates and DHCP scopes. If new servers keep getting the wrong DNS servers, fix it where they get them, not server by server.
  • A different error next time. Once DNS works, a join can still fail for other reasons Microsoft lists, such as 0xaac (reusing an existing computer account, restricted since the October 2022 join hardening updates), 0x569 (missing "Access this computer from the network" right) or 0x216d (the 10-computer limit per user, or a policy restricting joins).
  • Time. Domain members normally sync their clocks with domain controllers. Keep them aligned to avoid Kerberos problems (Microsoft Learn, join a computer to a domain).

Risks and limits

  • Do not put a public DNS resolver on a domain member "as a backup". The DNS client only moves to the alternate server when the preferred one does not answer, and a public server cannot answer for your domain (Microsoft Learn, DNS client settings).
  • Microsoft's pages list the dynamic RPC range differently: 49152–65535 on the 0x54b page and 1024–65535 in the general port table. Check the range your domain controllers actually use before writing firewall rules.
  • If the computer has to join over a VPN or a site-to-site link, the DNS and port checks must pass across that link. A router, firewall or VPN device dropping packets gives other errors such as 0x6BF or 0xC002001C.

Sources

Next step

When a new hosted server cannot see the domain, the cause is usually the DNS and network path between the new server and your domain controllers rather than the server itself. If you want new servers to join cleanly every time, NetLeverage has looked after business servers since 2002. Talk to us through managed support with the Details text from the join error and the ipconfig /all output.