Windows "The specified domain either does not exist or could not be contacted": it's usually DNS
Fix "The specified domain either does not exist or could not be contacted" when joining a domain: point DNS at a domain controller, test the SRV records, ports and time.
by OhSudo ··
The specified domain either does not exist or could not be contacted.Or, in the longer version, when joining a domain:
An Active Directory Domain Controller (AD DC) for the domain "contoso.local" could not be contacted.In nearly every case, this machine is asking the wrong DNS server. A computer finds a domain controller by asking DNS for special records. A public server like 8.8.8.8 has never heard of your internal domain, so to this machine, the domain doesn’t exist.
- This computerneeds a DC for contoso.localasks
- Its DNS server8.8.8.8 instead of your DC(breaks here)no such records(fails)
- Domain controllernever found
TL;DR
Get-DnsClientServerAddress -AddressFamily IPv4 # which DNS server?nslookup -type=SRV _ldap._tcp.dc._msdcs.contoso.localSet-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses 10.0.0.10ipconfig /flushdns10.0.0.10 is your domain controller here. Set yours, then try again.
1. Which DNS server is it using?
Get-DnsClientServerAddress -AddressFamily IPv4ipconfig /allMachines in a domain must use the domain’s DNS servers, and only those. A home router, 8.8.8.8 or 1.1.1.1 won’t do. Don’t add a public server as “secondary” either: Windows may use it at any time, and then the domain seems to disappear now and then.
Set it, or fix it on your DHCP server if that’s where it comes from:
Set-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses 10.0.0.10, 10.0.0.11ipconfig /flushdnsGet-NetAdapter lists the names, if yours isn’t Ethernet.
2. Can it find a domain controller?
This is exactly the question Windows asks:
nslookup -type=SRV _ldap._tcp.dc._msdcs.contoso.local_ldap._tcp.dc._msdcs.contoso.local SRV service location: priority = 0 port = 389 svr hostname = dc01.contoso.localOr use the dedicated tool, which also tests the answer:
nltest /dsgetdc:contoso.localCheck the domain’s full name: contoso.local, rather than the short name, CONTOSO. A short name needs extra lookups that often fail, so use the full one when joining.
Non-existent domain: a wrong DNS server (section 1), or a wrong name.Can't find ...on the right server: the records are missing on the domain controller (section 4).
3. Can it reach the domain controller?
DNS answers, and joining needs the network too:
Test-NetConnection dc01.contoso.local -Port 389Test-NetConnection dc01.contoso.local -Port 445Test-NetConnection dc01.contoso.local -Port 88| Port | For |
|---|---|
| 53 | DNS |
| 88 | Kerberos sign-in |
| 135, plus 49152–65535 | RPC |
| 389 | LDAP |
| 445 | SMB, for policies and scripts |
A failure means a firewall in between, or a VPN that doesn’t carry this traffic. A VPN often gives you its own DNS server too, so check ipconfig /all while it’s connected. The Port Lookup explains these ports. If 135 passes and joining still fails, see The RPC server is unavailable.
4. On the domain controller
If records are missing, make the domain controller register them again:
Get-Service DNS, Netlogon, NTDS, KDC | Format-Table Name, StatusRestart-Service Netlogonipconfig /registerdnsdcdiag /test:dns /vCheck that the domain controller points to itself, or to another domain controller, for DNS. A domain controller set to use a public server breaks in the same way.
5. Check the time
Kerberos refuses sign-ins when clocks differ by more than 5 minutes, and the message can then be misleading. Compare them:
w32tm /stripchart /computer:dc01.contoso.local /samples:3 /dataonlyFix it:
w32tm /config /syncfromflags:domhier /updateRestart-Service w32timew32tm /resyncVirtual machines that were suspended, or restored from a snapshot, are the usual suspects.
6. Then try the join
Add-Computer -DomainName contoso.local -Credential CONTOSO\admin -RestartThe -Server dc01.contoso.local option can name a domain controller directly, which helps rule out problems with finding one.
A machine that’s already joined and suddenly shows this has probably lost its DNS settings, or its VPN. If it’s the machine’s own account that’s broken, the message is different: see the trust relationship failed.
Warning
Avoid editing the hosts file to point the domain at a server. It may let the join go through, but sign-ins need the SRV records, and problems come back later in ways that are much harder to trace. Fix DNS instead.
Shell, we have a problem!
Similar, but different: The trust relationship between this workstation and the primary domain failed means DNS works, and the machine’s account doesn’t: see that article. Access is denied when joining means the account can’t add computers. The network path was not found is a System error 53. Temporary failure in name resolution is the Linux version of a DNS problem.
Found this useful? Share it.
Found a mistake? Let us know at contact@ohsudo.com.