Sometimes we need to open a port on the windows VPS firewall in order to let the app or process work through that.
There are 3 ways to open a port on the windows VPS firewall and they will be checked on this topic one by one.
Windows firewall GUI.
cmd. (Command Line)
Opening through the windows firewall GUI
- At first, execute run using Windows key + R and type firewall.cpl and then press OK.
- On the new page click on advanced setting at the left.
- One the new page opened, choose Inbound Rules and then New Rule…
- Select the port on this page and then click on next.
- Write the port number that you want to be opened and click next.
Note: You should write the number that you want to open, in this topic we have used 20875 for instance.
- In this section, choose to Allow the connections and then click next.
- Tick all of the boxes then click next.
- In this part, write your desired name for the number that you want to open then click next.
- You’re already done, you have successfully opened your desired number.
In order to see the result, you can check it on inbound rules.
- Finally, reboot the server for the setting to be applied.
Opening through cmd
- Open run using Windows key + R and type cmd and then press OK.
- Now, try the below code:
netsh advfirewall firewall add rule name="Port 20875" dir=in action=allow protocol=TCP localport=20875
Note: On the name section, you should write your desired port name and on the localport section you should write the number of the port that you want to open.
- Reboot the server for the setting to be applied.
Opening through PowerShell
- At first, execute run using Windows key + R, type PowerShell and then press OK.
- You should use the below command to open the port.
New-NetFirewallRule -DisplayName "Port 20875" -Direction inbound -LocalPort 20875 -Protocol TCP -Action Allow
Note: On the -DisplayName section, you should write your desired port name and on the -LocalPort section you should write the number of the port that you want to open.
- Above all, reboot the server to apply the changes.
Was this post helpful?
Let us know if you liked the post. That’s the only way we can improve.