Configuring firewall access control lists (ACLs) and network security groups (NSGs) for an on-premises Microsoft Exchange Server deployment has evolved dramatically. With the retirement of separate Client Access Server (CAS) roles in favor of the consolidated Mailbox role architecture in Exchange Server Subscription Edition (SE) and Exchange Server 2019, legacy port requirements have been simplified—while modern security controls like Extended Protection (EPA), MAPI over HTTP, and Inbound SMTP DANE introduce new networking imperatives.
In this updated enterprise reference, we provide the definitive network port matrix categorized by traffic zone, examine DAG and Active Directory communication paths, and share an automated PowerShell script to smoke-test all required firewall ports across your topology.
Architecture Overview: Consolidated Mailbox Server Traffic
In Exchange Server SE and 2019, the Mailbox server role handles all client connections, mail transport, database availability group replication, and directory lookups.
Network communication breaks down into four primary zones:
- Client to Mailbox Server (Perimeter / LAN): HTTPS (TCP 443) dominates client communications (Outlook, OWA, ActiveSync, EWS, and Autodiscover). Legacy MAPI RPC direct ports are eliminated in favor of MAPI-over-HTTP.
- Mail Flow & SMTP Routing (Internet / Edge / Cloud): SMTP (TCP 25) for server-to-server relay; secure client submission via Submission (TCP 587).
- Database Availability Group (DAG) Replication: Dedicated replication network utilizing TCP 64327 for log shipping and database seeding.
- Exchange to Active Directory (Intranet): Kerberos (TCP 88), LDAP (TCP 389/636), Global Catalog (TCP 3268/3269), and DNS (TCP/UDP 53).
The Complete Exchange Server SE & 2019 Port Matrix
1. Inbound Client Traffic (Firewall / Load Balancer to Exchange)
| Port | Protocol | Purpose / Description |
|---|---|---|
| 443 | TCP | HTTPS: Primary channel for Outlook (MAPI/HTTP), OWA, ECP, EWS, ActiveSync, Autodiscover, and OAB. |
| 25 | TCP | SMTP: Inbound internet email delivery from external MTAs or Exchange Online Protection (EOP). |
| 587 | TCP | Authenticated SMTP Submission: Client message submission via TLS (printers, scanners, line-of-business apps). |
| 993 | TCP | IMAP4 over SSL/TLS: Secure IMAP client access. |
| 995 | TCP | POP3 over SSL/TLS: Secure POP3 client access. |
2. Internal Server-to-Server & DAG Traffic
| Port | Protocol | Purpose / Description |
|---|---|---|
| 64327 | TCP | DAG Replication & Log Shipping: Default port for the Exchange Replication service across DAG nodes. |
| 808 | TCP | Mailbox Replication Service (MRS Proxy): Net.TCP service used for cross-forest and hybrid mailbox migrations. |
| 2525 | TCP | Hub Transport Service: Internal inter-server mail delivery between Front End Transport and Mailbox Transport. |
| 135 | TCP | RPC Endpoint Mapper: Required for server administration, cluster service, and initial RPC handshakes. |
| 49152–65535 | TCP | RPC Dynamic High Ports: Allocated by RPC Endpoint Mapper for MAPI internal services and cluster heartbeats. |
3. Exchange to Active Directory Domain Controllers
| Port | Protocol | Purpose / Description |
|---|---|---|
| 53 | TCP/UDP | DNS: Domain name resolution for Active Directory and internal MX lookups. |
| 88 | TCP/UDP | Kerberos: User and service ticket authentication. |
| 389 / 636 | TCP/UDP | LDAP / LDAPS: Directory search queries and secure directory authentication. |
| 3268 / 3269 | TCP | Global Catalog (GC / GCS): Forest-wide recipient queries and universal group resolution. |
| 445 | TCP | SMB: Policy propagation and Group Policy processing. |
| 123 | UDP | NTP: Windows Time synchronization (must be under 5 minutes variance for Kerberos). |
Automated PowerShell Script: Verifying Required Ports
Run this automated PowerShell diagnostic script on your Exchange server or staging jumpbox to test end-to-end connectivity across all required ports:
# Script: Test-ExchangePortConnectivity.ps1
# Description: Verifies TCP port accessibility between Exchange, Domain Controllers, and Cloud Gateways
param (
[string]$TargetDC = "dc01.lab365.in",
[string]$DagPeer = "ex02.lab365.in",
[string]$CloudMTA = "lab365-in.mail.protection.outlook.com"
)
$Tests = @(
@{ Name = "Active Directory LDAP"; Host = $TargetDC; Port = 389 },
@{ Name = "Active Directory Kerberos"; Host = $TargetDC; Port = 88 },
@{ Name = "Global Catalog"; Host = $TargetDC; Port = 3268 },
@{ Name = "DAG Log Shipping"; Host = $DagPeer; Port = 64327 },
@{ Name = "MRS Proxy Migration"; Host = $DagPeer; Port = 808 },
@{ Name = "Exchange Online SMTP Relay"; Host = $CloudMTA; Port = 25 },
@{ Name = "Microsoft 365 HTTPS Gateway"; Host = "outlook.office365.com"; Port = 443 }
)
Write-Host "`n=== TESTING EXCHANGE SERVER NETWORK PORT CONNECTIVITY ===" -ForegroundColor Cyan
$Results = foreach ($t in $Tests) {
Write-Host "Probing $($t.Name) ($($t.Host):$($t.Port))..." -NoNewline
$Check = Test-NetConnection -ComputerName $t.Host -Port $t.Port -WarningAction SilentlyContinue
if ($Check.TcpTestSucceeded) {
Write-Host " [PASS]" -ForegroundColor Green
} else {
Write-Host " [FAIL]" -ForegroundColor Red
}
[PSCustomObject]@{
Service = $t.Name
Host = $t.Host
Port = $t.Port
Reachable = $Check.TcpTestSucceeded
}
}
$Results | Format-Table -AutoSize
Summary Checklist for Network Engineers
- Eliminate Legacy RPC from External DMZ: Expose strictly TCP 443 to external reverse proxies/load balancers. Never publish RPC ports (135 or 49152-65535) to untrusted networks.
- Dedicated DAG NICs: Separate client HTTPS traffic from DAG replication traffic (TCP 64327) using isolated subnets and non-routable VLANs.
- Verify Hybrid SMTP: Allow bidirectional TCP 25 between Exchange on-premises and Microsoft 365 Exchange Online Protection (EOP) IP ranges.