Firewalls and Network Segmentation
Use stateful firewalls, allow-list rules and network segments so a single compromised machine cannot reach everything else.
Beginner · about 8 hours · difficulty 2/5
Learn first: Subnetting, Ports and Common Services
A firewall decides which traffic is allowed between networks or hosts. Segmentation splits a flat network into zones so that trust is not shared by default. Together they limit how far a problem can spread, which defenders call reducing the blast radius.
Key ideas
- Stateless vs stateful: a stateful firewall tracks connections, so replies to allowed outbound traffic are permitted automatically.
- Default deny: block everything, then allow only the flows the business needs. Rules should name source, destination, port and a reason.
- Host firewalls (Windows Defender Firewall,
nftables/ufwon Linux) protect each machine even inside a trusted zone. - Zones and VLANs: separate user laptops, servers, management interfaces, guest Wi-Fi and OT/IoT devices.
- Egress filtering: controlling outbound traffic is just as important as inbound, because it limits data exfiltration and malware call-backs.
How to work with rules
- Keep a rule inventory with an owner and review date for every rule.
- Remove "any/any" rules and temporary rules that became permanent.
- Log denied traffic and review it; unexpected denies often reveal misconfigured or compromised hosts.
Pitfalls
- Segments that exist on a diagram but are fully routable in reality.
- Management ports (RDP, SSH, admin panels) reachable from user networks.
Good enough to move on: you can design a small network with at least four zones, write the allow rules between them, and explain what each rule is for.
Key concepts
- Stateless vs stateful filtering
- Default deny and allow-listing
- Host firewalls (ufw, nftables, Windows)
- VLANs and security zones
- Egress filtering
- Next-generation firewall features: App awareness, user identity, URL filtering
- Rule reviews and hygiene
Mini project
Draw a segmented design for a small company (users, servers, management, guest Wi-Fi), write a rule table with justifications, then implement host firewall rules on two lab VMs and prove blocked traffic is logged.
Check yourself
Why does egress filtering matter even if inbound traffic is locked down tightly?
Free resources
- NIST SP 800-41 Rev. 1: Guidelines on Firewalls and Firewall Policy (NIST)
- UFW community documentation (Ubuntu)
- Windows Defender Firewall overview (Microsoft Learn)