Port – How to open a port on the Windows VPS firewall

Port – How to open a port on the Windows VPS firewall

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)

  • Windows PowerShell.

     

Opening through the windows firewall GUI

 

  1. At first, execute run using Windows key + R and type firewall.cpl and then press OK.
    open a port
  2. On the new page click on advanced setting at the left.
    VPS Firewall
  3. One the new page opened, choose Inbound Rules and then New Rule…
    Windows firewall
  4. Select the port on this page and then click on next.
    port firewall
  5. 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.
    port vps
  6. In this section, choose to Allow the connections and then click next.
    firewall port
  7. Tick all of the boxes then click next.
    CMD firewall
  8. In this part, write your desired name for the number that you want to open then click next.
    powershell firewall
  9. You’re already done, you have successfully opened your desired number.
    In order to see the result, you can check it on inbound rules.
    port open
  10. Finally, reboot the server for the setting to be applied.

Opening through cmd

  1. Open run using Windows key + R and type cmd and then press OK.
    firewall open
  2. 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.
    new port
  3. Reboot the server for the setting to be applied.

Opening through PowerShell

  1. At first, execute run using Windows key + R, type PowerShell and then press OK.
    open a port on windows VPS
  2. 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.
    new firewall port
  3. Above all, reboot the server to apply the changes.

 

 

About the Author

Leave a Reply

seventeen − five =