Guide
Windows Defender Firewall Basics
This guide explains the basics of Windows Defender Firewall and how it helps control network traffic on a Windows device.
The goal is to understand firewall profiles, inbound rules, outbound rules, and simple troubleshooting checks.
Step 1
What is Windows Defender Firewall?
Windows Defender Firewall is a built-in Windows security feature that controls network traffic going into and out of a device.
It helps protect the device by blocking unwanted connections and allowing only approved traffic.
Inbound traffic: connections coming into your device.
Outbound traffic: connections leaving your device.
Rules: settings that allow or block specific traffic.
Profiles: firewall settings based on the network type.
Step 2
Understand firewall profiles
Windows uses different firewall profiles depending on the network the device is connected to.
Domain: used when the device is connected to a company domain network.
Private: used for trusted networks, such as home or internal networks.
Public: used for untrusted networks, such as public Wi-Fi.
The Public profile is usually the most restrictive because the network is not trusted.
PS C:\Users\Hawkode> Get-NetFirewallProfile
Step 3
Open the firewall console
The advanced firewall console lets you view inbound rules, outbound rules, connection security rules, and monitoring.
Press Windows + R, type:
wf.msc
Then press Enter.
Step 4
Understand inbound rules
Inbound rules control traffic coming into the device.
Example: if another device needs to connect to a service running on your computer, an inbound rule may be needed.
Allow rule: permits matching inbound traffic.
Block rule: blocks matching inbound traffic.
Port rule: controls traffic by port number, such as TCP 3389 for RDP.
Program rule: controls traffic for a specific application.
PS C:\Users\Hawkode> Get-NetFirewallRule -Direction Inbound -Enabled True
Step 5
Understand outbound rules
Outbound rules control traffic leaving the device.
In many Windows setups, outbound traffic is allowed by default unless a rule blocks it. In stricter environments, outbound traffic may be controlled more closely.
Allow outbound: lets a program or service connect out.
Block outbound: prevents a program or service from connecting out.
Security use: helps stop unwanted programs from communicating externally.
PS C:\Users\Hawkode> Get-NetFirewallRule -Direction Outbound -Enabled True
Step 6
Check if the firewall is enabled
Before changing rules, check if Windows Defender Firewall is enabled for each profile.
PS C:\Users\Hawkode> Get-NetFirewallProfile | Select-Object Name, Enabled
Example output:
Name Enabled
---- -------
Domain True
Private True
Public True
Step 7
Create a simple allow rule
Example: allow inbound TCP traffic on port 8080.
PS C:\Users\Hawkode> New-NetFirewallRule -DisplayName "Allow TCP 8080" -Direction Inbound -Protocol TCP -LocalPort 8080 -Action Allow
This creates an inbound rule allowing TCP traffic to local port 8080.
Only open ports when there is a clear reason. Unnecessary open ports increase risk.
Step 8
Create a simple block rule
Example: block outbound traffic for a specific program.
PS C:\Users\Hawkode> New-NetFirewallRule -DisplayName "Block Example App" -Direction Outbound -Program "C:\Path\To\App.exe" -Action Block
Be careful with block rules. Blocking the wrong program can break updates, remote access, business apps, or security tools.
Step 9
Test if a port is reachable
PowerShell can test basic TCP connectivity to another device and port.
PS C:\Users\Hawkode> Test-NetConnection 192.168.1.50 -Port 3389
Successful test: the device can reach the target port.
Failed test: check firewall rules, service status, routing, VLAN, DNS, or the network path.
Step 10
Common troubleshooting checks
Is the service running? A firewall rule will not help if the service is stopped.
Is the device reachable? Test basic network connectivity first.
Is the correct profile active? Domain, Private, and Public can have different rules.
Is there a block rule? Block rules can prevent traffic even when allow rules exist.
Is the port correct? Confirm the application uses the port you are testing.
Is the rule scoped? Some rules only apply to specific IP ranges or profiles.
Step 11
Disable rules instead of deleting them
When troubleshooting, it is safer to disable a rule instead of deleting it. This makes it easier to restore the previous configuration.
PS C:\Users\Hawkode> Disable-NetFirewallRule -DisplayName "Allow TCP 8080"
PS C:\Users\Hawkode> Enable-NetFirewallRule -DisplayName "Allow TCP 8080"
Step 12
Document the change
Firewall changes should be documented because they affect access and security.
Reason: why the rule was created or changed.
Direction: inbound or outbound.
Protocol: TCP or UDP.
Port: port number if used.
Program: application path if it is a program rule.
Scope: any IP address restrictions.
Profiles: Domain, Private, or Public.
Testing: how the change was verified.
Summary
Quick firewall checklist
1. Identify what traffic should be allowed or blocked.
2. Check the active firewall profile.
3. Confirm the service or application is running.
4. Check existing inbound and outbound rules.
5. Test connectivity with Test-NetConnection.
6. Create or adjust a rule only when needed.
7. Limit the rule to the correct profile, port, program, or IP range.
8. Test the result.
9. Document the change.
Why It Matters
Why this matters in IT and security
Host-based firewalls help reduce exposed services, control traffic, and limit unnecessary access to a device.
Understanding firewall rules is useful for troubleshooting blocked applications, remote access issues, internal services, and basic endpoint hardening.