Windows Defender Firewall with Advanced Security provides host-based firewall protection and IPsec capabilities to protect Windows servers from network threats.
Windows Firewall uses three profiles that automatically activate based on network location detection.
| Profile | Description | Default Behavior |
|---|---|---|
| Domain | Connected to AD domain network | Allow outbound, block inbound |
| Private | Trusted home/work network | Allow outbound, block inbound |
| Public | Untrusted public networks | Most restrictive settings |
Querying the profile status shows which profiles are active and their default actions for inbound and outbound traffic.
Ensuring the firewall is enabled on all three profiles is a baseline security requirement for every Windows Server.
Windows Firewall supports multiple rule types for comprehensive traffic control.
PowerShell provides comprehensive cmdlets for firewall rule management.
Port-based rules are the most common type. This opens HTTP and HTTPS for a web server but only on domain and private networks.
Program-based rules allow all traffic for a specific executable regardless of port, useful when the application uses dynamic ports.
Restricting source addresses limits who can connect. This rule only allows RDP from the admin subnet, blocking all other sources.
Fine-tune firewall rules with advanced properties for precise access control.
| Property | Description | Example Values |
|---|---|---|
| LocalAddress | Local IP addresses to match | Any, 10.0.0.1, 10.0.0.0/24 |
| RemoteAddress | Remote IP addresses to match | Any, LocalSubnet, Internet |
| LocalPort | Local ports to match | 80, 443, 1024-65535 |
| RemotePort | Remote ports to match | Any, specific ports |
| LocalUser | Authorized local users | Domain\User, SID |
| InterfaceType | Network interface type | Wired, Wireless, RemoteAccess |
Combining multiple properties creates a highly targeted rule. This one restricts WinRM to a specific subnet and authorized user SID.
Query, modify, and maintain firewall rules using PowerShell.
Listing all enabled inbound rules gives you a full picture of what traffic the server currently accepts.
Wildcard searches help you find rules when you only remember part of the display name.
Piping a rule to Get-NetFirewallPortFilter reveals which ports the rule actually targets.
Disabling a rule keeps it defined but inactive, useful for temporarily removing access without losing the configuration.
Modifying an existing rule avoids having to delete and recreate it. Here we expand the allowed source network.
Removing a rule permanently deletes it from the firewall configuration.
Connection security rules configure IPsec authentication and encryption between computers.
IPsec connection security rules enforce mutual authentication between machines. Requiring security on both directions prevents unauthenticated communication.
Configure logging to troubleshoot and audit firewall activity.
Enabling logging for blocked and allowed connections gives full visibility into traffic decisions. The 4MB log size prevents disk exhaustion.
Verify the logging configuration to confirm it was applied correctly across the target profiles.
Deploy firewall rules across the enterprise using Group Policy.
Reference for ports commonly required on Windows servers.
| Service | Protocol/Port | Notes |
|---|---|---|
| DNS | TCP/UDP 53 | Domain Name System |
| LDAP | TCP/UDP 389 | Directory queries |
| LDAPS | TCP 636 | Secure LDAP |
| Kerberos | TCP/UDP 88 | Authentication |
| SMB | TCP 445 | File sharing |
| RDP | TCP 3389 | Remote Desktop |
| WinRM | TCP 5985/5986 | PowerShell Remoting |
| RPC | TCP 135 + Dynamic | Many Windows services |
Diagnose and resolve common firewall-related connectivity problems.
Listing active block rules reveals what the firewall is explicitly dropping, helping you identify why a connection is failing.
Test-NetConnection quickly confirms whether a specific port is reachable from this server to a remote host.
Cross-referencing port filters with enabled rules shows exactly which rules govern a specific port.
The Windows Firewall event log records every rule change and connection decision, invaluable for post-incident forensics.
Practice configuring Windows Firewall rules and security settings.