Port 3389 (RDP)
Key facts
- Port
- 3389
- Protocols
- TCP, UDP
- Range
- Registered port, 1024-49151
- IANA service name
- ms-wbt-server
IANA assigns ports in this range to services on request, under RFC 6335.
About port 3389
Port 3389 is the default port of RDP (Remote Desktop Protocol), Microsoft's protocol for connecting to the desktop of a Windows computer or server remotely. The service listens on TCP port 3389, and also on UDP, which is used for smoother data transfer when the network allows it.
IANA registers port 3389 for the ms-wbt-server service, and according to Microsoft's documentation, it's the default listening port of Remote Desktop.
What port 3389 is used for
- Managing a Windows server: connecting to the server's desktop, installing software, and working in the graphical interface, as if you were sitting in front of the computer.
- Remote work: working from anywhere in software installed on a computer or server at the office.
- Connection apps: on Windows, you use Remote Desktop Connection (mstsc) or Windows App, which is also available for macOS, iOS, and Android.
- A non-default port: when the server listens on a different port, add it to the address when you connect, for example server.example.com:3390.
Port 3389 in the firewall
On a Windows server that allows Remote Desktop, port 3389 must be open in Windows Firewall. When you connect from a static IP address, we recommend allowing access only from it, for example in PowerShell as an administrator:
New-NetFirewallRule -DisplayName "RDP from office" -Direction Inbound -Protocol TCP -LocalPort 3389 -RemoteAddress 203.0.113.10 -Action Allow
After you add a rule like this, restrict or disable the general Remote Desktop rule, which allows access from any address. When a Linux-based firewall protects the network, or a Linux server provides remote desktop over RDP, the equivalent rule is:
- UFW:
ufw allow from 203.0.113.10 to any port 3389 proto tcp - firewalld:
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="203.0.113.10" port port="3389" protocol="tcp" accept'
Risks and security
Port 3389 open to the internet gets automated login attempts, like any remote login service. A few simple settings make sure those attempts don't succeed:
- Limit access to known IP addresses, or connect through a VPN.
- Use strong, unique passwords for every user allowed to connect remotely.
- Keep Network Level Authentication (NLA) turned on, so users must authenticate before the remote desktop opens.
- Set an account lockout policy after a number of failed login attempts.
- Install Windows security updates regularly.
Changing the port cuts down on automated scans, but the real protection comes from limiting access and using strong passwords.
Commands to check and configure
-
Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name PortNumberShows in PowerShell the port Remote Desktop listens on.
-
netstat -an | findstr :3389Checks in CMD that the server is listening on port 3389, on TCP and UDP.
-
Test-NetConnection server.example.com -Port 3389Checks from a Windows computer whether port 3389 on the server is open and reachable.
-
mstsc /v:server.example.com:3389Opens a Remote Desktop connection to the given server and port.
-
New-NetFirewallRule -DisplayName "RDP from office" -Direction Inbound -Protocol TCP -LocalPort 3389 -RemoteAddress 203.0.113.10 -Action AllowAllows access to port 3389 in Windows Firewall only from the given IP address (PowerShell as an administrator).
-
nc -zv server.example.com 3389Checks from a Linux or macOS computer whether port 3389 on the server is open and reachable.
-
ufw allow from 203.0.113.10 to any port 3389 proto tcpAllows access to port 3389 only from the given IP address (UFW).
Port 3389 in the IANA registry
| Port | Protocol | Service | IANA registry description |
|---|---|---|---|
| 3389 | TCP | ms-wbt-server | MS WBT Server |
| 3389 | UDP | ms-wbt-server | MS WBT Server |
Data source: IANA Service Name and Transport Protocol Port Number Registry (opens in a new tab)
Port 3389 FAQ
Can I change the RDP port?
Yes. The port is stored in the Windows registry, in the PortNumber value, and you can change it in PowerShell or in Registry Editor. Before the change, add a firewall rule for the new port, on TCP and UDP, and after the change, restart the computer. When you connect, add the port to the address, for example server.example.com:3390.
How do I connect to a Windows server remotely from a Mac or a phone?
Microsoft provides Windows App for macOS, iOS, and Android as well. In the app, add a new PC with the server address, and the port number if needed, and connect with the server's username and password.
What do I do when the Remote Desktop connection fails?
First check that the port is reachable, for example with Test-NetConnection, and then look at the error message shown. The Common RDP errors page explains the common errors and how to fix them.
Do I need to open port 3389 on UDP too?
It's not required. The connection also works over TCP only, and opening UDP lets the connection use it when the network allows it, for a smoother, more responsive display. When you change the port, Microsoft recommends opening the new port on both TCP and UDP.