AWS Builder Center

AD Connector Overview

This article provides a deep dive into AD Connector's functionality, including how it discovers domain controllers

Series: AD Connector and WorkSpaces (4 articles)

  1. 1
    AD Connector Overview This article

AD Connector - Overview, Setup & Troubleshooting

When setting up AD Connector, it helps to understand the process it goes through to set up and maintain a connection to your Active Directory. This article is an overview of that process, plus troubleshooting notes.



Prerequisites

Follow all prerequisites in the  AD Connector prerequisites guide . Especially important call-outs:
  • Perform the privilege-delegation steps correctly for the account you use as your Service Account.
  • You cannot have any Read Only Domain Controllers (RODCs). AD Connector will not automatically choose another DC if the DC that wins the election process is an RODC.
  • You must have the  DisableVLVSupport  LDAP attribute set to  0  on your domain controllers (this is a default setting). If enabled, AD Connector cannot query users in your directory, which prevents it from being usable with WorkSpaces.



When does a full AD Connector DC Discovery process happen?

  • Initial setup of the AD Connector.
  • Every 15 minutes (starting from creation time of the directory).
  • Every time the DNS IP address of AD Connector is changed.
  • Every time the currently elected Domain Controller is unhealthy, as determined by TCP connections to ports 88 and 389 failing.



Domain Controller Discovery

High-level summary

  • The LDAP and Kerberos SRV DNS records for your specified FQDN are looked up, using the DNS IP address supplied.
  • The resulting list of domain controllers is checked for connectivity on ports 88/389.
  • If a responding DC is from the same AD Site as the AD Connector, that DC is used. Otherwise, AD Connector attempts to find a DC in the same Site. If it can't, it iterates through SRV records.- AD Connector will attempt to connect to a maximum of 12 domain controllers per site. If a Site has >12 DCs but ADC can't reach them (stale DNS records, or firewalls blocking ADC), AD Connector marks the entire Site as invalid and stops attempting DCs in that Site.
  • Out of the DCs tested, the fastest DC is identified and used for all AD operations until the next DC election (at most every 15 minutes).

Detailed summary

  1. The IP address(es) supplied in the "DNS IP Addresses" field are queried for the SRV record values of  _ldap._tcp.$yourdomainFQDN  and  _kerberos._tcp.$yourdomainFQDN .
  1. The resulting lists from each query are compared. Any entries that don't appear in both lists are pruned.
  1. The two AD Connector instances iterate through the remaining list of DCs. They first check on the basis of AD Sites: if the initial DC queried is in the same site as the AD Connector, it is chosen. Otherwise ADC tries to find a DC in the same client site and select it; failing that, it goes to the next DC found via SRV records.- AD Connector keeps track of the Site of each DC it queries. Once it has rejected 12 DCs in the same Site, it discontinues using that Site for the remainder of the Discovery cycle. This can happen with many stale SRV entries, many firewalled DCs, or many unhealthy DCs.
  1. If AD Connector cannot find a suitable DC via Sites, the winning DC is chosen purely on latency.

Other things to know

  • AD Connector is composed of two back-end EC2 instances, one in each designated AZ. One instance iterates through your DC list in A→Z name order, the other in Z→A order, to reduce the odds they favor the same DC.
  • The timeout for the TCP ping tests is 5 seconds; the timeout for the AD connectivity tests is 10 seconds, per DC. Discovery is fast in a small forest but can take time in a large forest.
  • Stale SRV DNS records, or many DCs that ADC cannot access due to firewalls, can make the process take much longer.
  • The actual AD tests use  net ads lookup -S $DOMAINCONTROLLERIP  to get DC info such as whether the DC is close and what Site it is in.
Example output of such a test against a DC in a  us-west-2  VPC (from an Amazon Linux 2 WorkSpace, using the same tooling an AD Connector instance uses):
[CORP\danl@a-36h0rxcpqvkcq ~]$ net ads lookup -S 10.1.2.20
Information for Domain Controller: 10.1.2.20
Response Type: LOGON_SAM_LOGON_RESPONSE_EX
GUID: c9602fc5-cd1d-491e-8076-2f96795f96d8
Flags:
Is a PDC: no
Is a GC of the forest: yes
Is an LDAP server: yes
Supports DS: yes
Is running a KDC: yes
Is running time services: yes
Is the closest DC: no
Is writable: yes
Has a hardware clock: no
Is a non-domain NC serviced by LDAP server: no
Is NT6 DC that has some secrets: no
Is NT6 DC that has all secrets: yes
Runs Active Directory Web Services: yes
Runs on Windows 2012 or later: yes
Forest: corp.example.com
Domain: corp.example.com
Domain Controller: EC2AMAZ-NMS6DM7.corp.example.com
Pre-Win2k Domain: CORP
Pre-Win2k Hostname: EC2AMAZ-NMS6DM7
Server Site Name: IAD
Client Site Name: PDX
NT Version: 5
LMNT Token: ffff
LM20 Token: ffff




LDAP / Kerberos DNS info

When you create your AD Connector you are asked for the DNS IP Addresses. These are commonly domain controllers, but do not have to be. They are also sometimes mistaken for the fixed IP address that AD Connector will use with your domain, but that isn't directly true — AD Connector takes the IP address and uses it to perform DNS discovery of your domain.
Example: an "on-premises" domain  corp.example.com  set up in two AWS regions (PDX and IAD) connected by a VPC Peering Connection. PDX (10.0.0.0/16) has two DCs (10.0.2.251, 10.0.0.108); IAD (10.1.0.0/16) has one DC (10.1.2.20). Setting up an AD Connector in PDX, on Step 4 of the wizard you supply:
  • Directory DNS name:  corp.example.com 
  • Directory NetBIOS name:  CORP 
  • DNS IP addresses:  10.0.2.251, 10.0.0.108 
  • Service account username / password: your service account's AD credentials
With this info, the AD Connector DC Locator process finds a DC to bind to. On the ADC back-end instances, DNS resolution via  host  looks for the Kerberos and LDAP SRV records for your Directory DNS name, using the supplied IPs. You can validate the results from Windows with  nslookup :
nslookup -type=srv _ldap._tcp.YOURDOMAINFQDN
nslookup -type=srv _kerberos._tcp.YOURDOMAINFQDN

For the example domain:
PS C:\Users\Administrator> nslookup -type=srv _ldap._tcp.corp.example.com
Server: ip-10-0-2-251.us-west-2.compute.internal
Address: 10.0.2.251
_ldap._tcp.corp.example.com SRV service location:
priority = 0
weight = 100
port = 389
svr hostname = dc1.corp.example.com
_ldap._tcp.corp.example.com SRV service location:
priority = 0
weight = 100
port = 389
svr hostname = ec2amaz-nms6dm7.corp.example.com
_ldap._tcp.corp.example.com SRV service location:
priority = 0
weight = 100
port = 389
svr hostname = ec2amaz-j1ql8qp.corp.example.com
dc1.corp.example.com internet address = 10.0.2.251
ec2amaz-nms6dm7.corp.example.com internet address = 10.1.2.20
ec2amaz-j1ql8qp.corp.example.com internet address = 10.0.0.108






Series: AD Connector and WorkSpaces (4 articles)

  1. 1
    AD Connector Overview This article
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article