Follow these simple steps to open your desired port permanently on your Windows machine, making it accessible for Remote Desktop Protocol (RDP) connections.
For this guide, we are using port 3000 as an example. Replace it with your desired port number in each step.
Step 1: Ensure Firewall Rule for Your Desired Port
Run PowerShell (Admin) by:
- Press Win + X and select Windows PowerShell (Admin) from the menu.
- Alternatively, press Win + R, type powershell, then press Ctrl + Shift + Enter to open PowerShell as Administrator.
Execute the following command to allow your desired port (in this example, port 3000):
New-NetFirewallRule -DisplayName "Allow Port 3000" -Direction Inbound -Protocol TCP -LocalPort 3000 -Action Allow
Note: Replace 3000 with your actual desired port number.
Step 2: Bind the Desired Port to All Network Interfaces
Run Command Prompt (Admin) by:
- Press Win + X and select Command Prompt (Admin) from the menu.
- Alternatively, press Win + R, type cmd, then press Ctrl + Shift + Enter to open Command Prompt as Administrator.
Now, bind your desired port (3000 in this case) to all network interfaces by executing the following command:
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=3000 connectaddress=127.0.0.1 connectport=3000
Note: Replace 3000 with your actual desired port number.
Step 3: Check If Your Desired Port is Open
To verify if your desired port (3000 in this case) is open, run the following command:
netstat -ano | findstr :3000
If the port does not show as LISTENING, restart the server:
shutdown /r /t 0
Step 4: Test From Another Device
On another computer, run the following command to test if the port is open:
telnet <your-server-ip> 3000
If it connects, the port is fully open!
Note: Replace <your-server-ip> with your actual server IP address and 3000 with your desired port number.
If the telnet command is not found, you can enable the Telnet Client by following these steps:
- Press Win + R, type optionalfeatures.exe, and press Enter.
- In the “Windows Features” dialog, scroll down and check Telnet Client.
- Click OK to install Telnet.
- Once installed, try the telnet command again.
If you need more help, feel free to reach out! 🚀