Would you like to learn how to use a group policy to enable and configure the Firewall of a computer running Windows? In this tutorial, we will show you how to enable the Firewall service and create network rules on all computers in the domain using a GPO.

• Windows 2012 R2
• Windows 2016
• Windows 2019
• Windows 10
• Windows 7

Hardware List:

The following section presents the list of equipment used to create this tutorial.

Every piece of hardware listed above can be found at Amazon website.

Tutorial GPO - Configure the Windows firewall

On the domain controller, open the group policy management tool.

Windows 2012 - Group Policy Management

Create a new group policy.

Windows 2012 - Group Policy Objects

Enter a name for the new group policy.

Windows - Add GPO

In our example, the new GPO was named: MY-GPO.

On the Group Policy Management screen, expand the folder named Group Policy Objects.

Right-click your new Group Policy Object and select the Edit option.

Windows - Edit GPO

On the group policy editor screen, expand the Computer configuration folder and locate the following item.

Copy to Clipboard

Select the option named Windows Firewall with Advanced Security

GPO - Enable Windows Firewall

Access the option named Windows firewall properties.

Enable Windows firewall using GPO

Select the desired network profile and perform the following configuration:

• Firewall state - On.
• Inbound connections - Block.
• Outbound connections - Allow.

Click on the OK button.

GPO Configure Firewall Windows

In our example, we are going to enable the Windows firewall when the computer is connected to the Domain network.

In our example, we are going to allow outbound connections.

In our example, we are going to block inbound connections.

The computer will be allowed to start a communication with any device.

Other devices will not be allowed to start communication with the computer.

Optionally, enable the log of blocked packets.

GPO Windows Firewall - Log blocked packets

Enable the option named Log dropped packets.

GPO Windows Firewall - Log dropped packets

This is the default path for the Windows firewall log.

Copy to Clipboard

To save the group policy configuration, you need to close the Group Policy editor.

Congratulations! You have finished the GPO creation.

Tutorial GPO - Create a firewall rule

As an example, we are going to create a white list.

This rule will contain a list of IP addresses that are allowed to start a network connection to the computer.

On the group policy editor, select the option named Windows Firewall with Advanced Security.

GPO - Enable Windows Firewall

Create a new Inbound rule.

GPO Windows Firewall - Inbound rule

Select the Custom option.

GPO - Firewall Whitelist IP address 01

Select the All Programs option and click on the Next button.

GPO - Firewall Whitelist IP address 02

Click on the Next button.

GPO - Firewall Whitelist IP address 03

Enter a list of authorized IP addresses and click on the Next button.

The IP addresses included in the list will be authorized to start communication without restrictions.

GPO - Firewall Whitelist IP address 04

Select the option to allow the connection.

GPO - Firewall Whitelist IP address 05

Select the desired network profile and click on the Next button.

GPO - Firewall Whitelist IP address 06

Enter a name to identify the new inbound rule.

GPO - Firewall Whitelist IP address 07

Click on the Finish button.

To save the group policy configuration, you need to close the Group Policy editor.

Congratulations! You have finished the creation of an Inbound rule using a GPO.

Tutorial GPO - Enable the Windows firewall

On the Group policy management screen, you need to right-click the Organizational Unit desired and select the option to link an existent GPO.

Windows-2012-Applocker application

In our example, we are going to link the group policy named MY-GPO to the root of the domain.

GPO- tutorial linking

After applying the GPO you need to wait for 10 or 20 minutes.

During this time the GPO will be replicated to other domain controllers.

In our example, we used a GPO to enable and configure the Windows firewall.