Skip to content
Follow
Windows 🟡 Intermediate

How to Set Up and Configure Windows Defender Firewall for Maximum Security

Richard
Written by
Richard
Updated 10 min read
How to Set Up and Configure Windows Defender Firewall for Maximum Security
How to Set Up and Configure Windows Defender Firewall for Maximum Security

Windows Defender Firewall is a built-in security tool that filters incoming and outgoing network traffic to block unauthorized access to your computer. Every Windows 10 and Windows 11 PC includes it, turned on by default, to stop hackers and harmful apps from reaching your files over the internet.

Advertisement

The default settings are a good start, but they leave some gaps. Outgoing traffic is allowed by default, and every app you install can add its own allow rules without asking you. Spending a few minutes on your firewall rules gives you control over which apps can connect to the network.

This guide uses the Windows Security app in Windows 11 version 23H2. You will work with all three built-in network profiles: Domain, Private, and Public. The first half covers the basic settings. The second half covers the advanced console, where you build custom rules. Changes to firewall settings need an administrator account. If a button is greyed out, you are probably signed in with a standard account, or a work or school policy manages the setting.

⚡ Quick Answer

Open Windows Security, click Firewall & network protection, and confirm Microsoft Defender Firewall is on for all three profiles: Domain network, Private network, and Public network. If any show a warning icon, click that profile and toggle Microsoft Defender Firewall on.

Advertisement

Understanding Windows Defender Firewall and Network Protection

Windows Defender Firewall filters all incoming and outgoing network traffic. It sits between your device and the network and stops suspicious data before it can compromise your files or privacy.

The firewall inspects data packets, which are small chunks of data traveling between your computer and other devices. It checks each packet against a set of safety rules and decides whether to let it through or block it. By default, unsolicited incoming traffic is blocked unless a rule allows it. Outgoing traffic is allowed unless a rule blocks it.

Advertisement

Windows sorts your connections into network types, called profiles. Each profile has its own firewall settings, so you can be strict in a café and relaxed at home:

  • Domain networks: This profile applies when your PC is joined to a company domain and connected to that network. You will mostly see it on work computers. An administrator usually controls its settings.
  • Private Networks: You choose this setting for trusted locations, such as your home network or a secure office network. Here, your computer can share files and printers with other trusted devices.
  • Public Networks: You choose this setting for untrusted locations, such as public Wi-Fi at a coffee shop, airport, or hotel. This profile applies maximum security because anyone around you could be a potential threat.

If Windows put a network in the wrong profile, you can change it. Go to Settings Network & internet, open your Wi-Fi or Ethernet connection, and set the Network profile type. Choose Public network if you are unsure.

The firewall lowers your risk of infection by blocking unauthorized remote access. It also helps stop malicious software from secretly talking to remote servers controlled by attackers. That second job is limited by default, because outgoing traffic is allowed. A later section shows how to tighten it.

How to Access and Check Your Firewall Status

Start by checking that the firewall is on for every profile. The Windows Security app shows this on one screen. It also shows which profile your PC is using right now.

Advertisement
  1. Click the Start button on your taskbar and type Windows Security into the search box.
  2. Select the Windows Security app from the search results. The app opens with a list of protection areas.
  3. Click Firewall & network protection in the main window. You will see three entries: Domain network, Private network, and Public network.
  4. Review the status of each one. The profile your PC is currently using is labeled (active). A healthy profile says that Microsoft Defender Firewall is on, with no warning icon.

If you see a red or yellow warning symbol, the firewall is off for that profile. Click that network, then click Turn on or use the toggle switch under Microsoft Defender Firewall. The warning should clear straight away.

If the firewall keeps turning itself off, check for third-party security software. Some antivirus suites take over firewall duties and switch Windows Defender Firewall off. Windows Security then shows a message that another provider is in charge. Running two firewalls at once can cause connection problems, so leave that arrangement alone unless you want to change it.

Configuring Core Firewall Settings for Maximum Protection

⚠️WarningThe core settings are all in the Windows Security app.

The most protective one is blocking all incoming connections, including those that match an allowed rule. This keeps unwanted traffic out, but it can break some things, so use it deliberately.

Advertisement
  1. Open the Windows Security app from your Start menu .
  2. Click Firewall & network protection.
  3. Click the network profile currently active on your computer, such as Public network. A page opens with the settings for that profile only.
  4. Find the Microsoft Defender Firewall section.
  5. Make sure the toggle switch is set to On. Approve the User Account Control prompt if one appears.
  6. Under Incoming connections, select the checkbox labeled Block all incoming connections, including those in the list of allowed apps. This step requires administrator privileges.

Blocking everything gives you the highest level of lockdown, so it suits untrusted public networks. It may break local file sharing, remote desktop access, or apps that stream to other devices. Outgoing connections still work, so normal web browsing is unaffected. To undo it, clear the checkbox on the same page. No restart is needed either way.

Next, make sure notifications are on so you know when the firewall blocks a program.

  1. On the same profile page, find the Notifications section if your build shows it.
  2. Check that the option to be notified when Microsoft Defender Firewall blocks a new app is turned on.
Advertisement

Now review which apps are allowed through.

  1. Return to the main Firewall & network protection screen.
  2. Click Allow an app through firewall. The classic Allowed apps window opens with a list of programs and checkboxes for Private and Public.
  3. Click Change settings. This step requires administrator privileges. The checkboxes become editable.
  4. Review the list. Clear the checkbox for any program you do not recognize or no longer use, then click OK.

Be careful with entries that look odd. Many of them are Windows features such as Core Networking or Remote Assistance. Search for a name before you remove it. If you uncheck something by mistake, open the same window and tick it again.

Creating Advanced Custom Rules for Enhanced Security

The basic settings cover most situations. Sometimes you need a rule for a specific network port, IP address, or program. The Windows Defender Firewall with Advanced Security console lets you build those rules. It opens in its own window and has three panes. The left pane lists rule types, the middle pane shows an overview or the rules themselves, and the right pane holds actions.

Advertisement

Keep in mind that Windows already blocks unsolicited incoming traffic. A block rule is most useful when something else has opened that traffic, such as an allow rule an installer created. A block rule always takes priority over an allow rule.

Creating an Inbound Port Rule

An inbound port rule blocks or allows traffic arriving on a specific port. Ports are numbered channels that apps use to communicate. This lets you close the exact port an app uses, or one that a known threat targets.

  1. Click your Start button, type Windows Defender Firewall with Advanced Security, and open the tool. This step requires administrator privileges. The console opens with a left pane of rule types.
  2. Click Inbound Rules in the left-hand menu. A list of existing rules appears.
  3. Click New Rule… in the right-hand actions panel. The New Inbound Rule Wizard opens.
  4. Select Port and click Next.
  5. Choose either TCP or UDP, then select Specific local ports and type your port number (for example, 80 or 443). Click Next.
  6. Select Block the connection and click Next.
  7. Check all network profiles (Domain, Private, Public) and click Next.
  8. Give your rule a clear name, such as Block Custom Port, and click Finish. The new rule appears in the Inbound Rules list.

Be careful with ports 80 and 443. Those are normal web ports, and blocking them inbound can break a web server you run on the PC. Blocking them does not stop your own browsing, which uses outbound traffic. To undo the rule, select it in the list and click Disable Rule or Delete in the right-hand panel. The rule takes effect immediately and needs no restart.

Advertisement

Creating an Inbound Program Rule

A program rule blocks incoming network access for one application, whatever port it uses. This is handy when you do not want a specific program to accept connections from the network.

  1. Open the Windows Defender Firewall with Advanced Security tool. This step requires administrator privileges.
  2. Click Inbound Rules in the left-hand menu.
  3. Click New Rule... in the right-hand actions panel.
  4. Select Program and click Next.
  5. Select This program path, click Browse, and pick the program file (for example, C:\Program Files\ExampleApp\app.exe). Click Next.
  6. Select Block the connection and click Next.
  7. Select the network types where this rule applies and click Next.
  8. Type a descriptive name for the rule and click Finish. The rule shows up in the Inbound Rules list.

Check that you picked the right file. Some apps have a launcher and a separate service executable, and the rule only covers the file you chose. If the app stops working in a way you did not expect, disable or delete the rule from the right-hand panel.

Unique Security Angle: Monitoring Outbound Traffic

⚠️WarningControlling outbound traffic helps you catch malicious software trying to send your data to a remote server.

By default, Windows allows all outbound traffic, so a rogue program can reach out unless a rule stops it. Changing the default to block outgoing connections means every program needs an allow rule to reach the network. This is the strictest setting in this guide.

  1. Open the Windows Defender Firewall with Advanced Security tool. This step requires administrator privileges.
  2. Right-click Windows Defender Firewall with Advanced Security at the top of the left menu and select Properties. A dialog opens with a tab for each profile.
  3. Select the tab for your active profile (such as Public Profile).
  4. Find the Outbound connections setting and change it from Allow (default) to Block.
  5. Click Apply and then OK. The change takes effect immediately.

Expert tip: Blocking all outbound traffic by default will stop normal web browsing and app updates until you create outbound rules allowing trusted programs (like your web browser) to access the internet. Windows has built-in outbound rules for some core features, but many third-party apps will need their own. Only use this setting if you are prepared to manage individual app permissions.

If you lose your connection after this change, undo it. Return to the same dialog, set Outbound connections back to Allow (default), and click Apply. It is best to test the setting on the Public profile first, then roll it out to others.

Unique Security Angle: Auditing Firewall Logs for Suspicious Activity

The firewall can log blocked connection attempts, so you can spot repeated attacks or find out why an app cannot connect. Logging is off by default, so you have to turn it on for each profile.

  1. Open the Windows Defender Firewall with Advanced Security tool. This step requires administrator privileges.
  2. Click Windows Defender Firewall Properties in the Overview pane in the middle of the console. A properties dialog opens.
  3. Select the tab for the network profile you want to monitor (for example, Public Profile).
  4. Find the Logging section and click the Customize button next to it. A logging settings dialog opens.
  5. Change Log dropped packets to Yes.
  6. Change Log successful connections to Yes if you want to track authorized traffic as well. This makes the log grow quickly, so leave it off unless you need it.
  7. Note the log file path (typically C:\Windows\system32\LogFiles\Firewall\pfirewall.log) and click OK. Then click OK again in the properties dialog to save.

Open the log file in a text editor such as Notepad to review blocked connection attempts, IP addresses, and port numbers. The folder is protected, so you may need to run Notepad as administrator, or copy the file to your desktop first. Each line shows the date, the action (DROP or ALLOW), the protocol, and the source and destination addresses and ports. Many drops from the same source address are a sign worth investigating.

The log has a size limit, set in the same logging dialog. When it is reached, Windows overwrites older entries. Set the log options back to No when you are done if you do not want it to keep growing.

Have a question about this guide?

Answered by AI from this guide. Good questions may be added to this page — please don't include personal details.

Tags: #Windows 11

Did this guide fix your problem?

Richard

About the Author

Richard

Tech Writer, IT Professional

Richard is a writer at Geek Rewind who turns complex IT tasks into clear, step-by-step guides. He draws on years of hands-on experience in system administration and enterprise IT operations, focusing on Windows, Linux and WordPress: the problems people actually run into, and the fixes that work. His server and WordPress guides come from systems he runs himself. Richard builds and maintains the platform behind Geek Rewind, from its Ubuntu servers and Nginx configuration to its custom WordPress plugins. Many new tutorials start with readers' questions, and he's always glad to answer them in the comments.

Advertisement

No comments yet — be the first to share your thoughts!

Leave a Comment

Your email address will not be published. Required fields are marked *