Initial Configuration and Best Practices

Initial Configuration and Best Practices

Before configuring specific rules, establishing a secure baseline ensures your Windows Server firewall provides maximum protection. Start by enabling the firewall for all network profiles and setting appropriate default behaviors.

Open Windows Defender Firewall with Advanced Security:

# Using PowerShell
Start-Process "wf.msc"

# Or using command line
netsh advfirewall show allprofiles

Configure default settings for maximum security:

# Set default actions to block
netsh advfirewall set allprofiles firewallpolicy blockinbound,allowoutbound

# Enable firewall for all profiles
netsh advfirewall set allprofiles state on

# Configure logging
netsh advfirewall set allprofiles logging filename %systemroot%\system32\LogFiles\Firewall\pfirewall.log
netsh advfirewall set allprofiles logging maxfilesize 4096
netsh advfirewall set allprofiles logging droppedconnections enable
netsh advfirewall set allprofiles logging allowedconnections enable

Enable additional security features:

# Enable stealth mode (block ICMP)
netsh advfirewall firewall add rule name="Block ICMPv4" protocol=icmpv4:any,any dir=in action=block

# Enable unicast response to multicast/broadcast
netsh advfirewall set global unicastresponsetomulticast enable

# Set IPSEC defaults for stronger encryption
netsh advfirewall set global ipsec strongcrlcheck 2