Core Windows Service Ports

ServicePort(s)ProtocolNotes
RDP (Remote Desktop)3389TCP / UDPUDP 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)445TCPDirect 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/IP137, 138, 139TCP/UDPLegacy 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)5985TCPWindows Remote Management — used by PowerShell Remoting, Ansible, and remote management tools. Unencrypted; use only on trusted networks or pair with HTTPS.
WinRM (HTTPS)5986TCPEncrypted WinRM. Requires a certificate on the target machine. Preferred over 5985 for any cross-segment traffic.
DNS53TCP / UDPUDP 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)67UDPDHCP server listens on 67. Clients broadcast from 68. DHCP traffic is local-segment broadcast; DHCP relay agents forward across subnets.
DHCP (Client)68UDPClient-side DHCP port for offer/ack traffic from the server.
LDAP389TCP / UDPActive Directory LDAP queries. Unencrypted. Used for domain authentication, user lookups, and Group Policy. Should be restricted to internal networks.
LDAPS (LDAP over SSL)636TCPEncrypted LDAP. Requires a Domain Controller certificate. Preferred over 389 for any LDAP traffic crossing network boundaries.
Global Catalog LDAP3268TCPGlobal Catalog LDAP (unencrypted) — searched during cross-domain forest lookups.
Global Catalog LDAPS3269TCPEncrypted Global Catalog LDAP.
Kerberos88TCP / UDPDomain 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 Change464TCP / UDPKerberos kpasswd — used during password changes and trust operations.
NTP (Time Sync)123UDPNetwork 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 Mapper135TCPRPC 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 Ports49152–65535TCPDefault 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 / DCOM135 + dynamicTCPWMI 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)8530TCPWSUS client communication over HTTP. Configured in Group Policy under Windows Update → Specify intranet Microsoft update service location.
WSUS (HTTPS)8531TCPWSUS over SSL. Requires a certificate on the WSUS server. Recommended for production WSUS deployments.
SQL Server1433TCPDefault 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 Browser1434UDPSQL 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

ServicePort(s)ProtocolNotes
SMTP (outbound mail)25TCPServer-to-server SMTP. Block outbound 25 from end-user workstations to prevent spam relay. Exchange Online uses 25 for inbound MX delivery.
SMTP Submission587TCPAuthenticated SMTP submission (STARTTLS). Used by mail clients and applications sending through Exchange Online. Preferred over 25 for outbound application mail.
SMTPS465TCPLegacy SMTP over SSL — deprecated by RFC but still required by some older devices (printers, scanners). Exchange Online accepts connections on 587 (preferred) and 465.
IMAP993TCPIMAP over SSL — used by non-Outlook mail clients connecting to Exchange Online. Disable via Exchange Online PowerShell if not needed to reduce attack surface.
POP3995TCPPOP3 over SSL. Rarely needed on modern M365 tenants — disable unless a specific application requires it.
HTTPS (M365 services)443TCPAll 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–3481UDPMicrosoft 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 Connect443, 9090, 9091, 9192, 9350–9354TCPOutbound 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.
⚠️Microsoft 365 publishes a regularly updated list of required endpoints. Hard-coding IP ranges in firewall rules is not recommended — use FQDN-based rules or Microsoft's Office 365 IP Address and URL web service API to keep rules current automatically.

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 LISTENING

To 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 587

A 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 -AutoSize

Checking 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 /f

After 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.