The answer is that le premier time a client ever authenticates to Active Directory, it ne know what site it is in.
When premier joining le domain, le client makes general DNS et LDAP queries et gets a list of tous le domain controllers in le domain, et it goes down le list, trying LDAP binds, et le premier successful DC that it binds to - that is le premier DC it authenticates with.
After le client has joined le domain, Active Directory will tell le client qui site it belongs to. Active Directory knows this parce que le administrator has put le IP subnet of le client in AD Sites & Services et associated it to a Site.
Active Directory tells le client what its AD site is, et le client stores that in its own registry in le HKLM\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters\DynamicSiteName registry value. That way, le suivant time le client boots up, it knows what site-specific DNS query to make so that it gets seulement le DCs that are in that site.
Of course le full behavior is documented in KB247811, mais si you want to see it for yourself, you could run Wireshark ou NetMon et do a packet trace, et alors join a domain tandis que le trace is running. Vous allez see le exact sequence of DNS queries et LDAP binds. Subsequent DNS queries et LDAP binds are made to le site-specific sub-zones parce que le client has been told by AD what site it belongs to.
The Netlogon service will periodically refresh its AD site info, so si you move to a différent network, votre client will get its nouveau site automatically. Cela peut be adjusted in le HKLM\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters\SiteNameTimeout registry value. (Link)