Sub topic 16
Firewalls and SOHO Router Hardening
This chapter assumes you know what an IP address, a port, and a router are. It also assumes you can open an elevated PowerShell or Command Prompt window on Windows. By the end you should be able to explain how a firewall decides what to allow, create a Windows Defender Firewall rule, and harden a small office/home office (SOHO) router.
What a Firewall Does
A firewall is a device or program that allows or blocks network traffic according to rules. Each rule looks at details such as the source and destination address, the protocol (TCP or UDP), and the port number. The firewall checks traffic against the rules from the top down. The first rule that matches decides the outcome. If no rule matches, a default action applies.
There are two main kinds on the exam:
- A host-based firewall runs on one computer. Windows Defender Firewall is the example you need to know.
- A network firewall sits between networks. In a SOHO setting, the router usually contains this function and sits between the local network and the internet.
The two work well together. The router firewall protects every device behind it from the internet. The host firewall protects each computer from other devices on the same network, such as an infected laptop.
Stateful and Stateless Filtering
A stateless filter judges every packet by itself. A stateful firewall remembers active connections. If a computer inside the network starts a connection to a web server, the firewall expects the reply and lets it in. Unrequested traffic from outside is dropped. Almost all consumer routers and Windows Defender Firewall are stateful. This is why you can browse the web while the router blocks unsolicited inbound traffic.
Default Deny
A secure firewall uses default deny for inbound traffic. Everything is blocked unless a rule allows it. This follows the least privilege idea from earlier chapters: permit only what is needed. The opposite, default allow, is easier to set up but exposes every service that happens to be listening.
Windows Defender Firewall
Windows Defender Firewall has three profiles. Windows picks one based on the network you join.
| Profile | Used when | Typical posture |
|---|---|---|
| Domain | The computer is joined to an organization's domain and can reach a domain controller | Set by the organization, often through Group Policy |
| Private | You mark the network as trusted, such as a home network | More permissive, allows network discovery |
| Public | Coffee shops, airports, hotels | Strictest, discovery is off |
Choosing "Public" for an unknown network is the safe choice. A common mistake is marking a public Wi-Fi network as Private, which turns on file and printer sharing visibility to strangers.
Rules, Direction, and Ports
Every rule has a direction. An inbound rule controls traffic coming to the computer. An outbound rule controls traffic leaving it. By default, inbound is blocked and outbound is allowed.
The following command creates an inbound rule that blocks Telnet. Telnet is an old remote access protocol on TCP port 23 that sends everything, including passwords, in clear text.
New-NetFirewallRule -DisplayName "Block inbound Telnet" -Direction Inbound -Protocol TCP -LocalPort 23 -Action BlockYou can confirm that the rule exists:
Get-NetFirewallRule -DisplayName "Block inbound Telnet" | Format-List DisplayName, Direction, Action, EnabledRun these from an elevated prompt. Without administrator rights, the creation command fails with an access denied error.
Rules can also be created in the graphical tool, Windows Defender Firewall with Advanced Security (wf.msc). The simpler Control Panel page lets you allow an app through the firewall, which opens ports for that program only.
Common Ports to Know
| Port | Protocol | Service | Note |
|---|---|---|---|
| 20/21 | TCP | FTP | Clear text |
| 22 | TCP | SSH | Encrypted remote shell |
| 23 | TCP | Telnet | Clear text, block it |
| 25 | TCP | SMTP | Sending email |
| 53 | TCP/UDP | DNS | Name lookups |
| 80 | TCP | HTTP | Unencrypted web |
| 443 | TCP | HTTPS | Encrypted web |
| 3389 | TCP | RDP | Remote Desktop |
Port 3389 deserves special care. Exposing Remote Desktop directly to the internet is a frequent cause of break-ins through brute force password guessing.
Troubleshooting Rule Problems
If an app cannot connect, check these in order:
- Is the network profile what you expect?
- Is there a block rule that matches? Block rules usually override allow rules.
- Is the app allowed on the profile currently in use?
- Is a third-party security suite running its own firewall?
Turning the firewall off to "test" is a poor habit. If you must, do it briefly and turn it back on, because malware scans for exposed systems quickly.
SOHO Router Hardening
A SOHO router is the single device between your devices and the internet, so its settings matter a great deal. Routers ship with defaults that are widely known. Hardening means changing those defaults and turning off what you do not need.
Hardening Checklist
- Change the default administrator username and password. Default credentials are published online for nearly every model.
- Update the firmware. Firmware is the router's built-in software. Updates fix security flaws. Enable automatic updates if the router offers them.
- Use strong wireless encryption. Choose WPA3 if all devices support it, otherwise WPA2 with AES. Never use WEP or an open network for private traffic.
- Change the default SSID if it reveals the router brand or model. Disabling SSID broadcast hides the name but is weak protection, since tools can still find the network.
- Disable WPS (Wi-Fi Protected Setup). The PIN method can be guessed by brute force.
- Disable remote management from the internet. Administer the router only from inside the network.
- Disable UPnP if you do not need it. Universal Plug and Play lets devices open ports on the router automatically, and malware can abuse that.
- Turn off unused services and physical ports.
- Place guest devices and IoT gadgets on a guest network, separate from your computers.
Port Forwarding, Port Triggering and the DMZ
These features let outside traffic reach inside devices, so each one widens your attack surface.
- Port forwarding sends traffic arriving at a chosen external port to a fixed internal address and port. It stays open all the time. Example: forward external TCP 8080 to a camera server at 192.168.1.50 port 80.
- Port triggering opens a port only after an inside device makes an outbound connection on a trigger port. It closes again afterward, so it is less exposed than forwarding.
- A DMZ (demilitarized zone) host on a SOHO router receives all unsolicited inbound traffic. Putting a computer in it effectively removes the router's protection for that machine. Avoid it.
Forward only the ports you need, to specific devices, and delete the rules when the need ends.
Other Router Controls
- MAC filtering allows or blocks devices by hardware address. Attackers can copy a MAC address, so this is a minor measure and does not replace encryption.
- Content filtering blocks categories of sites or specific addresses, which is useful for families and small offices.
- DHCP reservations assign a fixed IP to a known device, which makes forwarding rules and troubleshooting simpler.
- Static WAN IP, QoS, and logging can be set up, but they are not security settings by themselves. Reviewing logs can reveal repeated failed logins.
Common Errors and Edge Cases
- Assuming the router firewall is enough. Threats that arrive through email or a USB drive start inside the network, so the host firewall still matters.
- Leaving a forwarding rule in place after a test. The service stays reachable from the internet indefinitely.
- Forgetting the profile. A rule set for the Private profile does nothing on a Public network.
- Locking yourself out. If you block the port used for your own remote session, you lose access. Test rules on a local console when possible.
- Confusing NAT with a firewall. NAT (network address translation) lets many private addresses share one public address. It happens to hide internal hosts, but blocking is the firewall's job.
- Skipping a reset plan. If you forget the router password after changing it, a factory reset restores the defaults and erases all your settings. Save a backup of the configuration and store the new password in a password manager.
Exercises
Exercise
A technician installs a new router at a small office. List four changes that harden it before it goes into use.
Show answer
Change the default administrator password, update the firmware, set WPA2 with AES or WPA3 for the wireless network, and disable WPS. Other valid answers are disabling remote management, disabling UPnP, and using a guest network for visitors.
Exercise
A laptop works on the office network but cannot be reached by a file-sharing app at a hotel, even though the same firewall rule exists. What is the most likely cause?
Show answer
The rule applies only to the Private (or Domain) profile, and the hotel network is treated as Public. Create or enable the rule for the Public profile only if you trust the risk, or keep it blocked.
Exercise
What is the difference between port forwarding and port triggering?
Show answer
Port forwarding keeps an external port permanently mapped to a fixed internal device. Port triggering opens a port only after an inside device makes an outbound connection on a trigger port, and closes it afterward, so it exposes less.