You reach a Windows desktop or server over Remote Desktop Protocol (RDP), and that connection lands on one well-known listener unless someone changed it. Remote Desktop listens on TCP port 3389 by default, and modern Windows versions also use UDP port 3389 for faster session traffic; an RD Gateway moves the public side of the connection to TCP 443 and UDP 3391. Knowing which port is in play on your host tells you what to open, what to test, and what to lock down.

The same number that makes remote desktop easy to reach also makes it easy to find. Port 3389 is one of the most scanned ports on the internet, and an exposed listener draws brute-force attempts within hours of going live.
At PacketTools, the guidance below comes from the same checks used on production networks: confirming the rdp port a host listens on, proving reachability from the outside, changing the listener without locking yourself out, and keeping access restricted once it works.
Which Ports Does Remote Desktop Use by Default?

A standard Windows or Windows Server host accepts Remote Desktop Protocol connections on port 3389 over both TCP and UDP. TCP carries the session setup and acts as the guaranteed path, while UDP speeds up graphics and input when the network allows it.
| Scenario | Port(s) | Protocol |
|---|---|---|
| Direct RDP to a Windows host | 3389 | TCP and UDP |
| RD Gateway, public side | 443 / 3391 | TCP / UDP |
| RD Gateway to internal hosts | 3389 | TCP and UDP |
| xrdp on Linux (default) | 3389 | TCP |
Why Does RDP Use TCP 3389 and UDP 3389?
Microsoft registered 3389 for Terminal Services, and the RDP server has kept it ever since. The server listens on TCP port 3389 and UDP port 3389 out of the box.
TCP 3389 handles the handshake: security negotiation, TLS, Network Level Authentication, and the initial session channels. Once the session is up, the RDP client and server try to add a UDP transport on the same port number. UDP avoids the retransmission stalls that hurt TCP on lossy or high-latency links, so scrolling, video, and typing feel more responsive.
When you open firewall rules for a direct connection, allow both protocols on 3389. Microsoft lists TCP and UDP 3389 as the standard RDP port, configurable to a different number on both host and client.
Does Remote Desktop Still Work When UDP Is Blocked?
Yes. If UDP 3389 is filtered anywhere along the path, the session falls back to TCP only and still connects.
You will notice the difference on poor links. Over a clean LAN, TCP-only sessions feel nearly identical. Over Wi-Fi with packet loss or a long WAN path, expect laggier screen updates. In the Remote Desktop Connection client, the connection info icon in the top bar shows whether UDP is active.
Some VPNs behave badly with RDP over UDP, producing freezes or random disconnects. If a session over VPN keeps hanging, disabling the UDP transport on the client through Group Policy (“Turn Off UDP On Client”) is a practical test.
Do Windows, Linux, and Other Clients Use Different Ports?
No. The port belongs to the server, and every client connects to whatever the server listens on.
- Windows: mstsc.exe and the Windows App default to 3389.
- macOS and iOS: Microsoft’s Windows App also targets 3389 unless you append a port.
- Linux clients: Remmina and FreeRDP use 3389 by default, with
/v:host:portor a port field for custom values. - Linux servers: xrdp listens on TCP 3389 by default, set in
/etc/xrdp/xrdp.ini.
If you run xrdp and Windows hosts behind the same public address, each needs its own external port or a gateway in front.
How Do RD Gateway and RDS Change the Connection Path?

RD Gateway puts an HTTPS front door in front of your hosts, so the internet sees TCP 443 and UDP 3391 while 3389 stays internal. Full Remote Desktop Services (RDS) deployments add more roles, each with its own internal ports for brokering, web feeds, and licensing.
When Does RD Gateway Use TCP 443 and UDP 3391?
Every gateway connection starts on TCP 443. Clients reach the gateway over TCP 443 for HTTP over SSL and UDP 3391 for RDP over UDP, and both ports can be changed in RD Gateway Manager.
The gateway then talks to internal hosts on TCP and UDP 3389. Your perimeter firewall only needs 443 (plus optional 3391) pointed at the gateway, and 3389 never faces the internet.
Certificates make or break this setup. The gateway first establishes an encrypted SSL tunnel using a certificate the client recognizes, then authenticates the user and can use RADIUS for multi-factor authentication. Use a publicly trusted certificate in production, or every client needs your private chain installed.
If UDP 3391 is blocked, sessions still work over 443 at reduced responsiveness, mirroring the direct-connection fallback.
How Do RD Web Access and RemoteApp Fit In?
RD Web Access publishes desktops and RemoteApp programs as a feed over HTTPS on TCP 443. Users sign in to the web portal or subscribe from the Windows App, then launch resources that open through the gateway.
RemoteApp uses the same RDP channel as a full desktop; only the presentation differs, with a single application window on the user’s screen. From a firewall view, a RemoteApp launch generates identical traffic to a desktop session: 443 to the gateway, then 3389 internally.
Internally, RD Web Access reaches the Connection Broker on TCP 5504 for centralized publishing.
Which Additional Ports Are Specific to RDS Roles?
Internal role-to-role traffic is where segmented networks break RDS. The common ones:
- Connection Broker: TCP 5504 to RD Web Access, TCP 3389 to session hosts, TCP 445 plus RPC to session and virtualization hosts.
- RD Gateway internal: TCP 88 (Kerberos), TCP 135 (RPC Endpoint Mapper), TCP/UDP 389 (LDAP), TCP/UDP 53 (DNS), UDP 1812 and 1813 when NPS handles RADIUS.
- RDS Licensing: TCP 135 plus dynamic RPC on TCP 49152 to 65535 on Windows Server 2008 and later, TCP 445, and TCP 443 to the Microsoft Clearing House.
- Administration: TCP 5985 for WMI and PowerShell Remoting across every role.
If session hosts cannot find a license server, check RPC first. A firewall that allows 135 but blocks the dynamic range produces exactly that symptom.
How Can You Check the Listener and Troubleshoot Connectivity?
Start on the host to confirm what it listens on, then test from the client side to prove the path is open. Splitting the problem this way tells you whether to look at the server, the network, or the credentials.
Find the Configured Listening Port With PowerShell and netstat
The configured port lives in the registry. In an elevated PowerShell window, run:
Get-ItemProperty -Path 'HKLM:SYSTEMCurrentControlSetControlTerminal ServerWinStationsRDP-Tcp' -Name PortNumber
That shows the configured value. To confirm the service is bound to it, check live sockets:
netstat -ano | findstr ":3389"
Look for a LISTENING line on 0.0.0.0:3389 and [::]:3389. Match the PID against TermService with tasklist /svc /fi "PID eq <pid>".
If nothing listens, run qwinsta. Microsoft’s guidance says that if the list shows rdp-tcp with a status of Listen, the listener works. Also confirm TermService and UmRdpService are running, and that a GPO is not setting fDenyTSConnections to 1.
Test TCP Reachability With Test-NetConnection
From the client, run:
Test-NetConnection server01.corp.local -Port 3389
TcpTestSucceeded : True proves a TCP handshake completed from that machine to that port. It says nothing about UDP, credentials, or whether a session will start.
When the result is False, the output still helps. A PingSucceeded of True with a failed TCP test points at a firewall or a stopped listener. A failed name resolution line points at DNS. For testing from outside your network, the PacketTools open port checker shows whether 3389 or your custom port is reachable from the public internet, which is often the very exposure you want to rule out.
Separate DNS, Routing, Firewall, and Sign-In Failures
Work through the stages in order and repeat the same test after each change:
- DNS: Does the name resolve to the right IP? Compare
Resolve-DnsNameoutput against the host’s real address. Stale records after a migration are common. - Routing: Can you reach the subnet? Traceroute shows where packets stop.
- Firewall: Check Windows Firewall rules for “Remote Desktop – User Mode (TCP-In)” on the active profile, then any perimeter, NSG, or VPN filter.
- Listener: Confirmed with netstat and qwinsta above.
- Sign-in: If the port answers but you get credential or NLA errors, the network is fine. Check group membership in Remote Desktop Users, account lockout, and certificate warnings.
That staged approach is the core of solid network troubleshooting: each test isolates one layer before you touch configuration.
How Do You Change the Listening Port Without Losing Access?
Change the registry value, open the new port in every firewall, and only then restart Remote Desktop Services. Getting that order wrong on a remote host is the classic way to cut off your own session.
Choose an Unused Port and Prepare a Recovery Path
Pick a port in the registered range (1024 to 49151) and stay away from well-known ports below 1024. Confirm nothing else uses it:
netstat -ano | findstr ":3390"
An empty result means it is free. Avoid ports your other applications may claim later, and document the choice.
Before touching anything, line up a second way in: a hypervisor or cloud serial console, iLO/iDRAC, or a working PowerShell Remoting session on TCP 5985. On a VPS with only RDP access, this step is the difference between a two-minute fix and a support ticket.
Update PortNumber With PowerShell or Registry Editor
With PowerShell as administrator:
Set-ItemProperty -Path 'HKLM:SYSTEMCurrentControlSetControlTerminal ServerWinStationsRDP-Tcp' -Name PortNumber -Value 3390
In Registry Editor, browse to the same RDP-Tcp key, open the PortNumber DWORD, select Decimal, and enter the new value. Entering it while Hexadecimal is selected is a frequent mistake that produces a completely different port.
The change does nothing until TermService restarts. The custom RDP port applies to both TCP and the UDP port used for the faster transport.
Scope Firewall Rules Before Restarting Remote Desktop Services
Microsoft’s procedure adds inbound TCP and UDP rules for the new port with New-NetFirewallRule. Add a source restriction so the rule admits only your management networks:
New-NetFirewallRule -DisplayName 'RDP-3390-TCP' -Direction Inbound -Protocol TCP -LocalPort 3390 -RemoteAddress 10.20.0.0/24 -Action Allow
New-NetFirewallRule -DisplayName 'RDP-3390-UDP' -Direction Inbound -Protocol UDP -LocalPort 3390 -RemoteAddress 10.20.0.0/24 -Action Allow
Update any cloud security group, router NAT, or perimeter firewall too. Then restart the service:
Restart-Service TermService -Force
Your current session drops at this point. That is expected.
Connect With mstsc.exe and Verify the New Port
Reconnect with the port appended: mstsc.exe /v:server01:3390, or type server01:3390 in the Remote Desktop Connection address box.
Confirm the result from both sides. On the host, netstat -ano | findstr ":3390" should show LISTENING. From the client, Test-NetConnection server01 -Port 3389 should now fail and port 3390 should succeed. Once confirmed, disable the old built-in Remote Desktop rules so 3389 is not left open by accident.
How Do You Secure Remote Access Beyond Changing the Port?
A new port number cuts scanner noise, but malicious bots fingerprint RDP on any port within minutes. Real RDP security comes from limiting who can reach the listener at all, then hardening authentication for those who can.
Keep Public RDP Behind a VPN or Hardened RD Gateway
Never publish rdp port 3389, or any custom port, directly to the internet. Exposed RDP remains a leading entry point for ransomware operators, who buy stolen credentials and spray them at open listeners.
Your realistic options:
- VPN: Users connect to the network first; RDP is reachable only from VPN address pools.
- RD Gateway: One hardened HTTPS endpoint with RD CAPs and RD RAPs controlling who reaches which host, plus MFA through NPS and RADIUS.
- SSH tunnel: Workable for a few admins: forward a local port to the host’s 3389 over an SSH bastion.
Patch the gateway or VPN appliance aggressively. It becomes the exposed surface in place of every individual host.
Require NLA, Validate TLS, and Enforce Strong Authentication
Network Level Authentication (NLA) forces users to authenticate before the server builds a session, which blocks unauthenticated attackers from consuming resources or reaching pre-auth bugs. Enable it in System Properties or via Group Policy under Remote Desktop Session Host > Security.
Replace the self-signed certificate with one from your internal CA or a public CA, and set the security layer to TLS. Users who learn to click through certificate warnings will click through a spoofed one too.
Pair this with MFA at the gateway or VPN, an account lockout policy, and Windows LAPS so local administrator passwords differ on every machine.
Use Group Policy, Restricted Firewall Rules, and Access Monitoring
Group Policy keeps these settings consistent across hundreds of hosts: NLA required, TLS security layer, session timeouts, and Remote Desktop Users limited to specific groups.
Scope firewall rules by source address everywhere, including inside the LAN, so workstations cannot RDP laterally to servers. Jump hosts or privileged access workstations make good sole sources.
Watch the logs. Event ID 4625 with logon type 10 or 3 flags failed RDP sign-ins, and 4624 type 10 shows successful ones. A spike from one IP or many accounts is brute forcing; forward these events to your SIEM and alert on them.
Verify the Connection Path and Keep RDP Access Restricted
RDP listens on TCP and UDP 3389 by default, with TCP as the guaranteed path and UDP as the performance layer. RD Gateway shifts the public side to TCP 443 and UDP 3391 while 3389 stays internal.
Confirm the listener with the registry, netstat, and qwinsta, then prove reachability with Test-NetConnection and an external port check. If you move to a custom port, set firewall rules before restarting TermService and keep a console path ready.
Treat the port number as a minor detail. Put access behind a VPN or gateway, require NLA and TLS, scope firewall rules to known source addresses, and alert on failed logon events.



























