Learn › Windows Server

DC Locator Explained: How Windows Clients Find a Domain Controller

How Windows finds a domain controller with DNS SRV records, LDAP pings and AD sites – and how to fix slow logons and 'no domain controller found' errors.

Advanced 11 min read
By Gopinath Karthikeyan

Before any domain logon, Group Policy update or Kerberos ticket, a Windows machine has to answer one question: which domain controller should I talk to? The process that answers it is the DC locator, run by the Netlogon service. When it picks a DC on the other side of the world, logons are slow; when it finds none, nothing works.

The ingredients

  • DNS SRV records. Each DC’s Netlogon service registers records that say “I’m a DC for this domain, in this site”. You can see the full list a DC tries to register in %SystemRoot%\System32\config\netlogon.dns.
  • AD sites and subnets. In Active Directory Sites and Services you map IP subnets to sites. That’s how a DC knows which site a client is in.
  • The client’s cached site. Each machine remembers the last site it was told it’s in.

Key SRV records:

Record Finds
_ldap._tcp.dc._msdcs.contoso.local Any DC in the domain
_ldap._tcp.<Site>._sites.dc._msdcs.contoso.local DCs in a specific site
_kerberos._tcp.dc._msdcs.contoso.local DCs running the KDC
_ldap._tcp.gc._msdcs.contoso.local Global catalog servers
_ldap._tcp.pdc._msdcs.contoso.local The PDC emulator

Step by step

DC locator: how a Windows client finds a domain controller in its site Ask DNS for SRV records _ldap._tcp.<site>._sites.dc._msdcs.contoso.local DNS-இடம் SRV records கேள் _ldap._tcp.<site>._sites.dc._msdcs.contoso.local 1 DNS returns DCs Name, port, priority, weight DNS DC-களின் list தரும் Name, port, priority, weight 2 LDAP ping (UDP 389) Client contacts the DCs it was given LDAP ping (UDP 389) கிடைத்த DC-களை client தொடர்பு கொள்ளும் 3 First DC to reply answers It also tells the client its correct site முதலில் பதில் தரும் DC Client-ன் சரியான site-ஐயும் சொல்லும் 4 Client caches the DC Check with: nltest /dsgetdc:contoso.local Client DC-ஐ cache செய்யும் Check: nltest /dsgetdc:contoso.local 5 ↺ Wrong site? The client repeats step 1 with its correct site ↺ தவறான site? சரியான site-உடன்client படி 1-ஐ மீண்டும் செய்யும் No SRV records = “no domain controller found” SRV records இல்லை = “DC கிடைக்கவில்லை”
Clients find DCs through DNS SRV records, then an LDAP ping picks a responsive DC – preferably in the client’s own AD site.Client-கள் DNS SRV records மூலம் DC-களை கண்டுபிடித்து, LDAP ping மூலம் பதில் தரும் DC-ஐ தேர்வு செய்கின்றன – முடிந்தவரை அதே AD site-ல்.
  1. Ask DNS for the site-specific SRV record using the cached site (or the domain-wide record if it doesn’t know one).
  2. DNS returns a list of DCs with priority and weight.
  3. LDAP ping – the client sends a small connectionless LDAP query (UDP 389) to the DCs.
  4. The first DC to reply wins. In its reply, the DC also tells the client which site its IP address belongs to. If that’s a different site, the client repeats the search in the correct site.
  5. The client caches the DC and its site and uses them until something fails or it’s asked to find a new one.

See it for yourself

nltest /dsgetdc:contoso.local            # which DC and site this machine is using
nltest /dsgetsite                         # this machine's site
nltest /dsgetdc:contoso.local /force      # find a DC again, ignoring the cache
Resolve-DnsName -Type SRV _ldap._tcp.dc._msdcs.contoso.local
Resolve-DnsName -Type SRV "_ldap._tcp.Chennai._sites.dc._msdcs.contoso.local"

When it goes wrong

“No domain controller could be contacted” / can’t join the domain

  • The client isn’t using AD DNS servers (a public DNS or a router as DNS is the most common cause). Check Get-DnsClientServerAddress.
  • The SRV records are missing. On a DC, restart Netlogon or run nltest /dsregdns to re-register, and check DNS for the _msdcs zone.
  • A firewall blocks UDP/TCP 389, 88 or 53 to the DCs.

Slow logons in a branch office

  • The branch’s subnet isn’t defined in AD, so the client gets a random DC – maybe in another country. DCs log NETLOGON event 5807 about clients from undefined subnets, and the details are in %SystemRoot%\debug\netlogon.log (look for NO_CLIENT_SITE).
  • Fix: add the subnet and map it to the right site.

Everyone hits one DC

  • Check SRV priority/weight, and whether the other DCs registered their site-specific records.

Good practice

  • Define every subnet (including VPN and cloud ranges) in Sites and Services.
  • Point clients only at AD-integrated DNS servers; forward internet names from there.
  • Keep at least two DCs per important site, or make sure the nearest site is reachable cheaply.

What’s next

Next: Active Directory replication explained.

Practise this topic

Test yourself with free questions on this topic – instant answers and explanations.

Start practice questions

Windows ServerActive DirectoryDNSSitesDeep DiveAdvanced

Gopinath Karthikeyan

Gopinath Karthikeyan – Windows Site Reliability Engineer with about 12 years in enterprise Windows Server infrastructure, and founder of WinOps Academy. YouTube · LinkedIn

More in Windows Server