How to Configure Windows Firewall for Maximum Security
Learn how to properly configure Windows Firewall to protect your PC from network threats. Step-by-step guide with screenshots and advanced settings.
By Mike Torres
Letās talk about Windows Firewall. Hereās the thing most people donāt realize: itās one of your most powerful security tools, and itās already running on your PC. But in my years of securing corporate networks and consulting with home users, Iāve seen countless systems where itās configured incorrectlyāleaving users vulnerable even though they think theyāre protected.
This guide shows you how to actually configure Windows Firewall properlyānot the complicated enterprise setups I used to deploy for businesses, but practical security that works for everyday use. Combined with proper privacy settings, youāll have a solid foundation that blocks real threats without breaking your favorite programs.
What is Windows Firewall?
Windows Firewall monitors and controls network traffic entering and leaving your computer. According to Microsoftās official documentation, it:
- Blocks unauthorized incoming connections
- Can control outgoing connections (with advanced settings)
- Works with different network types (Public, Private, Domain)
- Integrates with Windows Defender for enhanced protection
Quick Security Check
Before diving into configuration, verify your firewall is active:
- Open Windows Security from the Start menu
- Click Firewall & network protection
- Ensure firewall is ON for all three network types:
- Domain networks
- Private networks
- Public networks
šµ MediumImage Needed()Windows Security home screen with Firewall & network protection option highlighted
š Instructions:
Screenshot showing Windows Security app main dashboard with the 'Firewall & network protection' tile visible and clickable
š Filename:
windows-security-firewall-option.pngš Dimensions:
800x600āæ Alt Text:
Windows Security dashboard with Firewall & network protection option
š” Notes:
Show the path to access firewall settings from Windows Security main screen
Warning: Never turn off Windows Firewall unless you have a specific technical reason and alternative protection.
Understanding Network Profiles
Windows uses three network profiles with different security levels. Microsoftās best practices guide explains how each profile balances security and functionality:
Domain Networks
- Connected to a corporate domain
- Managed by IT administrators
- Most permissive (assumes trusted environment)
Private Networks
- Home and work networks you trust
- Medium security level
- Allows file sharing and network discovery
Public Networks
- Coffee shops, airports, hotels
- Highest security level
- Blocks file sharing and network discovery
Best Practice: Always select āPublicā when connecting to untrusted networks.
Hereās the thing about Public networks that I tell every client: Iāve seen people get their data stolen at coffee shops because they selected āPrivateā to get file sharing working. Donāt do this. If you need to share files, wait until youāre on your home network. The five minutes of inconvenience beats dealing with a compromised account.
Basic Firewall Configuration
Changing Network Profile
If Windows incorrectly identifies your network:
- Go to Settings > Network & Internet
- Click on your network connection
- Under Network profile type, choose:
- Public for untrusted networks
- Private for home networks
šµ MediumImage Needed()Windows 11 Network & Internet settings showing network profile type selection between Public and Private
š Instructions:
Screenshot of Settings > Network & Internet with a WiFi or Ethernet connection selected, showing the Network profile type dropdown with Public and Private options
š Filename:
network-profile-selection.pngš Dimensions:
800x600āæ Alt Text:
Windows 11 network profile type selection showing Public and Private options
š” Notes:
Capture the network properties page where users can switch between Public and Private profiles
Allowing Apps Through Firewall
Some programs need network access to function:
- Open Windows Security > Firewall & network protection
- Click Allow an app through firewall
- Click Change settings
- Check boxes for apps you trust:
- Check Private for home network access
- Check Public only if needed on untrusted networks
- Click OK to save
š” HighImage Needed()Windows Firewall allowed apps dialog showing list of applications with Private and Public network checkboxes
š Instructions:
Screenshot of the 'Allowed apps' window in Windows Firewall, showing the list of applications with columns for Private and Public networks, with 'Change settings' button visible
š Filename:
firewall-allowed-apps.pngš Dimensions:
800x600āæ Alt Text:
Windows Firewall allowed apps configuration window
š” Notes:
Show several common apps in the list with checkboxes for Private and Public networks to illustrate the selection process
Security Tip: Only allow apps on Public networks if absolutely necessary.
Blocking an App
To prevent a program from accessing the internet:
- Open Windows Defender Firewall with Advanced Security
- Click Outbound Rules in left panel
- Click New Rule in right panel
- Select Program, click Next
- Browse to the programās .exe file
- Select Block the connection
- Check all profiles (Domain, Private, Public)
- Name the rule and click Finish
Advanced Firewall Settings
Access advanced settings:
- Press Windows + R
- Type wf.msc and press Enter
- Windows Defender Firewall with Advanced Security opens
š” HighImage Needed()Windows Defender Firewall with Advanced Security console showing Inbound Rules, Outbound Rules, and monitoring sections
š Instructions:
Screenshot of the wf.msc advanced firewall interface with the three-pane view: left navigation showing Inbound/Outbound Rules, center pane with rule list, right pane with actions
š Filename:
advanced-firewall-console.pngš Dimensions:
1200x700āæ Alt Text:
Windows Defender Firewall with Advanced Security management console
š” Notes:
Capture the full advanced firewall interface to show users what they'll see when accessing wf.msc
Creating Inbound Rules
Block specific ports or IP addresses:
Block a Port:
- Click Inbound Rules > New Rule
- Select Port, click Next
- Choose TCP or UDP
- Enter specific port number
- Select Block the connection
- Apply to all profiles
- Name the rule descriptively
šµ MediumImage Needed()New Inbound Rule Wizard showing the port configuration step with TCP/UDP selection and specific port number entry
š Instructions:
Screenshot of the New Inbound Rule Wizard at the 'Protocols and Ports' step, showing TCP/UDP radio buttons and the 'Specific local ports' text field with a port number entered
š Filename:
new-inbound-rule-port.pngš Dimensions:
700x500āæ Alt Text:
Windows Firewall New Inbound Rule Wizard port configuration screen
š” Notes:
Show the critical step where users specify which port to block in the rule creation wizard
Block an IP Address:
- Create new Inbound Rule
- Select Custom
- Choose All programs
- Under Scope, add IP address to block
- Select Block the connection
- Apply to all profiles
Creating Outbound Rules
Control which programs can access the internet:
- Click Outbound Rules > New Rule
- Follow similar process to inbound rules
- Use to block:
- Telemetry and tracking (see our Privacy Settings guide for more ways to reduce data collection)
- Unwanted app updates
- Programs that shouldnāt access internet
Monitoring Active Connections
See whatās currently connected:
- In Advanced Firewall, click Monitoring
- Expand Firewall to see active rules
- Expand Security Associations for VPN connections
Recommended Security Rules
Block Common Attack Vectors
Create these inbound rules for extra security. As outlined in Microsoftās SMB security guidance, blocking unused network services reduces your attack surface. In my consulting work, these are the first rules I create on every system I configure:
Block Legacy NetBIOS (if not needed on network):
NetBIOS is a protocol from the 1980sāthink of it as an unlocked back door that modern Windows systems donāt even need anymore. Most home users have zero legitimate reason for NetBIOS to be open, but itās still active by default.
- Block UDP ports 137, 138
- Block TCP port 139
Restrict SMB/CIFS (if not using file sharing):
- Block TCP port 445 from internet traffic
- Note: Keep enabled on trusted networks for file sharing and network discovery
- If you want to completely disable file sharing services, see our guide on disabling unnecessary Windows services
Block Remote Desktop (if not used):
- Block TCP port 3389
Block Telnet:
- Block TCP port 23
Enable Logging
Track blocked and allowed connections. Microsoft recommends enabling logging to monitor suspicious activity and troubleshoot connection issues:
- Right-click Windows Defender Firewall (top of tree)
- Select Properties
- For each profile tab:
- Click Customize under Logging
- Set Log dropped packets to Yes
- Set Log successful connections to Yes
- Note log file location
- Click OK to save
šµ MediumImage Needed()Windows Defender Firewall Properties dialog showing logging customization options with 'Log dropped packets' and 'Log successful connections' set to Yes
š Instructions:
Screenshot of the Firewall Properties dialog on the Domain/Private/Public profile tab, with the Logging section expanded showing the Customize button and logging options enabled
š Filename:
firewall-logging-settings.pngš Dimensions:
600x700āæ Alt Text:
Windows Firewall logging configuration settings
š” Notes:
Show the logging configuration interface where users enable packet logging for security monitoring
Review logs at: C:\Windows\System32\LogFiles\Firewall\pfirewall.log
Firewall Notification Settings
Control when Windows asks permission:
- Go to Windows Security > Firewall & network protection
- Click Firewall notification settings (or Advanced settings)
- For each network type, configure:
- Notify me when firewall blocks a new app
- Block all incoming connections for maximum security
- WARNING: Blocks even explicitly allowed apps, may break network connectivity, VPN, file sharing, and remote access
- Use only temporarily in hostile environments
Troubleshooting Common Issues
Event ID 2042 Warnings (Windows 11 24H2)
If you see Event ID 2042 errors in Event Viewer after recent Windows 11 updates:
- This is a known cosmetic logging issue in Windows 11 24H2
- Your firewall is still functioning normally
- Microsoft acknowledges this is not a functional problem
- No action requiredāitās just a false warning
Program Can't Connect to Internet
If a legitimate program canāt access the internet:
- Check if Windows Firewall is blocking it
- Review firewall logs for blocked connections
- Create an exception for the program
- Test with firewall temporarily disabled (to confirm itās the cause)
Game or App Multiplayer Not Working
Online gaming often requires specific ports to be open:
- Look up required ports for your game
- Create inbound rules allowing those ports
- Only allow on Private network if possible
- Test connection after applying rules
Remote Access Problems (RDP or VPN)
For remote desktop or VPN connection issues:
- Verify remote access rules are enabled in firewall
- Check network profile (should be Private or Domain)
- Confirm port 3389 (RDP) or VPN ports are open
- Test from remote location to verify access
Firewall Best Practices
Doās:
- Keep firewall enabled at all times
- Use Public profile for untrusted networks
- Review allowed apps regularly
- Enable logging to monitor suspicious activity
- Update Windows regularly for firewall improvements
- Only allow necessary apps through firewall
Donāts:
- Disable firewall to āfixā connection problems (find real cause)
- Allow unknown programs through firewall
- Use same security level for all networks
- Ignore firewall notifications (investigate each one)
- Open ports unnecessarily
- Disable for ābetter gaming performanceā (negligible impact)
Third-Party Firewalls
Windows Firewall is sufficient for most users, but some prefer third-party options:
Pros of third-party firewalls:
- More granular control
- Better user interfaces
- Advanced features (application control, IDS/IPS)
- Network traffic monitoring
Cons:
- Additional cost
- May conflict with Windows Firewall
- Potential performance impact
- Learning curve
My Recommendation: Iām often asked if Windows Firewall is really enough. After years of testing and deploying both Windows Firewall and third-party options, hereās my honest answer: Windows Firewall is excellent for most home users. Only consider third-party solutions if you need specific advanced features or centralized management for multiple PCs.
Testing Your Firewall
Verify your firewall is working:
- Visit ShieldsUP! at grc.com
- Click Proceed
- Click All Service Ports
- Wait for scan to complete
- Result should show most/all ports as āStealthā
Note: Some ports may show āClosedā instead of āStealthā - both are secure.
When to Reset Firewall
If firewall rules become messy or problematic:
- Open Windows Defender Firewall
- Click Restore defaults in left panel
- Confirm to reset all firewall settings
- Reconfigure important rules
Warning: This removes all custom rules. Document important rules first.
Conclusion
Properly configured Windows Firewall provides excellent protection against network threats. By following this guide, youāve secured your PC against most network-based attacks while maintaining functionality for legitimate programs.
Remember to:
- Keep firewall enabled always
- Use appropriate network profiles
- Review allowed apps quarterly
- Monitor firewall logs for suspicious activity
- Update Windows regularly
Related Guides:
- Complete Windows Security Guide
- Privacy Settings Guide for Windows 11 - Control data collection and telemetry
- Disable Unnecessary Windows Services - Reduce attack surface and improve performance
- Windows Defender Setup Guide - Complete antivirus configuration
Frequently Asked Questions
What's the difference between Public and Private network profiles?
Private networks are for trusted environments like your home or office. Windows enables network discovery, file sharing, and other features that let devices communicate. This profile is more permissive because you control whoās on the network.
Public networks are for coffee shops, airports, hotelsāanywhere with unknown users. Windows blocks file sharing and network discovery, making your PC invisible to others. Most inbound traffic is blocked even if youāve created allow rules.
Best practice: Always choose Public for networks you donāt control. Yes, itās less convenient, but Iāve seen too many data breaches happen because someone chose Private at a coffee shop to get file sharing working. The five minutes of inconvenience beats dealing with a compromised system.
Should I turn off Windows Firewall if I have third-party antivirus?
No, you should keep Windows Firewall enabled even with third-party antivirus. Hereās why: antivirus and firewalls serve different purposes. Antivirus scans for malware in files, while firewalls control network traffic.
If your third-party security suite includes its own firewall component, it will automatically manage Windows Firewall settings for compatibilityāyou donāt need to disable anything manually. If your third-party software only provides antivirus (not firewall), you definitely need Windows Firewall active for network protection.
The Windows Filtering Platform (which underpins the firewall) is required for networking and security policies in Windows, so the firewall service stays running even if you have third-party security software.
Why does Windows Firewall keep blocking my games or apps?
This happens when apps try to accept incoming network connections but donāt have firewall rules configured. Games with multiplayer, torrent clients, and remote access software commonly trigger firewall blocks.
To fix it:
- Go to Windows Security > Firewall & network protection > Allow an app through firewall
- Click Change settings, find your app in the list
- Check Private for home network access
- Only check Public if you need the app to work on untrusted networks (usually unnecessary for games)
For games, you may also need to create inbound rules for specific portsācheck the gameās documentation for required port numbers. The firewall isnāt trying to ruin your gaming experience; itās blocking suspicious incoming connections until you explicitly allow them.
Will Windows Firewall slow down my internet or gaming performance?
No. Windows Firewall has negligible performance impact on modern hardware. It operates at the network stack level with minimal CPU overheadāweāre talking microseconds of latency that youāll never notice.
Iāve tested this extensively in gaming environments, and thereās no measurable difference in ping, bandwidth, or FPS between firewall enabled and disabled. If youāre experiencing slow internet or gaming lag, the firewall isnāt the causeālook at your ISP connection, router configuration, or background processes instead.
Disabling your firewall for ābetter performanceā is security theater that exposes you to real network threats for zero actual benefit.
How do I know if Windows Firewall is actually protecting me?
You can test your firewall using online port scanning tools:
- Visit ShieldsUP! at grc.com
- Click Proceed, then All Service Ports
- Wait for the scan to complete
- Results should show most ports as āStealthā (invisible) or āClosedā (protected)
If you see many ports showing as āOpen,ā that indicates potential security issues. Review your firewall rules and remove unnecessary exceptions.
You can also enable firewall logging (covered in this guide) to see what connections Windows Firewall is blocking. Review the log at C:\Windows\System32\LogFiles\Firewall\pfirewall.log to see blocked connection attemptsāif youāre online, youāll likely see dozens of blocked probes daily. Thatās your firewall working.
What ports should I block for better security?
If youāre not using specific network services, blocking these common attack vectors improves security:
NetBIOS (legacy protocol, rarely needed): UDP ports 137, 138 and TCP port 139
SMB/CIFS file sharing (if not needed): TCP port 445ābut keep this open on Private networks if you use file sharing
Remote Desktop (if not used): TCP port 3389
Telnet (obsolete, insecure): TCP port 23
However, donāt just start blocking random ports. Windows Firewall already blocks incoming connections by default unless youāve explicitly allowed them. Focus on removing unnecessary āallowā rules rather than creating blocking rules. The guideās āRecommended Security Rulesā section covers this in detail.
Can I use Windows Firewall to block a program from accessing the internet?
Yes, you can create outbound rules to block specific programs:
- Open Windows Defender Firewall with Advanced Security (press Windows+R, type
wf.msc) - Click Outbound Rules > New Rule
- Select Program, browse to the .exe file
- Choose Block the connection
- Apply to all profiles (Domain, Private, Public)
- Name the rule descriptively
This is useful for blocking telemetry, preventing unwanted updates, or stopping programs that shouldnāt access the network. I use this technique to block certain apps from phoning home while still allowing them to function locally.
Note: Some programs are clever and have multiple executables or update mechanisms, so you may need several rules to fully block network access.
Why is my VPN getting blocked by Windows Firewall?
VPN applications frequently trigger Windows Firewall alerts because they modify network routing and create virtual network adapters. This is normal behavior, not a security threat.
To fix VPN blocking:
- When Windows Firewall shows the security alert for your VPN, click Allow access
- Or manually allow it: Windows Security > Allow an app through firewall
- Find your VPN client, check both Private and Public networks
- Make sure your VPNās ports are open (common VPN ports: UDP 500, 4500 and TCP 1723)
If your VPN still doesnāt work after allowing it through the firewall, check if āBlock all incoming connectionsā is enabled for Public networksāthis setting blocks even explicitly allowed apps and will break VPN functionality. Disable it in Firewall notification settings.
Is Windows Firewall enough, or do I need a third-party firewall?
For most home users, Windows Firewall is absolutely sufficient. Iāve deployed both Windows Firewall and third-party solutions in corporate environments, and hereās my honest assessment: Windows Firewall provides excellent protection for typical home use.
When Windows Firewall is enough:
- Youāre a home user with standard security needs
- You donāt need granular per-application outbound control
- Youāre comfortable with the Windows interface
- You want integrated protection without additional software
When to consider third-party:
- You need advanced traffic monitoring and analytics
- You want easier-to-use interfaces for complex rules
- You need intrusion detection/prevention features
- Youāre managing multiple PCs and want centralized control
Third-party firewalls like ZoneAlarm, Comodo, or GlassWire offer more features but add complexity, cost, and potential conflicts. Start with Windows Firewall properly configured (using this guide), and only explore third-party options if you have specific advanced requirements.
Quick Reference
Enable/Disable Firewall: Windows Security > Firewall & network protection
Allow App: Windows Security > Allow an app through firewall
Advanced Rules: Press Windows+R, type wf.msc
View Logs: C:\Windows\System32\LogFiles\Firewall\pfirewall.log
Test Firewall: Visit grc.com/shieldsup
Stay protected and maintain healthy skepticism about programs requesting network access!
Want a tool that handles this automatically?
Fortect scans your PC for corrupted system files, startup bloat, and junk accumulation, then repairs them automatically. We rated it our top pick for PC optimization after hands-on testing.
