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!
Need an automated solution?
Save time with professional PC optimization software trusted by thousands of users.
View Top-Rated Tools