Designing a secure, resilient enterprise network architecture for Exchange Server Subscription Edition (SE), Exchange 2019, or Exchange Online Hybrid requires a crystal-clear understanding of required network ports.
A single blocked port or an unconfigured RPC dynamic range between your Mailbox servers, Domain Controllers, or perimeter Edge Transport servers can break mail flow, prevent database failovers in a Database Availability Group (DAG), or cause mysterious Outlook connectivity prompts.
In this updated guide, we provide a complete, path-by-path firewall port matrix, an architectural flow diagram, and a PowerShell connectivity testing script for your pre-flight validation.
Microsoft's Core Rule for Internal Exchange Networks
Critical Rule: Microsoft does not support restricting, filtering, or altering network traffic via internal firewalls between internal Exchange Mailbox servers in the same organization. Internal Exchange servers require open, unrestricted RPC and IP communication with each other and with Active Directory Domain Controllers.
If an internal firewall must sit between Exchange servers and your corporate LAN, DMZ, or Microsoft 365, use the port matrices below.
Architectural Network Flow Diagram
HTTPS 443– MAPI/HTTP, OWA, EWSSMTP 587– Authenticated relayIMAP 993 / POP 995– Legacy (if used)
SMTP 25– Inter-server transportTCP 3343– Failover Cluster heartbeatsTCP 64327– Static DAG log replicationSMB 445– File Share Witness (FSW)
SMTP 25– Internet mail / EXO connectorsTCP 50636– EdgeSync secure LDAPHTTPS 443– Hybrid MRS & Free/Busy
1. Client-to-Exchange Mailbox Server Ports
These ports must be reachable from user workstations, mobile devices, and application relays to the internal or reverse-proxy Virtual IP (VIP):
| Protocol / Service | Port / Transport | Direction | Purpose |
|---|---|---|---|
| HTTPS | 443 / TCP | Client → Exchange | All modern client traffic: MAPI over HTTP, Outlook on the Web (OWA), EAC, Exchange ActiveSync (EAS), EWS, Autodiscover, and OAB downloads. |
| HTTP (Redirect) | 80 / TCP | Client → Exchange | Used solely to redirect plaintext http://mail.contoso.com requests to https://mail.contoso.com. |
| Authenticated SMTP | 587 / TCP | Client → Exchange | Client submission for modern applications and multifunction printers (Client Frontend Receive Connector). |
| Secure IMAP4 | 993 / TCP | Client → Exchange | Secure IMAP4 over TLS (only required if IMAP4 service is enabled). |
| Secure POP3 | 995 / TCP | Client → Exchange | Secure POP3 over TLS (only required if POP3 service is enabled). |
2. Exchange-to-Active Directory Domain Controller Ports
Exchange Mailbox servers query Active Directory constantly for directory lookups, authentication, and configuration routing. Ensure these ports are open to all DCs and Global Catalog (GC) servers:
| Service | Port / Transport | Purpose |
|---|---|---|
| DNS | 53 / TCP & UDP | Active Directory and SRV record lookups (_autodiscover._tcp). |
| Kerberos | 88 / TCP & UDP | User and computer authentication. |
| RPC Endpoint Mapper | 135 / TCP | Endpoint resolution for Active Directory RPC services. |
| SMB | 445 / TCP | Group policy retrieval and domain communication. |
| LDAP | 389 / TCP & UDP | Active Directory queries. |
| LDAP SSL | 636 / TCP | Secure Active Directory queries. |
| Global Catalog (GC) | 3268 / TCP | Forest-wide address book and recipient lookups. |
| Global Catalog SSL | 3269 / TCP | Secure forest-wide Global Catalog lookups. |
| RPC Dynamic Ports | 49152–65535 / TCP | Dynamic RPC ports negotiated via Endpoint Mapper for AD replication and Netlogon. |
3. Inter-Server Ports within a Database Availability Group (DAG)
When Exchange servers replicate transaction logs or manage cluster heartbeats inside a DAG:
| Service | Port / Transport | Direction | Purpose |
|---|---|---|---|
| SMTP Transport | 25 / TCP | Mailbox ↔ Mailbox | Routing messages between mailbox servers. |
| Cluster Service | 3343 / TCP & UDP | Mailbox ↔ Mailbox | Windows Server Failover Cluster (WSFC) health heartbeats. |
| File Share Witness | 445 / TCP | Mailbox → FSW Server | Accessing the cluster quorum file share witness. |
| Log Replication | Dynamic or 64327 / TCP | Mailbox ↔ Mailbox | Continuous Replication of transaction logs. By default, uses RPC dynamic ports. Can be statically pinned using Set-DatabaseAvailabilityGroup -ReplicationPort 64327. |
4. Edge Transport (DMZ) & EdgeSync Ports
If you operate an Edge Transport server in your perimeter network (DMZ) to filter incoming and outgoing Internet email:
| Communication Path | Port / Transport | Purpose |
|---|---|---|
| Internet → Edge Transport | 25 / TCP | Inbound Internet SMTP delivery. |
| Edge Transport → Internet | 25 / TCP | Outbound Internet SMTP delivery. |
| Edge ↔ Mailbox Servers | 25 / TCP | Internal SMTP transfer between Edge and internal Hub Transport. |
| Mailbox → Edge Transport | 50636 / TCP | EdgeSync Secure LDAP: The internal Mailbox server pushes recipient and configuration updates outbound to the Edge server's Active Directory Lightweight Directory Services (AD LDS) instance. |
Security Note: EdgeSync communication on port 50636 is strictly one-way outbound from internal Mailbox servers to the Edge Transport server. The Edge server never initiates connections back to internal AD or Mailbox servers on this port.
5. Exchange Online Hybrid Ports (Microsoft 365)
For coexistence and cross-premises communication with Exchange Online:
| Direction | Port / Transport | Purpose |
|---|---|---|
| Inbound from M365 | 25 / TCP | Inbound hybrid mail flow from Exchange Online Protection (EOP) connectors. |
| Outbound to M365 | 25 / TCP | Outbound hybrid mail flow sent to *.mail.protection.outlook.com. |
| Inbound from M365 | 443 / TCP | Inbound MRS (Mailbox Replication Service) proxy for mailbox migrations, hybrid free/busy lookups, and Autodiscover. |
| Outbound to M365 | 443 / TCP | Outbound calls to outlook.office365.com for OAuth authentication and cloud calendar availability. |
Pre-Flight Verification Script (PowerShell)
Before deploying a new Exchange server or opening a firewall change request, run this diagnostic script to verify port connectivity from the Exchange server to target DCs, DAG peers, or Edge servers:
function Test-ExchangePortMatrix {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string]$TargetHost,
[Parameter(Mandatory = $true)]
[ValidateSet("DomainController", "DAGPeer", "EdgeServer", "HybridClient")]
[string]$Role
)
$portProfiles = @{
"DomainController" = @(53, 88, 135, 389, 445, 636, 3268, 3269)
"DAGPeer" = @(25, 135, 445, 3343)
"EdgeServer" = @(25, 50636)
"HybridClient" = @(80, 443, 587)
}
$portsToTest = $portProfiles[$Role]
Write-Host "[*] Testing port connectivity from $env:COMPUTERNAME to $TargetHost (Profile: $Role)..." -ForegroundColor Cyan
$results = foreach ($port in $portsToTest) {
$test = Test-NetConnection -ComputerName $TargetHost -Port $port -WarningAction SilentlyContinue
[PSCustomObject]@{
TargetHost = $TargetHost
Port = $port
TcpTestOpen = $test.TcpTestSucceeded
LatencyMs = $test.PingReplyDetails.RoundtripTime
}
}
$results | Format-Table -AutoSize
return $results
}
# Example Usage:
# Test-ExchangePortMatrix -TargetHost "dc01.contoso.com" -Role DomainController
# Test-ExchangePortMatrix -TargetHost "ex02.contoso.com" -Role DAGPeer
# Test-ExchangePortMatrix -TargetHost "edge01.contoso.com" -Role EdgeServer