---
title: 'How to add a rule to Windows Server 2012, 2016, 2019 Firewall | Zomro'
description: 'Many programs that are installed on a virtual server and work through network protocols may use non-standard ports for packet exchange.'
image: 'https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/10/01/medium_1667161149_1.png'
---

![opened image]()

  * [Zomro](https://zomro.com/)
  * [FAQ](https://zomro.com/blog/faq/)
  * How to add a rule to Windows Server 2012, 2016, 2019 Firewall 



# How to add a rule to Windows Server 2012, 2016, 2019 Firewall

27-10-2022

Many programs that are installed on a virtual server and work through network protocols may use non-standard ports for packet exchange. The default firewall will block requests from such programs. For example, it can be game servers, or accounting programs.  
  
If such programs give an error due to a closed port, then it can be opened using the Windows Firewall snap-in. In the Windows 2012 operating system, right-click on Start and select Control Panel from the context menu. Go to System and Security, then Windows Firewall.  
Or, for Windows OS versions 2016 and 2019, you can use the **Win+R** key combination and enter the **firewall.cpl** command in the Open window.  
  
![How to add a rule to Windows Server 2012, 2016, 2019 Firewall - 1](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/10/01/medium_1667161149_1.png)  
In the window that appears, on the left side, click on **Advanced Settings** and proceed to adding rules.  
  
![How to add a rule to Windows Server 2012, 2016, 2019 Firewall - 2](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/10/01/1667161103_2.png)  
In the new window, on the left side, select the Inbound Rules tab, then on the right side of the window, in the **Actions** column, select the **New Rule** item ...  
  
![How to add a rule to Windows Server 2012, 2016, 2019 Firewall - 3](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/10/01/1667161185_3.png)  
After that, in the New Inbound Rule Wizard window that appears, in the **Rule Type** item, select the **Port** value, and click **Next**.  
  
![How to add a rule to Windows Server 2012, 2016, 2019 Firewall - 4](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/10/01/1667161183_4.png)  
After that, you need to specify the protocol we need, and the port we need. In our case, this is TCP and port 42000. And click Next.  
  
![How to add a rule to Windows Server 2012, 2016, 2019 Firewall - 5](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/10/01/1667161170_5.png)  
In the next window, select Allow the connection and click **Next**.  
  
  
![How to add a rule to Windows Server 2012, 2016, 2019 Firewall - 6](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/10/01/1667161260_6.png)  
In the **Profile item** , mark the required firewall profiles and click **Next**.  
  
![How to add a rule to Windows Server 2012, 2016, 2019 Firewall - 7](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/10/01/1667161377_7.png)  
In the last **Name** window, enter a name and if you need a description for this rule, and click **Finish**.  
  
![How to add a rule to Windows Server 2012, 2016, 2019 Firewall - 8](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/10/01/1667161530_8.png)  
Now you need to add UDP in the same way. On the left side, select the Inbound Rules tab, then in the right part of the window, in the Actions column, select the New Rule item ... And so on according to the instructions.  
  
If you need to add a range of ports, they can be added with a dash.  
For example: 40000-41000  
  
Now we can observe the added rules in the list of rules for incoming connections.  
  
![How to add a rule to Windows Server 2012, 2016, 2019 Firewall - 9](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/10/01/1667161506_9.png)  
After launching an application that uses the ports that you have added, it should start without errors.  
  
  
You can also use PowerShell for this and spend less time.  
  
For example, we can use the port 40000.  
For TCP protocol:  

    
    
    netsh advfirewall firewall add rule name="New-Port" protocol=TCP localport=40000 action=allow dir=IN;

  
For UDP protocol:
    
    
    netsh advfirewall firewall add rule name="New-Port" protocol=UDP localport=40000 action=allow dir=IN;

  
By the same analogy, you can open the necessary ports.

Similar articles:

[How to raise OpenSSH on Windows 2019](https://zomro.com/blog/faq/406-how-to-raise-openssh-on-windows-2019) [How to install PostgreSQL and pgAdmin in Docker](https://zomro.com/blog/faq/283-kak-ustanovit-postgresql-i-pgadmin-v-docker) [How to disable Defender (Microsoft Defender) in Windows 2016 and 2019](https://zomro.com/blog/faq/347-how-to-activate-microsoft-defender-in-windows-2016-and-2019) [Installing the VestaCP panel](https://zomro.com/blog/faq/327-ustanovka-paneli-vestacp) [How to set up a Samba server on Linux and connect to it from Windows Server 2019](https://zomro.com/blog/faq/334-how-to-set-up-a-samba-server-on-linux-and-connect-to-it-from-windows-server-2019)

[ Forex Server from €7.95/mon ](/server-for-forex)
