DNS Server
Clients must be able to send DNS queries to the server when DNS is required.
Firewall review
Review the role-specific DNS inbound rules and confirm the intended profiles and scope.
Verify
Resolve required names from an authorized client.
Windows Server · Lesson 08
Protect server network exposure without breaking DNS, DHCP, SMB, RDP, WinRM, web services, or other scenario-required roles.
Strong firewall hardening is not about closing everything. It is about allowing exactly what required services need and reducing unnecessary exposure around them.
Lesson Snapshot
Learning objectives
Review Windows Defender Firewall profiles, rules, services, and exposure on Windows Server.
Use Windows Defender Firewall with Advanced Security and PowerShell to inspect firewall state without changing rules blindly.
Understand how Domain, Private, and Public profiles affect server behavior.
Recognize the relationship between firewall rules and required server roles such as DNS, DHCP, SMB, RDP, and WinRM.
Evaluate rule direction, protocol, port, program, service, profile, action, and remote scope before making changes.
Verify required services from the client perspective after firewall hardening.
Core concepts
A firewall configuration context associated with Domain, Private, or Public network classification.
Controls traffic entering the server and is especially important for required server roles and remote administration.
Controls traffic leaving the server. Many environments allow outbound traffic broadly unless a stricter policy is required.
A rule can allow or block matching traffic. The action only matters when the rule actually matches the connection.
Defines which local or remote addresses can use the rule, helping limit exposure without disabling the service.
A firewall rule often exists because a role or service must communicate. Removing the rule may break a required function.
Core idea
Keep the service available while limiting profiles, protocols, ports, programs, services, and remote networks to what the scenario actually requires.
Availability warning
DNS, DHCP, SMB, RDP, WinRM, IIS, and other required services can become unreachable even when their Windows services are healthy.
Tool map
Win + R → wf.mscPrimary GUI for reviewing profiles, inbound rules, outbound rules, monitoring, and connection-security settings.
Start → Server Manager → Local Server → Windows Defender FirewallProvides a high-level firewall status view and a path into firewall configuration.
Start → Windows Security → Firewall & network protectionUseful when the Windows Security interface is available, but Advanced Security provides the deeper rule view.
Group Policy Management → edit the intended GPO → Computer Configuration → Policies → Windows Settings → Security Settings → Windows Defender Firewall with Advanced SecurityUse when firewall configuration is centrally managed by domain Group Policy.
Win + R → services.mscConfirm the required service is running before assuming the firewall is the reason a connection fails.
Start → search PowerShell → Run as administrator when requiredUse Get-NetFirewallProfile and Get-NetFirewallRule with related filter cmdlets for read-only inspection.
Firewall profiles
Normally applies when the server is connected to a network where it can authenticate to its Active Directory domain.
Most domain-member servers and domain controllers rely heavily on this profile for required role communication.
Used for trusted non-domain networks when the network is classified as Private.
A server unexpectedly using Private instead of Domain may indicate network or domain-detection issues.
Designed for untrusted networks and usually deserves the most restrictive exposure.
Required server roles should not be exposed broadly just because a permissive rule applies to Public.
Rule anatomy
An existing rule does nothing if it is disabled.
Inbound and outbound rules affect opposite connection directions.
Allow or Block determines what happens when the rule matches.
A rule may apply only to Domain, Private, Public, or a combination of profiles.
A rule can be tied to a specific executable or Windows service instead of a broad port allowance.
TCP, UDP, ICMP, and other protocols behave differently and should match the service requirement.
The server-side port the rule allows or blocks when port filtering is used.
The remote-side port can also be part of the match conditions.
Can restrict the rule to specific local network interfaces or addresses.
Can narrow which clients or networks are allowed to reach the service.
Role dependencies
Clients must be able to send DNS queries to the server when DNS is required.
Firewall review
Review the role-specific DNS inbound rules and confirm the intended profiles and scope.
Verify
Resolve required names from an authorized client.
DHCP depends on network traffic used for address assignment and renewal.
Firewall review
Protect the DHCP role rules while confirming they are limited to the intended profiles and networks.
Verify
Confirm a client can obtain or renew an IP address.
Authorized clients must reach required file shares.
Firewall review
Review File and Printer Sharing rules rather than opening unrelated ports broadly.
Verify
Connect to the required SMB share from an authorized client.
Authorized administrators may require Remote Desktop access.
Firewall review
Review Remote Desktop inbound rules, profile scope, and remote-address restrictions.
Verify
Test the intended RDP connection from an authorized management system.
Remote administration may require WinRM listeners and matching firewall access.
Firewall review
Review Windows Remote Management rules and keep scope as narrow as the management design allows.
Verify
Test the required remote-management path from an authorized system.
Clients must reach the required website or application.
Firewall review
Allow only the protocol, port, profile, and scope needed by the hosted service.
Verify
Open the required site or application from an authorized client.
PowerShell inspection
Get-NetFirewallProfile | Select-Object Name, Enabled, DefaultInboundAction, DefaultOutboundActionShows profile state and default actions.
Get-NetFirewallRule -Direction Inbound -Enabled True | Select-Object DisplayName, Action, Profile, DirectionCreates a broad inventory of enabled inbound rules.
Get-NetFirewallRule -Direction Outbound -Enabled True | Select-Object DisplayName, Action, Profile, DirectionCreates a broad inventory of enabled outbound rules.
Get-NetFirewallRule -DisplayName "Rule Name" | Format-List *Shows deeper rule metadata. Replace Rule Name with the rule being reviewed.
Get-NetFirewallRule -DisplayName "Rule Name" | Get-NetFirewallPortFilterShows protocol and port conditions for a specific rule.
Get-NetFirewallRule -DisplayName "Rule Name" | Get-NetFirewallAddressFilterShows local and remote address scope for a specific rule.
Get-NetFirewallRule -DisplayName "Rule Name" | Get-NetFirewallApplicationFilterShows whether a rule is tied to a specific executable.
Get-NetFirewallRule -DisplayName "Rule Name" | Get-NetFirewallServiceFilterShows whether a rule is tied to a particular Windows service.
Rule review questions
Which server role or service needs this rule?
Is the rule enabled?
Is it inbound or outbound?
Does the action allow or block traffic?
Which profile or profiles does it apply to?
Is the protocol correct for the required service?
Is the port range narrow or overly broad?
Is the rule tied to a specific program or service?
Can the remote-address scope be narrowed safely?
How will you verify the required service after changing the rule?
Exposure signals
A rule that is not tied to a specific program can be broader than necessary.
Rules allowing broad port ranges deserve extra review.
A rule applying to Domain, Private, and Public may expose the service more broadly than intended.
The rule may accept connections from more networks or clients than necessary.
Multiple similar rules can make it hard to understand which configuration actually permits traffic.
A rule tied to an unfamiliar executable should be investigated before being kept or removed.
Troubleshooting
Symptom
Check
Confirm the service is running, the server is listening, the correct firewall profile is active, the relevant inbound rule is enabled, and the client is within the permitted scope.
Symptom
Check
Review Remote Desktop rules, active profile, remote-address scope, RDP service state, authorized users, and User Rights Assignment.
Symptom
Check
Confirm the DNS Server service is running, zones are healthy, DNS firewall rules are enabled for the correct profile, and the client can reach the server.
Symptom
Check
Check whether Group Policy controls the rule, whether a block rule or different profile applies, and whether the application or service itself is listening.
Symptom
Check
Investigate network category, domain connectivity, DNS, and Network Location Awareness before loosening Public-profile firewall rules.
Symptom
Check
The rule may be managed by Group Policy. Inspect gpresult and the relevant firewall GPO instead of repeatedly editing the local copy.
Narrowing examples
RDP is required, but only systems on a management subnet should connect.
Approach
Keep the required RDP rule and narrow Remote IP address scope to the authorized management network rather than disabling RDP completely.
Verify
Test RDP from an authorized management host and confirm an unrelated host is not permitted.
A file server must serve internal clients but should not expose SMB broadly.
Approach
Keep File and Printer Sharing rules for the required profile and network scope only.
Verify
Open the required share from an authorized client and confirm unintended networks cannot reach it.
A required internal web application listens on a known port.
Approach
Allow the specific protocol and port tied to the required service instead of creating a broad Any/Any rule.
Verify
Open the application from an authorized client and confirm unrelated ports remain closed.
Change discipline
Read the scenario and identify required network services.
Record the active firewall profile.
Record existing rule state before editing.
Confirm the related Windows service or role is actually required.
Narrow one condition at a time.
Avoid broad Any/Any allow rules.
Preserve remote administration before high-impact changes.
Test from an authorized client after each major change.
Check Event Viewer and service health if connectivity breaks.
Document the final rule and why it exists.
Decision cases
The server only needs RDP on the domain network.
RDP is required, but the profile exposure is broader than the scenario needs.
Response
Confirm the active domain-management path, then narrow the rule to the required profile and scope rather than disabling RDP entirely.
The rule allows an unfamiliar executable from any remote address.
The rule could be unnecessary or malicious, but it may also belong to a required application.
Response
Inspect the executable path, publisher, service dependency, listening port, installed application, and scenario requirement before disabling it.
The server is a required DNS server and clients cannot resolve names.
The disabled firewall rule may be blocking a required service.
Response
Confirm DNS Server is healthy and the correct rule/profile is intended, then restore only the required DNS access and verify from a client.
A student disables a rule locally, but it reappears after policy refresh.
Group Policy may own the firewall configuration.
Response
Use gpresult and Group Policy Management to identify the controlling GPO before making further changes.
Fictional defensive lab
Step 01
In the fictional environment, FILE-SRV must provide the TeamDocs SMB share and RDP access for Morgan from the management network.
Step 02
Run wf.msc and record the active profile plus the relevant File and Printer Sharing and Remote Desktop inbound rules.
Step 03
Use Get-NetFirewallProfile and Get-NetFirewallRule to compare GUI state with the PowerShell inventory.
Step 04
The RDP rule allows any remote address. The TeamDocs SMB rule applies to more profiles than the scenario requires.
Step 05
Preserve both required services, but narrow RDP to the authorized management network and restrict SMB to the required profile and client network.
Step 06
From authorized clients, confirm Morgan can still use RDP and required users can still reach TeamDocs. Confirm unintended access is not permitted.
Common mistakes
That removes a major control instead of solving the actual rule, profile, or service problem.
Role-specific rules may be required by DNS, DHCP, SMB, RDP, WinRM, IIS, or another server function.
Broad allow rules solve connectivity by creating unnecessary exposure.
A correct rule on the wrong profile may not affect the connection at all.
Firewall behavior must be verified from the clients that actually depend on the service.
Locally edited firewall rules may be centrally managed and re-applied later.
Reflection
Question 1
Why should a required service usually be narrowed instead of simply blocked?
Question 2
Why does the active firewall profile matter?
Question 3
How can remote-address scope reduce exposure without disabling a service?
Question 4
Why can a firewall rule look correct while the service is still unreachable?
Question 5
What should you inspect before disabling an unfamiliar inbound rule?
Question 6
Why is client-side verification essential after firewall changes?
Verification checklist
The intended firewall profile is enabled.
Default inbound and outbound actions are understood.
Required role-specific rules remain enabled.
Unnecessary broad allow rules have been investigated.
Remote-address scope is as narrow as the scenario allows.
Required DNS, DHCP, SMB, RDP, WinRM, or IIS functions still work as applicable.
Authorized remote administration still works.
Group Policy is not unexpectedly overriding the intended firewall state.
No required application lost network access.
The final firewall configuration is documented.
Competition checklist
Open wf.msc.
Record Domain, Private, and Public profile state.
Run Get-NetFirewallProfile.
Review enabled inbound rules.
Review enabled outbound rules when relevant.
Inspect protocol and port filters.
Inspect program and service filters.
Inspect remote-address scope.
Identify role-specific firewall dependencies.
Check for Group Policy-managed rules.
Avoid broad Any/Any rules.
Verify required services from an authorized client.
Next Windows Server lesson
Next, review update state, patch categories, restart planning, servicing risk, and post-update verification for servers that may host critical roles.