LDAP ports
LDAP Ports 389 and 636: LDAP, LDAPS and Global Catalog
LDAP listens on port 389 (TCP, plus UDP for connectionless LDAP), and LDAPS, which is LDAP inside TLS, listens on port 636. In Active Directory, the Global Catalog uses port 3268, and 3269 with TLS. Port 389 can also be encrypted with StartTLS. Use LDAPS on 636 or StartTLS on 389 for anything that sends passwords, and never expose LDAP to the internet.
- LDAP
- 389 / TCP, UDP
- LDAPS (TLS)
- 636 / TCP
- Global Catalog
- 3268 / TCP
- Global Catalog over TLS
- 3269 / TCP
- Expose to internet?
- No
Last updated:
LDAP port numbers
The Global Catalog holds a partial copy of every object in an Active Directory forest. Use 3268/3269 for forest-wide searches and 389/636 for full attributes within one domain.
| Port | Protocol | Service | Encryption |
|---|---|---|---|
| 389 | TCP | LDAP | None, or StartTLS upgrade |
| 389 | UDP | CLDAP (connectionless LDAP, domain controller discovery) | None |
| 636 | TCP | LDAPS | TLS from the start |
| 3268 | TCP | Global Catalog (Active Directory) | None, or StartTLS upgrade |
| 3269 | TCP | Global Catalog over TLS | TLS from the start |
StartTLS on 389 vs LDAPS on 636
Both encrypt the connection with TLS. StartTLS (RFC 4513) connects to 389 in plain text and then sends an Extended Operation to switch to TLS, so one port serves both encrypted and unencrypted clients. LDAPS negotiates TLS immediately on 636, like HTTPS, which makes it simpler to enforce at the firewall.
LDAPS was never formally standardized, but it is universally supported and remains the most common choice for applications that authenticate against Active Directory. Either way, the server needs a valid certificate that clients trust and that matches the host name they connect to.
Ports a domain controller needs
Clients and servers talking to Active Directory domain controllers need more than LDAP. Microsoft documents these core ports:
| Port | Protocol | Service |
|---|---|---|
| 53 | TCP/UDP | DNS |
| 88 | TCP/UDP | Kerberos |
| 135 | TCP | RPC Endpoint Mapper |
| 389 | TCP/UDP | LDAP |
| 445 | TCP | SMB (Group Policy, SYSVOL) |
| 464 | TCP/UDP | Kerberos password change |
| 636 | TCP | LDAPS |
| 3268 / 3269 | TCP | Global Catalog / over TLS |
| 49152–65535 | TCP | Dynamic RPC (replication, management) |
How to test LDAP and LDAPS ports
A successful TCP connection only proves the port is reachable. For LDAPS, also confirm the TLS certificate, because an untrusted or mismatched certificate is the most common reason binds fail.
Windows PowerShell
Test-NetConnection dc01.example.com -Port 389
Test-NetConnection dc01.example.com -Port 636Query the root DSE with ldapsearch
Anonymous root DSE queries are allowed by most servers and confirm that LDAP is answering, not just the port.
ldapsearch -H ldap://dc01.example.com:389 -x -b "" -s base
ldapsearch -H ldaps://dc01.example.com:636 -x -b "" -s baseInspect the LDAPS certificate
openssl s_client -connect dc01.example.com:636 -showcertsWindows GUI
ldp.exe (part of the AD DS tools) can connect to 389 or 636 with the SSL option and bind with a test account.
Securing LDAP ports
- Do not expose 389, 636, 3268 or 3269 to the internet. Applications in the cloud should reach the directory over a VPN or private link.
- Block UDP 389 at the network edge: connectionless LDAP is abused for DDoS reflection attacks.
- Require LDAP signing and channel binding on Active Directory domain controllers, as Microsoft recommends.
- Reject simple binds over unencrypted connections, so passwords never cross the network in clear text.
- Check which directory ports are visible from outside with the port scanner, using a custom list such as
389, 636, 3268, 3269.
Common LDAP connection problems
| Symptom | Likely cause | Fix |
|---|---|---|
| Can't contact LDAP server | Port blocked, wrong host, or ldap:// used against 636. | Check the firewall and use ldaps:// for 636. |
| Certificate verify failed | The client does not trust the issuing CA, or the name does not match. | Install the CA certificate on the client and connect with the name on the certificate. |
| Strong(er) authentication required | The server requires signing or TLS. | Use LDAPS or StartTLS, or enable signing in the client. |
| Invalid credentials (49) | Wrong DN or password, or an expired or locked account. | Test the account with ldapsearch or ldp.exe. |
LDAP port FAQ
Is LDAP port 389 or 636?
Plain LDAP and StartTLS use port 389. LDAPS (LDAP over TLS from the start) uses port 636.
Does LDAP use TCP or UDP?
LDAP uses TCP. UDP 389 is used only for connectionless LDAP, mainly for Active Directory domain controller discovery.
What is port 3268 used for?
Port 3268 is the Active Directory Global Catalog, which answers searches across all domains in a forest. Port 3269 is the same service over TLS.
Should I use LDAPS or StartTLS?
Both are secure. LDAPS on 636 is simpler to enforce and is widely supported by applications. StartTLS on 389 lets one port serve all clients, but you must make sure clients cannot skip the TLS upgrade.
Should port 389 be open to the internet?
No. Directory services should only be reachable on internal networks or through a VPN. Open LDAP servers leak data and are used in reflection attacks.
References
- RFC 4511: LDAP: The Protocol — the LDAPv3 specification.
- RFC 4513: LDAP Authentication Methods — defines StartTLS for LDAP.
- Microsoft Learn: Service overview and network port requirements for Windows — Active Directory port list.