Core Windows Service Ports
| Service | Port(s) | Protocol | Notes |
|---|---|---|---|
| RDP (Remote Desktop) | 3389 | TCP / UDP | UDP 3389 used for enhanced RDP (UDP transport introduced in Windows 8/Server 2012). Commonly targeted; change default port or restrict with firewall rules. |
| SMB (File Sharing) | 445 | TCP | Direct SMB over TCP. Used for file shares, print shares, Group Policy application, and DFS. Block at perimeter — never expose 445 to the internet. |
| NetBIOS over TCP/IP | 137, 138, 139 | TCP/UDP | Legacy name resolution (137 UDP/TCP), datagram (138 UDP), session (139 TCP). SMB over 139 is the older pre-Win2000 path. Disable NetBIOS on modern networks where possible. |
| WinRM (HTTP) | 5985 | TCP | Windows Remote Management — used by PowerShell Remoting, Ansible, and remote management tools. Unencrypted; use only on trusted networks or pair with HTTPS. |
| WinRM (HTTPS) | 5986 | TCP | Encrypted WinRM. Requires a certificate on the target machine. Preferred over 5985 for any cross-segment traffic. |
| DNS | 53 | TCP / UDP | UDP for most queries; TCP for zone transfers and responses over 512 bytes (DNS over TCP). Both must be open to DNS servers from clients. Block outbound 53 UDP to non-approved resolvers to prevent DNS exfiltration. |
| DHCP (Server) | 67 | UDP | DHCP server listens on 67. Clients broadcast from 68. DHCP traffic is local-segment broadcast; DHCP relay agents forward across subnets. |
| DHCP (Client) | 68 | UDP | Client-side DHCP port for offer/ack traffic from the server. |
| LDAP | 389 | TCP / UDP | Active Directory LDAP queries. Unencrypted. Used for domain authentication, user lookups, and Group Policy. Should be restricted to internal networks. |
| LDAPS (LDAP over SSL) | 636 | TCP | Encrypted LDAP. Requires a Domain Controller certificate. Preferred over 389 for any LDAP traffic crossing network boundaries. |
| Global Catalog LDAP | 3268 | TCP | Global Catalog LDAP (unencrypted) — searched during cross-domain forest lookups. |
| Global Catalog LDAPS | 3269 | TCP | Encrypted Global Catalog LDAP. |
| Kerberos | 88 | TCP / UDP | Domain authentication. UDP for tickets up to 1500 bytes; TCP for larger tickets (common with many group memberships). Must be open from all domain members to Domain Controllers. |
| Kerberos Password Change | 464 | TCP / UDP | Kerberos kpasswd — used during password changes and trust operations. |
| NTP (Time Sync) | 123 | UDP | Network Time Protocol. Critical for Kerberos — a clock skew of more than 5 minutes between client and DC causes authentication failures. Domain members sync to DC; DCs sync to an external NTP source. |
| RPC Endpoint Mapper | 135 | TCP | RPC dynamic port negotiation — clients contact 135 first to discover which dynamic high port the RPC service is actually listening on. Required for AD replication, DFS, WMI, and many other services. |
| RPC Dynamic Ports | 49152–65535 | TCP | Default dynamic RPC port range (Windows Vista+). Can be restricted to a narrower range via Group Policy: Computer Configuration → Windows Settings → Security Settings → Windows Firewall → RPC TCP port range. |
| WMI / DCOM | 135 + dynamic | TCP | WMI uses RPC — initial connection on 135, then shifts to a negotiated dynamic port. For firewall environments, fix the WMI port range or use a management proxy that relays WMI over a fixed port. |
| WSUS (HTTP) | 8530 | TCP | WSUS client communication over HTTP. Configured in Group Policy under Windows Update → Specify intranet Microsoft update service location. |
| WSUS (HTTPS) | 8531 | TCP | WSUS over SSL. Requires a certificate on the WSUS server. Recommended for production WSUS deployments. |
| SQL Server | 1433 | TCP | Default SQL Server instance. Named instances use dynamic ports (discovered via SQL Server Browser on UDP 1434). Always firewall 1433 to only the application servers and management hosts that require access. |
| SQL Server Browser | 1434 | UDP | SQL Server Browser service — returns the port for named instances. Disable if using only the default instance with a fixed port. |
Microsoft 365 and Exchange Ports
| Service | Port(s) | Protocol | Notes |
|---|---|---|---|
| SMTP (outbound mail) | 25 | TCP | Server-to-server SMTP. Block outbound 25 from end-user workstations to prevent spam relay. Exchange Online uses 25 for inbound MX delivery. |
| SMTP Submission | 587 | TCP | Authenticated SMTP submission (STARTTLS). Used by mail clients and applications sending through Exchange Online. Preferred over 25 for outbound application mail. |
| SMTPS | 465 | TCP | Legacy SMTP over SSL — deprecated by RFC but still required by some older devices (printers, scanners). Exchange Online accepts connections on 587 (preferred) and 465. |
| IMAP | 993 | TCP | IMAP over SSL — used by non-Outlook mail clients connecting to Exchange Online. Disable via Exchange Online PowerShell if not needed to reduce attack surface. |
| POP3 | 995 | TCP | POP3 over SSL. Rarely needed on modern M365 tenants — disable unless a specific application requires it. |
| HTTPS (M365 services) | 443 | TCP | All modern Microsoft 365 services including Outlook, Teams, SharePoint, OneDrive, Entra ID authentication, and Intune MDM. Microsoft publishes the full list of required URLs and IPs at aka.ms/o365endpoints. |
| Teams Media (STUN/TURN) | 3478–3481 | UDP | Microsoft Teams audio/video transport. Also falls back to TCP 443 if UDP is blocked. UDP path gives significantly lower latency — do not block these ports on office firewalls. |
| Azure AD Connect | 443, 9090, 9091, 9192, 9350–9354 | TCP | Outbound ports required from the Azure AD Connect server to Azure. 443 handles most traffic; the higher ports are used by the Service Bus relay for pass-through authentication agents. |
Checking Open Ports with netstat
To see which ports are currently listening on the local machine, use netstat from an elevated Command Prompt or PowerShell:
rem Show all listening TCP ports with owning process IDs
netstat -ano | findstr LISTENING
rem Show all active connections and listening ports (TCP and UDP)
netstat -ano
rem Resolve PIDs to process names (run in PowerShell)
netstat -ano | Select-String LISTENINGTo cross-reference a PID with a process name:
rem Replace 1234 with the PID from netstat output
tasklist /fi "PID eq 1234"Checking Remote Port Connectivity with Test-NetConnection
Test-NetConnection is the PowerShell replacement for telnet and is built into Windows 8.1 and Server 2012 R2+. It confirms whether a remote TCP port is reachable from the current machine:
# Test if RDP port is reachable on a remote server
Test-NetConnection -ComputerName SRV-DC01 -Port 3389
# Test SMB
Test-NetConnection -ComputerName FILESERVER01 -Port 445
# Test LDAP on a Domain Controller
Test-NetConnection -ComputerName SRV-DC01 -Port 389
# Test SQL Server
Test-NetConnection -ComputerName SRV-SQL01 -Port 1433
# Test HTTPS connectivity to Exchange Online
Test-NetConnection -ComputerName smtp.office365.com -Port 587A successful result shows TcpTestSucceeded : True. A failure shows False — this means either the service is not listening, a firewall is blocking the port, or a network route does not exist between the two machines.
For a quick port sweep against a server to map which services are responding:
$server = "SRV-DC01"
$ports = @(53, 88, 135, 389, 445, 464, 636, 3268, 3269, 3389)
foreach ($port in $ports) {
$result = Test-NetConnection -ComputerName $server -Port $port -WarningAction SilentlyContinue
[PSCustomObject]@{
Port = $port
Result = if ($result.TcpTestSucceeded) { "OPEN" } else { "CLOSED/FILTERED" }
}
} | Format-Table -AutoSizeChecking What's Listening on a Specific Port
To identify which process is using a port on the local machine — useful for diagnosing port conflicts:
# Find what's listening on port 443 (replace 443 with any port)
$port = 443
$connection = Get-NetTCPConnection -LocalPort $port -State Listen -ErrorAction SilentlyContinue
if ($connection) {
$pid = $connection.OwningProcess
Get-Process -Id $pid | Select-Object Id, ProcessName, Path
} else {
Write-Host "Nothing listening on port $port" -ForegroundColor Yellow
}Restricting RPC Dynamic Ports via Registry
For environments where firewall rules must cover RPC traffic without opening the full 49152–65535 range, you can restrict RPC to a narrower dynamic port range. This requires a registry edit and a reboot:
rem Set RPC dynamic port range to 50000-51000 (adjust as needed, minimum 255 ports)
reg add "HKLM\SOFTWARE\Microsoft\Rpc\Internet" /v Ports /t REG_MULTI_SZ /d "50000-51000" /f
reg add "HKLM\SOFTWARE\Microsoft\Rpc\Internet" /v PortsInternetAvailable /t REG_SZ /d Y /f
reg add "HKLM\SOFTWARE\Microsoft\Rpc\Internet" /v UseInternetPorts /t REG_SZ /d Y /fAfter applying the registry change, the corresponding firewall rule must allow TCP inbound on the same restricted range on servers that receive RPC connections (Domain Controllers, file servers, print servers).
Need Help?
Melbits manages IT infrastructure and network security for Melbourne businesses. If you need a firewall audit, Active Directory port review, or help configuring network segmentation to reduce your attack surface, contact us. We design and document Windows network environments that are both functional and secure.