Sub topic 21
Windows Defender Firewall Console
This chapter assumes you know what an IP address, a port, and a protocol (TCP or UDP) are. It also assumes you can tell an administrator account from a standard one. By the end you should be able to open the firewall console, read its rules, and choose the right change for a symptom.
What the firewall does
Windows Defender Firewall is a host-based firewall. It runs on the computer itself and filters network traffic by comparing each packet to a list of rules. A rule matches on program, port, protocol, and address. Traffic that matches an allow rule passes. Traffic that matches a block rule is dropped. Traffic that matches nothing follows the profile default.
By default, the firewall blocks inbound connections that no rule allows. It allows outbound connections that no rule blocks. This is why a new server program often works when it contacts other machines but fails when other machines try to reach it.
Two ways to open it
The exam expects you to know both of these entry points.
| Tool | How to open | What it offers |
|---|---|---|
| Windows Defender Firewall (Control Panel) | Control Panel, System and Security | Turn the firewall on or off, allow an app through, restore defaults |
| Windows Defender Firewall with Advanced Security | Run `wf.msc` | Inbound and outbound rules, profiles, connection security rules, monitoring |
The Control Panel page is the simple view. The console opened by wf.msc is a Microsoft Management Console snap-in. Both need administrator rights to make changes.
Network profiles
Windows assigns each network connection to a profile. Each profile has its own firewall settings.
- Domain: the computer is joined to an Active Directory domain and can reach a domain controller. Group Policy usually manages these settings.
- Private: a trusted network such as a home or small office.
- Public: an untrusted network such as an airport or coffee shop. This is the most restrictive profile.
A common mistake is to allow an app on the Private profile and then wonder why it fails at a hotel. The rule only applied to the profile that was checked.
Allowing an app through the firewall
The simplest change is in the Control Panel page.
- Open Windows Defender Firewall and choose Allow an app or feature through Windows Defender Firewall.
- Select Change settings. This needs administrator approval.
- Find the app, or choose Allow another app to browse to its executable.
- Check Private, Public, or both, then select OK.
Check only the profiles you need. Allowing an app on Public exposes it on networks you do not control.
Creating a rule in the advanced console
Use the advanced console when you need to open a specific port or limit a rule to certain addresses.
- Run
wf.msc. - Select Inbound Rules, then New Rule in the Actions pane.
- Choose a rule type: Program, Port, Predefined, or Custom.
- For a port rule, pick TCP or UDP and enter the port number, such as
3389. - Choose the action: Allow the connection, Allow the connection if it is secure, or Block the connection.
- Choose the profiles the rule applies to.
- Name the rule so that you can find it later.
A rule can be scoped further on its Properties page. Under Scope you can limit the remote addresses it accepts, which is safer than opening a port to every address.
The diagram shows how a packet is evaluated against the rules.
Block rules take precedence over allow rules. If two rules conflict, the block wins, so a stray block rule is a common cause of a connection that still fails after you added an allow rule.
Inbound and outbound rules
Inbound rules control traffic arriving at the computer. Outbound rules control traffic leaving it. Most troubleshooting involves inbound rules, because the default outbound policy is permissive. A technician only edits outbound rules when policy requires it, for example to stop a program from reaching the internet.
Rules also have an enabled state. Many built-in rules, such as File and Printer Sharing or Remote Desktop, exist but are disabled until you enable them. Right-click a rule and choose Enable Rule instead of building a new one.
Checking and changing state from the command line
You can inspect the firewall without the console. These commands need an elevated Command Prompt.
netsh advfirewall show allprofiles
netsh advfirewall set allprofiles state on
netsh advfirewall firewall show rule name="Remote Desktop - User Mode (TCP-In)"The first command shows the state and default actions for each profile. The second turns the firewall on for all profiles. The third displays one rule by its display name.
Common problems and fixes
| Symptom | Likely cause | Action |
|---|---|---|
| Other PCs cannot ping this PC | Inbound ICMP echo rule is disabled | Enable the File and Printer Sharing (Echo Request - ICMPv4-In) rule |
| Remote Desktop fails from another PC | Remote Desktop rule is disabled or the port is blocked | Enable the Remote Desktop rule for the correct profile |
| App works at home but not on public Wi-Fi | Rule applies to Private only | Add the Public profile, or reconsider whether it should be exposed |
| Shared folder is unreachable | File and Printer Sharing rules are off | Enable them on the network's profile |
| Rule is added but traffic still fails | A block rule overrides it, or the wrong protocol is set | Review block rules and check TCP versus UDP |
Safe practice
- Do not turn the firewall off to test a problem. Add or enable a rule instead. If you disable it briefly to confirm the cause, turn it back on right away.
- Open the narrowest scope you can: one port, one program, one remote address range.
- Prefer a rule tied to a program over a rule that opens a port permanently.
- Use Restore defaults in the Control Panel page to undo a tangle of changes. It removes custom rules, so note any you need first.
Exam tips
- Know that
wf.mscopens the advanced console. - Know the three profiles and that Public is the most restrictive.
- Know that inbound traffic is blocked by default unless a rule allows it.
- When a scenario says a service fails only from other computers, suspect an inbound rule.
Exercise
A technician enables Remote Desktop on a laptop. The connection works in the office but fails when the user connects from a coffee shop network. The firewall rule is enabled. What is the most likely cause, and where would you check it?
Show answer
The rule is probably enabled only for the Domain or Private profile, while the coffee shop network is classified as Public. Open wf.msc, select Inbound Rules, open the Remote Desktop rule's Properties, and check the Advanced tab to see which profiles it covers. Add Public only if the exposure is acceptable.
Exercise
You added an inbound allow rule for TCP port 8080, but connections are still dropped. Name two things to check in the advanced console.
Show answer
Check for a block rule that matches the same traffic, because block rules override allow rules. Also confirm the rule is enabled, uses the correct protocol (TCP, not UDP), and applies to the active network profile.