How to add a new rule to the Windows Firewall in Windows Server 2022
When working with a remote desktop or server on Windows, users often encounter moments when for the correct and full work of the software used requires additional rules in the standard security system Widows Firewall, which restricts incoming and outgoing connections to the server thus protecting it from external threats from the network.
Standard Windows Firewall security rules are configured so that access to the device is strictly limited by the network and almost all network ports are protected. But it is not uncommon for a user to need to open an incoming or outgoing port on the Windows Firewall. Let's consider adding a new incoming connection port for the remote desktop service on a non-standard port.
First we need to open the Windows Defender Firewall with Advanced Security control center. There are several ways to do this:
From the Start menu
Open the Start menu and find the corresponding shortcut under Administrative Tools
Through the Server Manager console
In the Server Manager console for Windows Server, go to Local Server and then click to change the Microsoft Defender Firewall setting.
Next, click the Advanced Settings link.
Via the command line cmd
Use Win+R to open the "Run" window and type in "wf.msc"
We have successfully launched the Windows Defender Firewall with Advanced Security control center. In the window that opens, on the left side, you can see the options navigation, where you can select the rules you want to change (incoming or outgoing connections).
Let's go to the Inbound Connections section and right-click on the Inbound Rule to create a new rule.
Select the type of rule. This can be a program specific permission or a separately configurable rule (custom).
Since we want to allow RDP connections for a specific port, we select "Port".
Specify the port number. In our case "33892"
Enable our rule for the firewall zones.
The choice of a particular zone is determined by which earlier zone the device on which we are making the settings was connected and configured:
- Domain - the rule applies only when the computer is connected to a network domain.
- Private - the rule applies only when the computer is connected to a trusted private network
- Public - the rule applies only when the computer is connected to an untrusted public network
Allow connections to our rule
Specify the name of the rule to be set to identify it in the list of all firewall rules.
We have successfully created a new inbound connection rule for our server with you!
Using this method, you can now freely add new rules not only for incoming but also for outgoing connections. Select specific programs and create your own rule variants.
How to reset Windows Firewall rules?
Users who are not yet quite familiar with Windows Firewall and Windows Defender Firewall with Advanced Security often have situations where a new added rule can block access to the desired program. And when there are a lot of such rules, you might wonder how to reset all Windows Firewall rules to their default values. This is a very useful tool for those who have not yet mastered the intricacies of Windows Firewall and want to reset all settings to defaults.
It is worth noting that this method is only good for local systems to which you have physical access, because if you are working through a remote desktop, resetting Windows Firewall will block access to the RDP port, since by default this port is limited to network security.
We strongly advise to use this on dedicated servers, VPS/VDS or remote desktop only if you have physical or virtual access to manage your server system or device over the Internet. This can be IPMI, IP-KVM, VNC services for remote server administration.
To reset Windows Firewall rules, go to the Firewall & network protection settings window using the method described at the beginning of this article and click the "Restore firewalls to default" link.
In the new window click on "Restore defaults" and then agree with the risks of this operation.
Anyway, we would like to remind you that we provide remote desktop rental with full access to the virtual server. This means that even if you do something wrong and you lose access to your remote desktop over the network, we can give you access to the VNC console or perform operations on the server ourselves to make it available again. This feature is absolutely free and supported by all our remote desktop services with full administrator access.
Remote desktop rentals in Europe and the US are available at the link below.