Best practices for configuring Windows Defender Firewall (2023)

  • Article
  • Applies to:
    Windows 11, ✅ Windows 10, ✅ Windows Server 2022, ✅ Windows Server 2019, ✅ Windows Server 2016

Windows Defender Firewall with Advanced Security provides host-based, two-waynetwork traffic filtering and blocks unauthorized network traffic flowing intoor out of the local device. Configuring your Windows Firewall based on thefollowing best practices can help you optimize protection for devices in yournetwork. These recommendations cover a wide range of deployments including homenetworks and enterprise desktop/server systems.

To open Windows Firewall, go to the Start menu, select Run,type WF.msc, and then select OK. See also Open Windows Firewall.

Keep default settings

When you open the Windows Defender Firewall for the first time, you can see the default settings applicable to the local computer. The Overview panel displays security settings for each type of network to which the device can connect.

Best practices for configuring Windows Defender Firewall (1)

Figure 1: Windows Defender Firewall

  1. Domain profile: Used for networks where there's a system of account authentication against an Active Directory domain controller
  2. Private profile: Designed for and best used in private networks such as a home network
  3. Public profile: Designed with higher security in mind for public networks, like Wi-Fi hotspots, coffee shops, airports, hotels, or stores

View detailed settings for each profile by right-clicking the top-level Windows Defender Firewall with Advanced Security node in the left pane and then selecting Properties.

Maintain the default settings in Windows DefenderFirewall whenever possible. These settings have been designed to secure your device for use in most network scenarios. One key example is the default Block behavior for Inbound connections.

Best practices for configuring Windows Defender Firewall (2)

Figure 2: Default inbound/outbound settings

Important

To maintain maximum security, do not change the default Block setting for inbound connections.

(Video) Configuring Windows Defender Firewall

For more on configuring basic firewall settings, see Turn on Windows Firewall and Configure Default Behavior and Checklist: Configuring Basic Firewall Settings.

Understand rule precedence for inbound rules

In many cases, a next step for administrators will be to customize these profiles using rules (sometimes called filters) so that they can work with user apps or other types of software. For example, an administrator or user may choose to add a rule to accommodate a program, open a port or protocol, or allow a predefined type of traffic.

This rule-adding task can be accomplished by right-clicking either Inbound Rules or Outbound Rules, and selecting New Rule. The interface for adding a new rule looks like this:

Best practices for configuring Windows Defender Firewall (3)

Figure 3: Rule Creation Wizard

Note

This article does not cover step-by-step rule configuration. See the Windows Firewall with Advanced Security Deployment Guide for general guidance on policy creation.

In many cases, allowing specific types of inbound traffic will be required for applications to function in the network. Administrators should keep the following rule precedence behaviors in mind when allowing these inbound exceptions.

  1. Explicitly defined allow rules will take precedence over the default block setting.
  2. Explicit block rules will take precedence over any conflicting allow rules.
  3. More specific rules will take precedence over less specific rules, except if there are explicit block rules as mentioned in 2. (For example, if the parameters of rule 1 include an IP address range, while the parameters of rule 2 include a single IP host address, rule 2 will take precedence.)

Because of 1 and 2, it's important that, when designing a set of policies, you make sure that there are no other explicit block rules in place that could inadvertently overlap, thus preventing the traffic flow you wish to allow.

A general security best practice when creating inbound rules is to be as specific as possible. However, when new rules must be made that use ports or IP addresses, consider using consecutive ranges or subnets instead of individual addresses or ports where possible. This approach avoids creation of multiple filters under the hood, reduces complexity, and helps to avoid performance degradation.

Note

Windows Defender Firewall does not support traditional weighted, administrator-assigned rule ordering. An effective policy set with expected behaviors can be created by keeping in mind the few, consistent, and logical rule behaviors described above.

(Video) Configuring Windows Firewall - CompTIA A+ 220-1102 - 1.6

Create rules for new applications before first launch

Inbound allow rules

When first installed, networked applications and services issue a listen call specifying the protocol/port information required for them to function properly. As there's a default block action in Windows Defender Firewall, it's necessary to create inbound exception rules to allow this traffic. It's common for the app or the app installer itself to add this firewall rule. Otherwise, the user (or firewall admin on behalf of the user) needs to manually create a rule.

If there's no active application or administrator-defined allow rule(s), a dialog box will prompt the user to either allow or block an application's packets the first time the app is launched or tries to communicate in the network.

  • If the user has admin permissions, they'll be prompted. If they respond No or cancel the prompt, block rules will be created. Two rules are typically created, one each for TCP and UDP traffic.

  • If the user isn't a local admin, they won't be prompted. In most cases, block rules will be created.

In either of the scenarios above, once these rules are added they must be deleted in order to generate the prompt again. If not, the traffic will continue to be blocked.

Note

The firewall's default settings are designed for security. Allowing all inbound connections by default introduces the network to various threats. Therefore, creating exceptions for inbound connections from third-party software should be determined by trusted app developers, the user, or the admin on behalf of the user.

Known issues with automatic rule creation

When designing a set of firewall policies for your network, it's a best practice to configure allow rules for any networked applications deployed on the host. Having these rules in place before the user first launches the application will help ensure a seamless experience.

The absence of these staged rules doesn't necessarily mean that in the end an application will be unable to communicate on the network. However, the behaviors involved in the automatic creation of application rules at runtime require user interaction and administrative privilege. If the device is expected to be used by non-administrative users, you should follow best practices and provide these rules before the application's first launch to avoid unexpected networking issues.

To determine why some applications are blocked from communicating in the network, check for the following instances:

  1. A user with sufficient privileges receives a query notification advising them that the application needs to make a change to the firewall policy. Not fully understanding the prompt, the user cancels or dismisses the prompt.
  2. A user lacks sufficient privileges and is therefore not prompted to allow the application to make the appropriate policy changes.
  3. Local Policy Merge is disabled, preventing the application or network service from creating local rules.

Creation of application rules at runtime can also be prohibited by administrators using the Settings app or Group Policy.

Best practices for configuring Windows Defender Firewall (4)

Figure 4: Dialog box to allow access

(Video) 61. Configure Windows Defender Firewall with Advanced Security | Server 2019

See also Checklist: Creating Inbound Firewall Rules.

Establish local policy merge and application rules

Firewall rules can be deployed:

  1. Locally using the Firewall snap-in (WF.msc)
  2. Locally using PowerShell
  3. Remotely using Group Policy if the device is a member of an Active Directory Name, System Center Configuration Manager, or Intune (using workplace join)

Rule merging settings control how rules from different policy sources can be combined. Administrators can configure different merge behaviors for Domain, Private, and Public profiles.

The rule-merging settings either allow or prevent local administrators from creating their own firewall rules in addition to those rules obtained from Group Policy.

Best practices for configuring Windows Defender Firewall (5)

Figure 5: Rule merging setting

Tip

In the firewall configuration service provider, the equivalent setting is AllowLocalPolicyMerge. This setting can be found under each respective profile node, DomainProfile, PrivateProfile, and PublicProfile.

If merging of local policies is disabled, centralized deployment of rules is required for any app that needs inbound connectivity.

Administrators may disable LocalPolicyMerge in high-security environments to maintain tighter control over endpoints. This setting can impact some applications and services that automatically generate a local firewall policy upon installation as discussed above. For these types of apps and services to work, admins should push rules centrally via group policy (GP), Mobile DeviceManagement (MDM), or both (for hybrid or co-management environments).

Firewall CSP and Policy CSP also have settings that can affect rule merging.

As a best practice, it's important to list and log such apps, including the network ports used for communications. Typically, you can find what ports must be open for a given service on the app's website. For more complex or customer application deployments, a more thorough analysis may be needed using network packet capture tools.

In general, to maintain maximum security, admins should only push firewall exceptions for apps and services determined to serve legitimate purposes.

(Video) Take Full Control Of Windows Firewall

Note

The use of wildcard patterns, such as C:*\teams.exe is not supported in application rules. We currently only support rules created using the full path to the application(s).

Know how to use "shields up" mode for active attacks

An important firewall feature you can use to mitigate damage during an active attack is the "shields up" mode. It's an informal term referring to an easy method a firewall administrator can use to temporarily increase security in the face of an active attack.

Shields up can be achieved by checking Block allincoming connections, including those in the list of allowed apps setting found in either the Windows Settings app or the legacy file firewall.cpl.

Best practices for configuring Windows Defender Firewall (6)

Figure 6: Windows settings App/Windows Security/Firewall Protection/Network Type

Best practices for configuring Windows Defender Firewall (7)

Figure 7: Legacy firewall.cpl

By default, the Windows Defender Firewall will block everything unless there's an exception rule created. This setting overrides the exceptions.

For example, the Remote Desktop feature automatically creates firewall rules when enabled. However, if there's an active exploit using multiple ports and services on a host, you can, instead of disabling individual rules, use the shields up mode to block all inbound connections, overriding previous exceptions, including the rules for Remote Desktop. The Remote Desktop rules remain intact but remote access won't work as long as shields up is activated.

Once the emergency is over, uncheck the setting to restore regular network traffic.

Create outbound rules

What follows are a few general guidelines for configuring outbound rules.

  • The default configuration of Blocked for Outbound rules can be considered for certain highly secure environments. However, the Inbound rule configuration should never be changed in a way that Allows traffic by default
  • It's recommended to Allow Outbound by default for most deployments for the sake of simplification around app deployments, unless the enterprise prefers tight security controls over ease-of-use
  • In high security environments, an inventory of all enterprise-spanning apps must be taken and logged by the administrator or administrators. Records must include whether an app used requires network connectivity. Administrators will need to create new rules specific to each app that needs network connectivity and push those rules centrally, via group policy (GP), Mobile Device Management (MDM), or both (for hybrid or co-management environments)

For tasks related to creating outbound rules, see Checklist: Creating Outbound Firewall Rules.

(Video) Best practice Windows computers - increase security - speed up computer - Windows Firewall

Document your changes

When creating an inbound or outbound rule, you should specify details about the app itself, the port range used, and important notes like creation date. Rules must be well-documented for ease of review both by you and other admins. We highly encourage taking the time to make the work of reviewing your firewall rules at a later date easier. And never create unnecessary holes in your firewall.

FAQs

How do I configure Windows Firewall and Defender? ›

Turn Microsoft Defender Firewall on or off
  1. Select Start , then open Settings . ...
  2. Select a network profile: Domain network, Private network, or Public network.
  3. Under Microsoft Defender Firewall, switch the setting to On. ...
  4. To turn it off, switch the setting to Off.

What are the four 4 best practices for firewall rules configuration including allow access? ›

Best practices for firewall rules configuration
  • Block by default. Block all traffic by default and explicitly enable only specific traffic to known services. ...
  • Allow specific traffic. ...
  • Specify source IP addresses. ...
  • Specify the destination IP address. ...
  • Specify the destination port. ...
  • Examples of dangerous configurations.
Apr 16, 2020

Which are two main rules categories in Windows Defender Firewall? ›

Microsoft Windows Defender Firewall, by default, contains two 'top level' rules; one that blocks all inbound connections, and the other, which allows all outbound connections.

What are the default rules for Windows Defender Firewall? ›

By default, the Windows Defender Firewall will block everything unless there's an exception rule created. This setting overrides the exceptions. For example, the Remote Desktop feature automatically creates firewall rules when enabled.

How do I configure my firewall step by step? ›

How To Configure a Firewall
  1. Secure the Firewall. ...
  2. Establish Firewall Zones and an IP Address Structure. ...
  3. Configure Access Control Lists (ACLs) ...
  4. Configure Other Firewall Services and Logging. ...
  5. Test the Firewall Configuration. ...
  6. Manage Firewall Continually.

What are the six 6 best practices for deployment of firewalls as network security perimeter device? ›

Items associated with firewall deployment process
  • Security policy. ...
  • Set a default policy. ...
  • Do not expose private services without VPN. ...
  • Ensure non-repudiation in internal or external accesses. ...
  • Build a secure visitor access policy. ...
  • Create access policies by interest groups. ...
  • Use DMZ or private network for public services.

What are two best practices when implementing firewall security policies? ›

  • #1. Harden and Properly Configure the Firewall. ...
  • #2. Plan your Firewall Deployment. ...
  • #3. Secure the Firewall. ...
  • #4. Secure User Accounts. ...
  • #5. Lock Down Zone Access to Approved Traffic. ...
  • #6. Ensure Firewall Policy and Use Complies with Standards. ...
  • #7. Test to Verify the Policy and Identify Risks. ...
  • #8.

What are the four basic firewall rules? ›

These are described here in order of precedence:
  • The traffic can bypass the firewall completely. ...
  • It can log only. ...
  • It can force allow defined traffic (it will allow traffic defined by this rule without excluding any other traffic.)
  • It can deny traffic (it will deny traffic defined by this rule.)
Sep 12, 2022

What two things are most important when first considering firewall implementation? ›

All replies
  • Answer: The two most crucial factors to take into account when first thinking about implementing a firewall are:
  • 1) Security policy: The security policy outlines the types of traffic that the firewall should allow or reject. ...
  • 2) Network topology: The network topology is the second factor to take into account.

What ports should be block on a firewall? ›

For those looking for a list of ports to block, the SANS Institute recommends at least blocking outbound traffic using the following ports:
  • MS RPC TCP, UDP Port 135.
  • NetBIOS/IP TCP, UDP Port 137-139.
  • SMB/IP TCP Port 445.
  • Trivial File Transfer Protocol (TFTP) UDP Port 69.
  • System log UDP Port 514.
Mar 20, 2022

What are 4 techniques used by firewalls to control access and enforce security policy? ›

Explanation. The four techniques used by firewalls to control access and enforce a security policy are Service control, Direction control, User control and Behavior control.

What is the difference between Windows Defender and Windows Defender Firewall? ›

Windows Defender (now Microsoft Defender) is an antivirus program that protects your system from various threats such as malware, viruses, etc. On the other hand, Windows Defender Firewall is responsible for monitoring network traffic and blocking hackers to prevent unauthorized access.

What are the three categories and default settings for Windows Defender Firewall? ›

Windows Firewall offers three firewall profiles: domain, private and public. The domain profile applies to networks where the host system can authenticate to a domain controller. The private profile is a user-assigned profile and is used to designate private or home networks.

What are the three network profile types of Windows Defender Firewall? ›

You can turn Microsoft Defender Firewall on or off and access advanced Microsoft Defender Firewall options for the following network types:
  • Domain (workplace) networks.
  • Private (discoverable) networks.
  • Public (non-discoverable) networks.

What apps should be allowed through Windows Defender Firewall? ›

The apps you want are your browsers like Edge, Chrome, Firefox, Internet Explorer and ports 80 and 443 to be open. That's what you want to allow. As for private and public the way that works is based on your connection.

Is Windows Defender Firewall sufficient? ›

Microsoft Defender is a good enough option for basic antivirus protection. It has a very strong firewall and a good number of features for the program and device security. However, the scanning performance is very poor, and secure browsing is only possible with Microsoft Edge.

What should you do from Windows Defender Firewall with advanced security? ›

Windows Defender Firewall with Advanced Security is a host firewall that helps secure the device in two ways. First, it can filter the network traffic permitted to enter the device from the network, and also control what network traffic the device is allowed to send to the network.

How do I configure Windows Defender? ›

Turn on real-time and cloud-delivered protection
  1. Select the Start menu.
  2. In the search bar, type Windows Security. ...
  3. Select Virus & threat protection.
  4. Under Virus & threat protection settings, select Manage settings.
  5. Flip each switch under Real-time protection and Cloud-delivered protection to turn them on.
Feb 20, 2023

What command do you use to configure the Windows Firewall? ›

To configure the firewall settings:
  1. Open a command prompt in "Run as administrator" mode (or PowerShell) and enter: netsh advfirewall set allprofiles state off.
  2. To verify that Windows Firewall for all networks is off, enter: netsh advfirewall show all.

Is Windows Defender and firewall enough? ›

Yes, Windows Defender is a good basic virus protection software. You may not find everything you want if you are extremely security focused. A third-party antivirus or anti-malware software will likely find threats that Windows Defender may miss.

How do I enable Windows Defender Firewall instead of McAfee? ›

Re: disable McAfee firewall and enable windows firewall
  1. Double-click the M icon in your taskbar.
  2. Open the Web and Email Protection drawer and select Firewall.
  3. Open the Ports and System Services drawer.
  4. Select the checkbox beside the Windows File Sharing (NETBIOS) Ports 137-139 option.
  5. Close McAfee SecurityCenter.
Jun 25, 2011

Videos

1. Configuring Windows Firewall - CompTIA A+ 220-1002 - 1.8
(Professor Messer)
2. Windows Firewall - CompTIA A+ 220-1102 - 2.5
(Professor Messer)
3. Why you shouldn't just use Windows Firewall
(The PC Security Channel)
4. 58. How to Create Windows Defender Firewall Rules | Microsoft Intune
(MSFT WebCast)
5. How to manage the Windows Firewall using Group Policy
(Danny Moran)
6. How to Manage Windows 10 Security Including Windows Defender and Windows Firewall
(Simon Sez IT)
Top Articles
Latest Posts
Article information

Author: Lidia Grady

Last Updated: 05/19/2023

Views: 5590

Rating: 4.4 / 5 (45 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Lidia Grady

Birthday: 1992-01-22

Address: Suite 493 356 Dale Fall, New Wanda, RI 52485

Phone: +29914464387516

Job: Customer Engineer

Hobby: Cryptography, Writing, Dowsing, Stand-up comedy, Calligraphy, Web surfing, Ghost hunting

Introduction: My name is Lidia Grady, I am a thankful, fine, glamorous, lucky, lively, pleasant, shiny person who loves writing and wants to share my knowledge and understanding with you.