Fix NTDS KCC event 1865 (unable to form a complete spanning tree, sites cannot be reached from the local site): find the ISTGs and bridgeheads, test the AD ports with PortQry, open the firewall and check the site links.
Home › Guides › KCC event 1865
Last updated 19 November 2026
Warning 1865 (source NTDS KCC) is logged on the inter-site topology generator (ISTG) domain controllers, every 15 minutes in Microsoft's example, usually together with error 1311 for the Configuration partition. AD replication doesn't work for some sites. Microsoft's cause: connectivity problems between the ISTG servers, for example a firewall blocking the ports. The fix:
repadmin /failcache and dcdiag /test:intersite.Event Type: Warning Event Source: NTDS KCC Event Category: Knowledge Consistency Checker Event ID: 1865 User: NT AUTHORITY\ANONYMOUS LOGON Description: The Knowledge Consistency Checker (KCC) was unable to form a complete spanning tree network topology. As a result, the following list of sites cannot be reached from the local site. Sites: CN=<sitename>,CN=Sites,CN=Configuration,DC=<domain>,DC=com
Event Type: Error Event Source: NTDS KCC Event Category: Knowledge Consistency Checker Event ID: 1311 User: NT AUTHORITY\ANONYMOUS LOGON Description: The Knowledge Consistency Checker (KCC) has detected problems with the following directory partition. Directory partition: CN=Configuration,DC=<domain>,DC=com
1865 also shows up next to replication errors such as 1722 (the RPC server is unavailable) and 8524 (DNS lookup failure); fix those first if repadmin reports them.
The KCC runs on every DC. Within a site it creates connection objects automatically; between sites, one KCC per site (the ISTG) builds the connections over the site links you define. Site links are logical paths, and when two sites share a site link the replication system creates connections between bridgehead servers in each site. By default all site links are transitive ("bridged"), so the KCC can route through common sites. If the KCC reviews existing connections and finds a failed DC, it builds temporary connections to other partners, and if every DC in a site is unavailable it creates connections from DCs in another site. When it can't reach some sites at all, it logs 1865 with the list.
Search with Ldp.exe (Base DN CN=Sites,CN=Configuration,DC=RootDomainName,DC=Com, filter (cn=NTDS Site Settings), scope Subtree, attribute interSiteTopologyGenerator) to get each site's ISTG. Then run:
dcdiag /test:intersite /e /q
The Intersite test locates and connects to the ISTGs and bridgehead servers, reports replication failures after triggering replication, checks that DCs in sites with inbound connections to the site are available, and reads the KCC overrides IntersiteFailuresAllowed and MaxFailureTimeForIntersiteLink under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NTDS\Parameters. /e tests all servers in the enterprise and /q prints only errors.
On each ISTG, repadmin /failcache lists the connection and link failures the KCC knows about for the bridgeheads in its site.
Microsoft's resolution is to use PortQry to troubleshoot connectivity to the bridgehead servers of the sites in event 1865. Run it from the ISTG or bridgehead in the local site toward a bridgehead in each unreachable site:
portqry -n hub-dc1.contoso.com -e 135 portqry -n hub-dc1.contoso.com -p both -e 389 portqry -n hub-dc1.contoso.com -o 88,135,389,445,3268
Parameters from the PortQry reference: -n is the name or IP to query (required), -p is tcp (default), udp or both, -e is one port (the default is 80, so always give it), -o is a comma-separated list with no spaces, and -r start:end is a range. PortQry sends service-specific queries, so a query to 135 returns registered RPC services and ports, and LDAP queries return domain and DC information.
| PortQry result | Meaning |
|---|---|
| LISTENING | A process is listening; PortQry got a response. |
| NOT LISTENING | Nothing is listening; PortQry got an ICMP destination unreachable / port unreachable message. |
| FILTERED | No response; the port is being filtered (a process may or may not be listening). TCP ports are tried three times and UDP ports once before PortQry reports this. |
FILTERED on a DC port across a site boundary is the firewall case Microsoft describes. Without PortQry, Test-NetConnection -ComputerName hub-dc1.contoso.com -Port 135 tests a single TCP port.
For Windows Server 2008 and later DCs, Microsoft's firewall article lists these server ports (clients use the dynamic range 49152-65535):
| Server port | Service |
|---|---|
| 135/TCP | RPC Endpoint Mapper |
| 49152-65535/TCP | RPC for LSA, SAM, NetLogon |
| 389/TCP/UDP | LDAP |
| 636/TCP | LDAP SSL |
| 3268/TCP | LDAP GC |
| 3269/TCP | LDAP GC SSL |
| 53/TCP/UDP | DNS |
| 88/TCP/UDP | Kerberos |
| 464/TCP/UDP | Kerberos password change |
| 445/TCP | SMB |
| 123/UDP | W32Time |
Windows Server 2008 moved the default dynamic port range from 1025-5000 (Windows Server 2003 and Windows 2000 DCs) to 49152-65535, and Microsoft's note is that "you must increase the RPC port range in your firewalls". The same table lists DFSR RPC and FRS RPC on the dynamic range too. If you have to restrict RPC to fixed ports, see the port restriction notes in the 1722 guide.
After opening the ports, wait for the next KCC run (1865 is logged every 15 minutes while the problem lasts) and check that the warning stops, that repadmin /failcache on the ISTG shows No Failures for the bridgeheads, and that dcdiag /test:intersite /e /q comes back clean. Microsoft's 1311 guidance is to wait two times the longest replication interval in the forest before judging a change.
1865 is a spanning tree warning, so a logical configuration problem can cause it too. Run repadmin /showism at the ISTG's console and look for covered sites with only -1:0:0 entries (orphaned, not in any site link). Also check whether Bridge all site links is on for a network that isn't fully routed, whether preferred bridgeheads are defined (Microsoft strongly recommends not to), and whether the site links are disjoint. Each of these is covered step by step in the event 1311 guide.
Look up 1865, 1311, 1308 and 1925 in the Windows Event ID Lookup, copy the portqry, Test-NetConnection, repadmin /failcache and dcdiag /test:intersite lines from the PowerShell Cheat Sheet, pull the site DNs out of the event text with the Regex Tester, check that firewall rules cover each bridgehead's subnet with the IPv4 Subnet Calculator or IPv6 Subnet Calculator, and identify a firewall or other device answering in a site from its MAC address with the MAC Vendor Lookup. Related guides: KCC event 1311, replication error 5 (access is denied), replication error 1722 and replication error 8524.
Clients rather than DCs missing from your sites (Netlogon 5807)? See Netlogon event 5807: clients not mapped to any site.
Every AD replication error code with its cause and fix: common Active Directory replication errors.
NTDS KCC event 1865 means the Knowledge Consistency Checker on the ISTG could not form a complete spanning tree network topology, so the sites listed in the event cannot be reached from the local site. AD replication with those sites is not working.
Microsoft's article names connectivity issues between the ISTG servers, for example a firewall blocking the ports. A site and site link configuration that does not match the network, such as orphaned or disjoint sites, can also stop the KCC from building a spanning tree.
The inter-site topology generator (ISTG) domain controllers, one per site. Find them by searching the NTDS Site Settings objects under CN=Sites in the Configuration partition for the interSiteTopologyGenerator attribute.
Run PortQry from the local ISTG or bridgehead to a bridgehead in each unreachable site, for example portqry -n hub-dc1.contoso.com -e 135, and repeat for 389, 88, 445, 3268 and the RPC range. FILTERED means no response came back, which usually points at a firewall.
Yes. Microsoft's 1865 article shows both on the ISTG: warning 1865 with the unreachable sites and error 1311 for the Configuration partition. Fix the connectivity first, then use the 1311 methods if the configuration itself is wrong.
Runbooks, checklists and helpdesk templates: IT Admin Packs on Gumroad.