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
Check port 636 on a server

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.

Ports used by LDAP and Active Directory directory services
PortProtocolServiceEncryption
389TCPLDAPNone, or StartTLS upgrade
389UDPCLDAP (connectionless LDAP, domain controller discovery)None
636TCPLDAPSTLS from the start
3268TCPGlobal Catalog (Active Directory)None, or StartTLS upgrade
3269TCPGlobal Catalog over TLSTLS 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:

Core Active Directory domain controller ports
PortProtocolService
53TCP/UDPDNS
88TCP/UDPKerberos
135TCPRPC Endpoint Mapper
389TCP/UDPLDAP
445TCPSMB (Group Policy, SYSVOL)
464TCP/UDPKerberos password change
636TCPLDAPS
3268 / 3269TCPGlobal Catalog / over TLS
49152–65535TCPDynamic 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 636

Query 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 base

Inspect the LDAPS certificate

openssl s_client -connect dc01.example.com:636 -showcerts

Windows 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

LDAP errors and fixes
SymptomLikely causeFix
Can't contact LDAP serverPort blocked, wrong host, or ldap:// used against 636.Check the firewall and use ldaps:// for 636.
Certificate verify failedThe 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 requiredThe 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