Restrict RDP port 12230 to your own IP addresses

Limit the Windows Firewall rule for RDP port 12230 to the IP addresses you connect from, so bots elsewhere cannot even reach the login screen.

  • Intermediate
  • Windows VPS · Admin RDP
  • 5 min read

By RunRacks Team · Published

Moving Remote Desktop to port 12230 cuts out most automated scans, but anyone who finds the port can still try passwords. The strongest simple fix is to let only your own IP addresses reach port 12230. Everyone else's connection is dropped before Windows ever shows a login screen.

This guide sets a remote address scope on the 12230 firewall rule, covers home connections whose IP changes, and keeps the browser console as your way back in.

Before you start

  • Administrator access to the server over Remote Desktop.
  • Access to the Dashboard, so you can open the browser console if you lock yourself out.
  • A list of the public IP addresses you connect from: home, office, and perhaps a second admin's address.

Find your public IP address

Your public IP is the address the server sees, not the 192.168.x.x address on your laptop. From the computer you connect from, run:

PowerShell
(Invoke-RestMethod -Uri 'https://api.ipify.org').Trim()

Or open any "what is my IP" page in a browser. Write the address down. The examples use 198.51.100.20 for home and 198.51.100.45 for the office.

You can also see it from the server. While connected over Remote Desktop, run this on the server:

PowerShell
Get-NetTCPConnection -LocalPort 12230 -State Established |
  Select-Object RemoteAddress -Unique

Find the 12230 firewall rule

On the server, open PowerShell as Administrator and list the rules that cover TCP 12230:

PowerShell
Get-NetFirewallPortFilter -Protocol TCP |
  Where-Object LocalPort -eq 12230 |
  Get-NetFirewallRule |
  Format-Table DisplayName, Name, Enabled, Action

Note the DisplayName. The steps below use Remote Desktop (TCP 12230). Use the exact name from your output.

If more than one enabled allow rule covers 12230, you must scope all of them. Any rule left open to everyone still lets everyone in.

Limit the rule to your IP

Set the remote address scope to your IP:

PowerShell
Set-NetFirewallRule -DisplayName "Remote Desktop (TCP 12230)" `
  -RemoteAddress 198.51.100.20

To allow more than one address, pass a comma-separated list. You can mix single IPs and ranges in CIDR form:

PowerShell
Set-NetFirewallRule -DisplayName "Remote Desktop (TCP 12230)" `
  -RemoteAddress 198.51.100.20, 198.51.100.45, 192.0.2.0/24

Set-NetFirewallRule -RemoteAddress replaces the whole list each time. To add an address later, include all the existing ones as well. Check the current list first:

PowerShell
Get-NetFirewallRule -DisplayName "Remote Desktop (TCP 12230)" |
  Get-NetFirewallAddressFilter |
  Select-Object RemoteAddress

Using the graphical tool instead

  1. Press Win + R, type wf.msc and press Enter.
  2. Click Inbound Rules and double-click the 12230 rule.
  3. Open the Scope tab.
  4. Under Remote IP address, choose These IP addresses and click Add.
  5. Enter your IP and click OK, then OK again.

Handle a home IP that changes

Many home broadband and mobile connections get a new public IP from time to time. When that happens, the firewall blocks you. You have a few options:

  • Allow your provider's range. If your IP always starts the same way, such as 198.51.100.x, allow that /24. It is broader than one IP, but still blocks almost the whole internet.
  • Ask your ISP for a static IP. Many providers sell one as an add-on.
  • Connect through a fixed point. Route RDP through a VPN or SSH server with a fixed IP and allow only that address. See Tunnel Remote Desktop port 12230 through SSH.
  • Update the rule when it changes. Use the browser console, run the Set-NetFirewallRule command with your new IP and reconnect.

For more patterns, see RDP access rules for dynamic IPs.

Check it works

  1. Keep your current Remote Desktop session open.
  2. From the same computer, open a second connection to 203.0.113.10:12230. It should connect.
  3. From a network that is not on the list, such as phone data with a hotspot, test the port:
PowerShell
   Test-NetConnection 203.0.113.10 -Port 12230 -InformationLevel Quiet

It should return False. That means the scope is working.

Only close the original session once the second one has connected.

Get back in if you lock yourself out

  1. Open the Dashboard, go to your service's control panel and open the browser console.
  2. Sign in to Windows and open PowerShell as Administrator.
  3. Either set your new IP, or remove the scope entirely so any address can connect:
PowerShell
   Set-NetFirewallRule -DisplayName "Remote Desktop (TCP 12230)" -RemoteAddress Any
  1. Reconnect over Remote Desktop and set the correct scope again.

Troubleshooting

  • Blocked even from an allowed IP: your public IP has probably changed, or you entered the private LAN address. Check it again from the connecting computer.
  • Other IPs can still connect: another enabled allow rule covers 12230 or all ports. Re-run the rule list and scope or disable the extra rule.
  • Works from home, not from the office: offices often use several outbound IPs. Ask IT for the full list or range.
  • Error "No MSFT_NetFirewallRule objects found": the display name does not match. Copy it exactly from the rule list, including spaces and brackets.

Next steps

Was this guide helpful?

Still stuck?

Ask RunRacks AI for a quick answer, or open a ticket and our team will take a look at your server.

Security

Check the Windows Firewall rule for RDP port 12230

Find and verify the inbound TCP 12230 rule that lets Remote Desktop reach your RunRacks server, recreate it if it was deleted and scope it without locking yourself out.

  • Intermediate
  • Windows VPS · Admin RDP
  • 5 min read

Security

iptables basics: list, allow, drop and save rules

Learn how iptables chains and rule order work, then build a small ruleset that allows SSH and web traffic, drops everything else and can be edited by line number.

  • Intermediate
  • Linux VPS
  • 6 min read