A perimeter firewall never sees traffic between servers on the same network, which is exactly where attacks spread. Here is how to turn Windows Firewall on without breaking production.
Your network has a perimeter firewall. Your servers sit behind it, joined to the domain, on a network you trust. Do they still need Windows Firewall?
Most Windows servers I inherit have it turned off. When I ask why, the answer is almost always the same: “something broke once.” Nobody remembers what broke, or when. The setting just stayed.
I have been a network and system administrator for more than 25 years, and I have had this discussion many times. Here are both sides, and the way I turn it back on without breaking production.
The arguments are real, and I don’t want to dismiss them.
The perimeter firewall already filters what comes from the internet. Internal traffic is between your own machines. Every extra filter is one more place to look when an application stops working, and line-of-business applications are not always documented. Some use dynamic ports, some were installed years ago by someone who left. For a small team, “it works with the firewall off” is an answer that costs nothing today.
The perimeter firewall sees traffic that crosses it: in and out of the network. It does not see a connection from one server to another server on the same network. That traffic never reaches it.
This is exactly how attacks spread after the first machine is compromised. SMB on 445, RDP on 3389, WinRM on 5985, RPC. From one infected workstation or server to the next, inside the network, where nothing filters. On a flat network with host firewalls off, every machine can reach every listening service on every other machine.
Windows Firewall is the only filter that sits on that path. It is already installed, it is free, and it can be managed centrally with Group Policy.
One thing first, whatever you decide: if you turn it off, turn off the profiles, not the service. Microsoft states clearly that stopping the service behind Windows Firewall is not supported. The service also applies the service hardening rules for Windows’ own network services.
My answer to the question is: on. But not by flipping a switch. First find out what it would block.
Run the PowerShell code below:
Get-NetFirewallProfile | Select-Object Name, Enabled, DefaultInboundAction, LogAllowed, LogBlocked
Get-Service MpsSvc
Get-NetFirewallRule -Enabled True -Direction Inbound -Action Block | Select-Object DisplayName
The last line matters for the next step. Explicit block rules are enforced even when the default action is Allow.
Set-NetFirewallProfile -Profile Domain -Enabled True -DefaultInboundAction Allow `
-LogAllowed True -LogBlocked True -LogMaxSizeKilobytes 32767
The firewall is now active, but the default inbound action is Allow. Nothing new is blocked. Every accepted inbound connection is written to %SystemRoot%\System32\LogFiles\Firewall\pfirewall.log.
The log has a limit of 32767 KB. When it is full, it is renamed to pfirewall.log.old, and the previous .old file is overwritten. On a busy server this happens in hours, so copy the log out regularly with a scheduled task.
The other source is Windows Filtering Platform auditing:
auditpol /set /subcategory:"Filtering Platform Connection" /success:enable
Event 5156 in the Security log records every permitted connection, including the path of the application that accepted it. That is useful when several services share a server. The volume is high, so I enable it only for the observation window and turn it off after.
How long to observe? At least one full business week. Better, one that includes the end of the month. The connections you miss are the ones that happen once a month: a backup job, a report, an accounting export.
$log = "$env:SystemRoot\System32\LogFiles\Firewall\pfirewall.log"
$fields = ((Get-Content $log -TotalCount 10 | Where-Object { $_ -like '#Fields:*' }) -replace '#Fields: ', '') -split ' '
Get-Content $log |
Where-Object { $_ -and $_ -notlike '#*' } |
ConvertFrom-Csv -Delimiter ' ' -Header $fields |
Where-Object { $_.action -eq 'ALLOW' -and $_.path -eq 'RECEIVE' } |
Group-Object protocol, 'dst-port' |
Sort-Object Count -Descending |
Select-Object Count, Name, @{ n = 'Sources'; e = { ($_.Group.'src-ip' | Sort-Object -Unique) -join ', ' } }
Run it on the .old files you collected as well. The output is a short list: protocol, port, and who connects to it.
On a file server you will see 445 from the user networks, 3389 from the admin network, maybe 5985 from your management server. On a domain controller the list is longer, with many ports in the 49152-65535 range. That is dynamic RPC, and it has its own rule type.
Start with the built-in rule groups, they are already written for Windows roles:
Enable-NetFirewallRule -DisplayGroup "File and Printer Sharing"
Then add your own, scoped to the networks that really connect:
New-NetFirewallRule -DisplayName "RDP from admin network" -Direction Inbound -Profile Domain `
-Protocol TCP -LocalPort 3389 -RemoteAddress 10.10.50.0/24 -Action Allow
For dynamic RPC, don’t open the whole high port range. Use the RPC keywords instead: one rule with -LocalPort RPCEPMap for the endpoint mapper on 135, and one with -LocalPort RPC for the dynamic ports, both scoped with -RemoteAddress.
The -RemoteAddress part is the one the perimeter firewall can never give you. It is the difference between “this server listens on 3389” and “only the admin network can reach 3389 on this server.”
On a test server, local rules are fine. In production, put them in a Group Policy Object, so every server of the same role gets the same rules.
Set-NetFirewallProfile -Profile Domain -DefaultInboundAction Block
Keep LogBlocked on, and check the DROP lines every day in the first week. Change one line in the script from Step 3, ALLOW to DROP. Every drop is one of two things: a rule you missed, or a connection that should not exist. Both are worth knowing.
The rollback is one command, and it is not “turn it off”:
Set-NetFirewallProfile -Profile Domain -DefaultInboundAction Allow
The service keeps running, logging continues, and you are back in observation mode.
Rarely. There are appliance-like systems where the vendor supports the product only with the host firewall off. Then compensate: put them in their own network segment, filter between segments, and write down why it is off and who decided. “Something broke once” is not a reason.
The perimeter firewall guards the door. Windows Firewall guards each room.
In my experience, after a week of logs the rule list is shorter than people expect. Most servers listen on a handful of ports, for a handful of networks. The work is about one afternoon per server role. The risk you remove is the one the perimeter firewall never saw.