This is a Canonical Question about Active Directory Domain Services (AD DS).
What is Active Directory? What does it do and how does it work?
How is Active Directory organized: Forest, Child Domain, Tree, Site, or OU
I find myself explaining some of what I assume is common knowledge about it almost daily. This question will, hopefully, serve as a canonical question and answer for most basic Active Directory questions. If you feel that you can improve the answer to this question, please edit away.
What is Active Directory?
Active Directory Domain Services is Microsoft's Directory Server. It provides authentication and authorization mechanisms as well as a framework within which other related services can be deployed (AD Certificate Services, AD Federated Services, etc). It is an LDAP compliant database that contains objects. The most commonly used objects are users, computers, and groups. These objects can be organized into organizational units (OUs) by any number of logical or business needs. Group Policy Objects (GPOs) can then be linked to OUs to centralize the settings for various users or computers across an organization.
When people say "Active Directory" they typically are referring to "Active Directory Domain Services." It is important to note that there are other Active Directory roles/products such as Certificate Services, Federation Services, Lightweight Directory Services, Rights Management Services, etc. This answer refers specifically to Active Directory Domain Services.
What is a domain and what is a forest?
A forest is a security boundary. Objects in separate forests are not able to interact with each other, unless the administrators of each separate forest create a trust between them. For example, an Enterprise Administrator account for
domain1.com
, which is normally the most privileged account of a forest, will have, no permissions at all in a second forest nameddomain2.com
, even if those forests exist within the same LAN, unless there is a trust in place.If you have multiple disjoint business units or have the need for separate security boundaries, you need multiple forests.
A domain is a management boundary. Domains are part of a forest. The first domain in a forest is known as the forest root domain. In many small and medium organizations (and even some large ones), you will only find a single domain in a single forest. The forest root domain defines the default namespace for the forest. For example, if the first domain in a new forest is named
domain1.com
, then that is the forest root domain. If you have a business need for a child domain, for example - a branch office in Chicago, you might name the child domainchi
. The FQDN of the child domain would bechi.domain1.com
. You can see that the child domain's name was prepended forest root domain's name. This is typically how it works. You can have disjoint namespaces in the same forest, but that's a whole separate can of worms for a different time.In most cases, you'll want to try and do everything possible to have a single AD domain. It simplifies management, and modern versions of AD make it very easy to delegate control based on OU, which lessens the need for child domains.
I can name my domain whatever I want, right?
Not really.
dcpromo.exe
, the tool that handles the promotion of a server to a DC isn't idiot-proof. It does let you make bad decisions with your naming, so pay attention to this section if you are unsure. (Edit: dcpromo is deprecated in Server 2012. Use theInstall-ADDSForest
PowerShell cmdlet or install AD DS from Server Manager.)First of all, don't use made up TLDs like .local, .lan, .corp, or any of that other crap. Those TLDs are not reserved. ICANN is selling TLDs now, so your
mycompany.corp
that you're using today could actually belong to someone tomorrow. If you ownmycompany.com
, then the smart thing to do is use something likeinternal.mycompany.com
orad.mycompany.com
for your internal AD name. If you usemycompany.com
as an externally resolvable website, you should avoid using that as your internal AD name as well, since you'll end up with a split-brain DNS.Domain Controllers and Global Catalogs
A server that responds to authentication or authorization requests is a Domain Controller (DC). In most cases, a Domain Controller will hold a copy of the Global Catalog. A Global Catalog (GC) is a partial set of objects in all domains in a forest. It is directly searchable, which means that cross-domain queries can usually be performed on a GC without needing a referral to a DC in the target domain. If a DC is queried on port 3268 (3269 if using SSL), then the GC is being queried. If port 389 (636 if using SSL) is queried, then a standard LDAP query is being used and objects existing in other domains may require a referral.
When a user tries to log in to a computer that is joined to AD using their AD credentials, the salted and hashed username and password combination are sent to the DC for both the user account and the computer account that are logging in. Yes, the computer logs in too. This is important, because if something happens to the computer account in AD, like someone resets the account or deletes it, you may get an error that say that a trust relationship doesn't exist between the computer and the domain. Even though your network credentials are fine, the computer is no longer trusted to log into the domain.
Domain Controller Availability Concerns
I hear "I have a Primary Domain Controller (PDC) and want to install a Backup Domain Controller (BDC)" much more frequently that I would like to believe. The concept of PDCs and BDCs died with Windows NT4. The last bastion for PDCs was in a Windows 2000 transitional mixed mode AD when you still had NT4 DCs around. Basically, unless you're supporting a 15+ year old install that has never been upgraded, you really don't have a PDC or a BDC, you just have two domain controllers.
Multiple DCs are capable of answering authentication requests from different users and computers simultaneously. If one fails, then the others will continue to offer authentication services without having to make one "primary" like you would have had to do in the NT4 days. It is best practice to have at least two DCs per domain. These DCs should both hold a copy of the GC and should both be DNS servers that hold a copy of the Active Directory Integrated DNS zones for your domain as well.
FSMO Roles
I hear this a lot. There is a PDC Emulator role. It's different than being a PDC. In fact, there are 5 Flexible Single Master Operations roles (FSMO). These are also called Operations Master roles as well. The two terms are interchangeable. What are they and what do they do? Good question! The 5 roles and their function are:
Domain Naming Master - There is only one Domain Naming Master per forest. The Domain Naming Master makes sure that when a new domain is added to a forest that it is unique. If the server holding this role is offline, you won't be able to make changes to the AD namespace, which includes things like adding new child domains.
Schema Master - There is only one Schema Operations Master in a forest. It is responsible for updating the Active Directory Schema. Tasks that require this, such as preparing AD for a new version of Windows Server functioning as a DC or the installation of Exchange, require Schema modifications. These modifications must be done from the Schema Master.
Infrastructure Master - There is one Infrastructure Master per domain. If you only have a single domain in your forest, you don't really need to worry about it. If you have multiple forests, then you should make sure that this role is not held by a server that is also a GC holder unless every DC in the forest is a GC. The infrastructure master is responsible for making sure that cross-domain references are handled properly. If a user in one domain is added to a group in another domain, the infrastructure master for the domains in question make sure that it is handled properly. This role will not function correctly if it is on a global catalog.
RID Master - The Relative ID Master (RID Master) is responsible for issuing RID pools to DCs. There is one RID master per domain. Any object in an AD domain has a unique Security Identifier (SID). This is made up of a combination of the domain identifier and a relative identifier. Every object in a given domain has the same domain identifier, so the relative identifier is what makes objects unique. Each DC has a pool of relative IDs to use, so when that DC creates a new object, it appends a RID that it hasn't used yet. Since DCs are issued non-overlapping pools, each RID should remain unique for the duration of the life of the domain. When a DC gets to ~100 RIDs left in its pool, it requests a new pool from the RID master. If the RID master is offline for an extended period of time, object creation may fail.
PDC Emulator - Finally, we get to the most widely misunderstood role of them all, the PDC Emulator role. There is one PDC Emulator per domain. If there is a failed authentication attempt, it is forwarded to the PDC Emulator. The PDC Emulator functions as the "tie-breaker" if a password was updated on one DC and hasn't yet replicated to the others. The PDC Emulator is also the server that controls time sync across the domain. All other DCs sync their time from the PDC Emulator. All clients sync their time from the DC that they logged in to. It's important that everything remain within 5 minutes of each other, otherwise Kerberos breaks and when that happens, everyone cries.
The important thing to remember is that the servers that these roles run on is not set in stone. It's usually trivial to move these roles around, so while some DCs do slightly more than others, if they go down for short periods of time, everything will usually function normally. If they're down for a long time, it's easy to transparently transfer the roles. It's much nicer than the NT4 PDC/BDC days, so please stop calling your DCs by those old names. :)
So, um...how do the DCs share information if they can function independently of each other?
Replication, of course. By default, DCs belonging to the same domain in the same site will replicate their data to each other at 15 second intervals. This makes sure that everything is relatively up to date.
There are some "urgent" events that trigger immediate replication. These events are: An account is locked out for too many failed logins, a change is made to the domain password or lockout policies, the LSA secret is changed, the password is changed on a DC's computer account, or the RID Master role is transferred to a new DC. Any of these events will trigger an immediate replication event.
Password changes fall somewhere between urgent and non-urgent and are handled uniquely. If a user's password is changed on
DC01
and a user tries to log into a computer that is authenticating againstDC02
before replication occurs, you'd expect this to fail, right? Fortunately that doesn't happen. Assume that there is also a third DC here calledDC03
that holds the PDC Emulator role. WhenDC01
is updated with the user's new password, that change is immediately replicated toDC03
also. When thee authentication attempt onDC02
fails,DC02
then forwards that authentication attempt toDC03
, which verifies that it is, indeed, good, and the logon is allowed.Let's talk about DNS
DNS is critical to a properly functioning AD. The official Microsoft party line is that any DNS server can be used if it is set up properly. If you try and use BIND to host your AD zones, you're high. Seriously. Stick with using AD Integrated DNS zones and use conditional or global forwarders for other zones if you must. Your clients should all be configured to use your AD DNS servers, so it's important to have redundancy here. If you have two DCs, have them both run DNS and configure your clients to use both of them for name resolution.
Also, you're going to want to make sure that if you have more than one DC, that they don't list themselves first for DNS resolution. This can lead to a situation where they are on a "replication island" where they are disconnected from the rest of the AD replication topology and cannot recover. If you have two servers
DC01 - 10.1.1.1
andDC02 - 10.1.1.2
, then their DNS server list should be configured like this:OK, this seems complicated. Why do I want to use AD at all?
Because once you know what you're doing, you life becomes infinitely better. AD allows for the centralization of user and computer management, as well as the centralization of resource access and usage. Imagine a situation where you have 50 users in an office. If you wanted each user to have their own login to each computer, you'd have to configure 50 local user accounts on each PC. With AD, you only have to made the user account once and it can log into any PC on the domain by default. If you wanted to harden security, you'd have to do it 50 times. Sort of a nightmare, right? Also imagine that you have a file share that you only want half of those people to get to. If you're not using AD, you'd either need to replicate their username and passwords by hand on the server to give seemless access, or you'd have to make a shared account and give each user the username and password. One way means that you know (and have to constantly update) users' passwords. The other way means that you have no audit trail. Not good, right?
You also get the ability to use Group Policy when you have AD set up. Group Policy is a set of objects that are linked to OUs that define settings for users and/or computers in those OUs. For example, if you want to make it so that "Shutdown" isn't on the start menu for 500 lab PCs, you can do that in one setting in Group Policy. Instead of spending hours or days configuring the proper registry entries by hand, you create a Group Policy Object once, link it to the correct OU or OUs, and never have to think about it again. There are hundreds of GPOs that can be configured, and the flexibility of Group Policy is one of the major reasons that Microsoft is so dominant in the enterprise market.
Note: This answer was merged into this question from a different question that asked about the differences between forests, child domains, trees, sites, and OUs. This was not originally written as an answer to this specific question.
Forest
You want to create a new forest when you need a security boundary. For example, you may have a perimeter network (DMZ) that you wish to manage with AD, but you don't want your internal AD available in the perimeter network for security reasons. In this case, you would want to create a new forest for that security zone. You may also want this separation if you have multiple entities that do not trust each other - for example a shell corporation that encompasses individual businesses that operate independently. In this case, you'd want each entity to have its own forest.
Child Domain
Really, you don't need these any more. There are few good examples of when you would want a child domain. A legacy reason is because of different password policy requirements, but this is no longer valid, as there are Fine-Grained Password Policies available since Server 2008. You really only need a child domain if you have areas with incredible poor network connectivity and you want to drastically reduce replication traffic - a cruise ship with satellite WAN connectivity is a good example. In this case, each cruise ship may be its own child domain, so as to be relatively self-contained while still being able to leverage the benefits of being in the same forest as other domains from the same company.
Tree
This is an odd-ball. New trees are used when you want to maintain the management benefits of a single forest but have a domain in a new DNS namespace. For example
corp.example.com
may be the forest root, but you could havead.mdmarra.com
in the same forest using a new tree. The same rules and recommendations for child domains apply here - use them sparingly. They're usually not needed in modern ADs.Site
A site should represent physical or logical boundary in your network. For example, branch offices. Sites are used to intelligently select replication partners for domain controllers in different areas. Without defining sites, all DCs will be treated as if they were in the same physical location and replicate in a mesh topology. In practice, most organizations are configured in a hub-and-spoke logically, so sites and services should be configured to reflect this.
Other applications also use Sites and Services. DFS uses it for namespace referrals and replication partner selection. Exchange and Outlook use it to find the "nearest" global catalog to query. Your domain-joined computers use it to locate the "nearest" DC(s) to authenticate against. Without this, your replication and authentication traffic are like the Wild West.
Organizational Unit
These should be created in a way that reflects your organization's need for delegation of permission and group policy application. Many organizations have one OU per site, because they apply GPO that way - this is silly, because you can apply GPO to a site from Sites and Services as well. Other organizations separate OUs by department or function. This makes sense for many people, but really OU design should meet your needs and is rather flexible. There's no "one way" to do it.
A multinational company may have top-level OUs of
North America
,Europe
,Asia
,South America
,Africa
so that they can delegate administrative privileges based on continent. Other organizations may have top-level OUs ofHuman Resources
,Accounting
,Sales
, etc if that makes more sense for them. Other organizations have minimal policy needs and use a "flat" layout with justEmployee Users
andEmployee Computers
. There's really no right answer here, it's whatever meets your company's needs.