Never Open Remote Desktop (Port 3389) to the Internet: What to Do Instead

November 2026

Why it matters

Many offices let staff work from home by forwarding port 3389 (Remote Desktop) from the router to the server. It works, and it is one of the most common ways a small office gets hit by ransomware.

  • Automated scanners look for open 3389 all day, on every address on the internet. Within hours, they start guessing passwords.
  • Remote Desktop has had serious flaws in the past that let attackers in without a password (BlueKeep, 2019, is the best known). Old, unpatched servers are still hit.
  • Once an attacker is on the server, your ERP database and its backups are one step away.

The rule is simple: the Remote Desktop port should never be reachable from the internet.

Step 1: Check whether yours is open

  1. Look at your router's port forwarding (also called virtual server or NAT) page. Any rule that sends 3389, or another port to 3389, to the server is the problem.
  2. Test from outside your office, for example from a phone on mobile data or a PC at another location:
Test-NetConnection YOUR.PUBLIC.IP -Port 3389

Find your public IP by searching "what is my IP" from a PC in the office. False or a timeout is what you want. True means it is open.

Also check for a changed port. Some people forward 3390 or 5000 to 3389 hoping to hide it. Scanners find those too.

Step 2: Close it

Delete the port-forward rule on the router. If your users depend on it, set up Step 3 first, then remove it.

Step 3: Give staff safe access with a VPN

A VPN lets a remote PC join a private network. Remote Desktop then runs inside it, and the server has nothing open to the internet. Good choices for a small office are Tailscale (hosted) or Headscale (the same protocol, self-hosted), or a router with a VPN feature. Any of these works.

The idea is the same for all of them:

  1. Install the VPN on the server and on each remote PC.
  2. The remote PC connects to the server's VPN address, for example 100.64.0.5, not its public IP.
  3. Nothing is forwarded on the router.

If several client offices share one VPN server, use access rules (tags and ACLs in Headscale or Tailscale) so each office can reach only its own server, and only on port 3389.

Step 4: Make Windows accept Remote Desktop only from the VPN

This way, even if the router is changed by mistake, the server refuses everyone else. Do this at the server, not over Remote Desktop itself, or you can lock yourself out.

# Turn off the built-in rules that accept RDP from anywhere
Disable-NetFirewallRule -DisplayGroup "Remote Desktop"

# Allow RDP only from the VPN range (Tailscale and Headscale use 100.64.0.0/10)
New-NetFirewallRule -DisplayName "RDP VPN only" -Direction Inbound -Protocol TCP -LocalPort 3389 -RemoteAddress 100.64.0.0/10 -Action Allow

If people in the office also use Remote Desktop over the LAN, add your LAN range, for example 192.168.1.0/24, to -RemoteAddress. Separate the ranges with a comma.

Step 5: Also do these

  • Keep Windows updated.
  • Use long, unique passwords for every account that can use Remote Desktop. Add an account lockout policy.
  • Keep Network Level Authentication on (it is the default).
  • Keep a backup that the server itself cannot delete. If something does get in, that backup is what saves you. See how to check your backups really restore.

How to confirm it worked

Run the outside test from Step 1 again. It must fail from the internet, while the VPN connection to the server's VPN address succeeds. And if Remote Desktop won't connect after any of this, see Remote Desktop won't connect.

Related guides


← All troubleshooting guides