Skip to main content
Print

Secure RDP: only allow access from your own IP address

Bots try to log in to Remote Desktop day and night. That is why you should only allow RDP from your own IP address. Other addresses then cannot even reach your server. You set this up in the Windows Firewall, with a few clicks or a single PowerShell command.

Before you start

  • Look up your own public IP address, for example via ipje.nl.
  • Do you have a fixed IP address? Then this protection is ideal. If your IP address changes often, use a VPN to your server.
  • Keep the noVNC console in the client area at hand. If you accidentally lock yourself out, you can always reach your server with it.

Via the Windows Firewall (with mouse clicks)

  1. Open Windows Defender Firewall with Advanced Security (type wf.msc in the Start menu).
  2. Click Inbound Rules.
  3. Open the rule Remote Desktop – User Mode (TCP-In).
  4. Go to the Scope.
  5. Under Remote IP address , choose These IP addresses and click Add.
  6. Enter your own IP address and click OK.
  7. Repeat this for Remote Desktop – User Mode (UDP-In).

Via PowerShell

Open PowerShell as administrator and run (replace the example address with your own IP address):

Set-NetFirewallRule -DisplayGroup "Remote Desktop" -RemoteAddress 203.0.113.10

Want to allow several addresses, for example office and home? Separate them with a comma:

Set-NetFirewallRule -DisplayGroup "Remote Desktop" -RemoteAddress 203.0.113.10,198.51.100.20

This command assumes an English version of Windows. In other languages, the group has a different name.

Test it

Connect again via Remote Desktop from your own address. That should work as usual. If you try from another network, for example your mobile hotspot, you will not get a connection.

Changed the RDP port?

Have you changed the RDP port and created your own firewall rule for it? Then also set the IP address under Scopefor that rule. Read more in Change the RDP port.

Your IP address has changed

Can you no longer get in because your IP address has changed? Open the noVNC console in the client area, log in and update the address with the same PowerShell command.

Related articles

Table of Contents