Active Directory Sites

From SambaWiki
Revision as of 21:10, 25 August 2015 by Mmuehlfeld (talk | contribs) (Fix links)


Whilst Active Directory Organizational Units represents the logical structure of a company, sites define the physical topology of the network.

Companies may have more than one location spread over a city, country or the planet. In some situations this is reflected by subdomains or domain trusts. However, if all locations should be part of the same domain - which can save administration work - Active Directory sites are the right choice.

This documentation assumes that you're already familiar with Active Directory sites, replication topologies, etc. For further information, see:

Server information

This documentation uses the following configuration/settings:

Domain information:
DNS Domain Name:       
NT4 Domain Name (NETBIOS):       SAMDOM
Kerberos Realm:                  SAMDOM.EXAMPLE.COM
Domain Administrator:            Administrator
Domain Administrator Password:   passw0rd

Inter-Site Transport:            IP
Site Link:                       DEFAULTIPSITELINK

Default-First-Site-Name (already existing):
   Domain Controller(s):         DC1, DC2
   Subnets:            ,

 MyDemoSite (created in the following):
   Domain Controller:            DC3

Active Directory Sites and Services

Unfortunately, samba-tool doesn't yet support all the features required to fully administer Active Directory sites. The Windows tool „Active Directory Sites and Services“, which is part of RSAT, is required for most of the steps.

The Samba team strongly advises you not to edit the AD directly!

Setting up a new Site

Using samba-tool

It is not recommended to use samba-tool to create a site. Even if a site can be created, it will not be part of any site link. This feature isn't implemented (yet) and has to be done in Active Directory Sites and Services.

Using Active Directory Sites and Services

  • Open Active Directory Sites and Services
  • Navigate to „Sites“
  • Right-click to „Sites“ and choose „New“ / „Site“:
ADSS Create New Site.png
  • Choose a name for the new site and select a site link:
ADSS New Site Creation.png
  • The new site appears. It doesn't have any Domain Controllers linked yet.
ADSS Site Without DCs.png

Assigning a Domain Controller to a site

Scenario A: Joining a new Domain Controller to a site

  • To setup and join a new Domain Controller to a site, follow the Join a domain as a DC documentation and add the „--site=MyDemoSite“ parameter to the join command:
# samba-tool domain join DC -Uadministrator --site=MyDemoSite ...
Finding a writeable DC for domain ''
Found DC
Password for [WORKGROUP\administrator]: passw0rd
workgroup is SAMDOM
realm is
checking sAMAccountName
Adding CN=DC3,OU=Domain Controllers,DC=samdom,DC=example,DC=com
Adding CN=DC3,CN=Servers,CN=MyDemoSite,CN=Sites,CN=Configuration,DC=samdom,DC=example,DC=com
Adding CN=NTDS  Settings,CN=DC3,CN=Servers,CN=MyDemoSite,CN=Sites,CN=Configuration,DC=samdom,DC=example,DC=com
Adding SPNs to CN=DC3,OU=Domain Controllers,DC=samdom,DC=example,DC=com
Setting account password for DC3$
Enabling account
Calling bare provision
No IPv6 address will be assigned
Provision OK for domain DN DC=samdom,DC=example,DC=com
Starting replication
Schema-DN[CN=Schema,CN=Configuration,DC=samdom,DC=example,DC=com] objects[402/1550] linked_values[0/0]
Schema-DN[CN=Schema,CN=Configuration,DC=samdom,DC=example,DC=com] objects[804/1550] linked_values[0/0]
Schema-DN[CN=Schema,CN=Configuration,DC=samdom,DC=example,DC=com] objects[1206/1550] linked_values[0/0]
Schema-DN[CN=Schema,CN=Configuration,DC=samdom,DC=example,DC=com] objects[1550/1550] linked_values[0/0]
Analyze and apply schema objects
Partition[CN=Configuration,DC=samdom,DC=example,DC=com] objects[402/1627] linked_values[0/0]
Partition[CN=Configuration,DC=samdom,DC=example,DC=com] objects[804/1627] linked_values[0/0]
Partition[CN=Configuration,DC=samdom,DC=example,DC=com] objects[1206/1627] linked_values[0/0]
Partition[CN=Configuration,DC=samdom,DC=example,DC=com] objects[1608/1627] linked_values[0/0]
Partition[CN=Configuration,DC=samdom,DC=example,DC=com] objects[1627/1627] linked_values[40/0]
Replicating critical objects from the base DN of the domain
Partition[DC=samdom,DC=example,DC=com] objects[100/100] linked_values[23/0]
Partition[DC=samdom,DC=example,DC=com] objects[397/297] linked_values[23/0]
Done with always replicated NC (base, config, schema)
Replicating DC=DomainDnsZones,DC=samdom,DC=example,DC=com
Partition[DC=DomainDnsZones,DC=samdom,DC=example,DC=com] objects[41/41] linked_values[0/0]
Replicating DC=ForestDnsZones,DC=samdom,DC=example,DC=com
Partition[DC=ForestDnsZones,DC=samdom,DC=example,DC=com] objects[19/19] linked_values[0/0]
Partition[DC=ForestDnsZones,DC=samdom,DC=example,DC=com] objects[38/19] linked_values[0/0]
Committing SAM database
Sending DsReplicateUpdateRefs for all the replicated partitions
Setting isSynchronized and dsServiceName
Setting up secrets database
Joined domain SAMDOM (SID S-1-5-21-469703510-2364959079-1506205053) as a DC
Depending on your join parameters (e. g. DNS backend BIND), the output may differ.
  • Ensure you follow the Join a domain as a DC documentation until the end, once the newly joined Domain Controller is up and the replication is working, continue here.

Scenario B: Moving an existing Domain Controller to a site

  • Open Active Directory Sites and Services
  • Open the „Servers“ node under the source and destination site
  • Move the Domain Controller to the new site
ADSS Move Server To Site.png
  • Confim the question about the move.
ADSS Move DC Warning.png


Check Active Directory site-related DNS entries

Check that some site-specific DNS entries of the DC have been created in their respective site subdomain:

# host -t SRV has SRV record 0 100 389

# host -t SRV has SRV record 0 100 88

A possible reason for the DNS requests not being resolved, is that the DNS wasn't updated in the meantime. Samba usually runs this task every 10 minutes, but if you are impatient, it can be forced manually, (output of the command shortened):

# samba_dnsupdate --verbose
IPs: ['']
Failed to find DNS entry SRV 389
Failed to find DNS entry SRV 88
Calling nsupdate for SRV 389 (add)
Outgoing update query:
;; ->>HEADER<<- opcode: UPDATE, status: NOERROR, id:      0
;; flags:; ZONE: 0, PREREQ: 0, UPDATE: 0, ADDITIONAL: 0
;; UPDATE SECTION: 900 IN SRV 0 100 389

Calling nsupdate for SRV 88 (add)
Outgoing update query:
;; ->>HEADER<<- opcode: UPDATE, status: NOERROR, id:      0
;; flags:; ZONE: 0, PREREQ: 0, UPDATE: 0, ADDITIONAL: 0
;; UPDATE SECTION: 900 IN SRV 0 100 88

A common error during DNS updates is „dns_tkey_negotiategss: TKEY is unacceptable“. See the respective documentation.

Re-check DNS after a manual update.

Check site allocation of the Domain Controller

  • Open Active Directory Sites and Services
  • You should see the joined/moved DC under the Site entry
ADSS DC Joined To Site.png

Setting up subnets

Using samba-tool

Feature not supported (yet).

Using Active Directory Sites and Services

  • Open Active Directory Sites and Services
  • Navigate to „Subnets“
  • Right-click to „Subnets“ and choose „New“ / „Subnet“:
ADSS Create New Subnet.png
  • Create a subnet entry for all subnets in your network and assign them to a site:
ADSS Subnet Creation.png
  • After the creation, the Subnets appear under the „Subnets“ node:
ADSS Subnet Overview.png

Verify Domain Controller choice of a client

To verify the correctness of your configuration, logon to a client in each subnet, open a command line and use the commands below.

Note: Clients do their Site discovery during startup - not during logons! If e. g. the site membership of a client or the DC(s) in a site change, you have to reboot the client to make the changes effective.

C:\> ipconfig
Windows IP Configuration

Ethernet adapter:
  Connection-specific DNS Suffix  . :
  IPv4 Address. . . . . . . . . . . :
  Subnet Mask . . . . . . . . . . . :
  Default Gateway . . . . . . . . . :

C:\> echo %LogonServer%

C:\> nltest /dsgetsite
The command completed successfully

C:\> nltest /dsgetdc:samdom
           DC: \\DC3
      Address: \\
     Dom Guid: 4d5258b9-0cd7-4d78-bdd7-99ebe6b19751
     Dom Name: SAMDOM
  Forest Name:
 Dc Site Name: MyDemoSite
Our Site Name: MyDemoSite
The command completed successfully

The above output is from a Windows client, that is, according to its IP, assigned to the „MyDemoSite“ site with the only Domain Controller „DC3“.

Additional/Optional tasks

Changing Subnet to Site allocation

Assigning a subnet to a different site, leads into domain logons to different Domain Controllers after the next reboot.

  • Right-click to a Subnet and choose „Properties“
  • Assign the Subnet to a different Site:
ADSS Change Site Of A Subnet.png
  • Save the changes, by clicking „OK“.