What Is a Firewall? How Your Network Decides What Gets In
A firewall filters traffic between networks using a list of rules. Here is what a firewall does, the main types, and the attacks it cannot stop.
4 min readBeginner Nov 18, 2026
Explain Like I'm Not a Hacker
A security guard at the gate of an apartment complex with a list: residents and expected guests go in, deliveries go to the lobby, and anything unexpected is turned away.
The 30-second explanation
Think of the gate of an apartment complex. A guard checks each car against a list: residents are waved through, guests who are on the list can enter, deliveries go to the lobby, and everything else is turned away. A firewall does the same for network traffic. It looks at where a connection comes from, where it is going and what kind it is, then lets it through or stops it. It cannot see what is inside every car, though, which is why a firewall is a starting point and never the whole defence.
How it works
- 1
1. Connection arrives
A packet reaches the firewall, carrying a source address, a destination address, a port and a protocol.
- 2
2. Rules checked
The firewall works down its rule list, in order, until a rule matches.
- 3
3. Allow or drop
The matching rule decides: permit the traffic, block it, or block it and log it. If nothing matches, the default is to deny.
- 4
4. State remembered
For allowed connections, the firewall records them so that the replies are admitted without needing a new rule.
Every connection across a network has a few visible details: the address it comes from, the address it is going to, a port number that says which service it wants, and a protocol such as TCP or UDP. A firewall reads those details and checks them against its rules, working down the list until one matches. The last rule is usually deny, so anything nobody thought to allow gets dropped. Most firewalls are also stateful. They remember that you started a connection from the inside, so the reply is let back in without a separate rule. That is why you can browse the web from behind one even though outsiders cannot start a connection to your laptop. Different kinds guard different places. A network firewall protects the edge of an office. A host firewall runs on each laptop or server. A web application firewall reads web requests and looks for attacks on a website. Cloud platforms offer the same idea as security groups. The weak point is the traffic that is allowed. A firewall that permits web traffic cannot tell a normal page request from a malicious one hidden inside it, unless it is a newer model set up to inspect that traffic.
Real-world example
A small company runs a web server and a file server in the same office network. The firewall is set to let the public reach the web server on the web ports only, and to let nobody from the internet reach the file server at all. A scan from the internet finds one open service and nothing else. Later, an employee's laptop is infected by a phishing attachment. The firewall cannot help with that, because the infected laptop sits inside and its outbound traffic to the attacker looks like ordinary web browsing on an allowed port. The firewall did its job and the attack still got through, which is why the company also runs endpoint protection and watches outbound connections.
How to spot it
An 'allow any' rule
A rule that permits all traffic from anywhere to anywhere cancels out the rest of the rule set.
Old rules nobody owns
Rules left over from projects that ended, with no one able to say why they exist, are open doors waiting to be found.
Management pages open to the internet
The firewall's own admin interface reachable from outside, especially with a default password.
No logs, or logs nobody reads
Blocked and allowed connections are not recorded, or are recorded and never reviewed.
What to do
- 1Start from default deny and allow only the services and sources that have a clear business reason.
- 2Review the rule list on a schedule, remove rules nobody can justify, and keep the firewall's software up to date.
- 3Send firewall logs to your monitoring system, and pair the firewall with endpoint protection, MFA and a zero trust approach to access.
Stay curious. Stay safer.
This is one piece of a bigger picture. Explore more real-world examples, concepts and tips to build your cybersecurity awareness.
Keep reading
- Fundamentals
Zero Trust Security: Why Being Inside the Network Proves Nothing
4 min read - SOC & Blue Team
SIEM: The Security Camera System for Your Entire Network
4 min read - SOC & Blue Team
EDR: The Flight Recorder on Every Laptop
2 min read - Attacks
DDoS: When a Crowd of Fake Visitors Takes a Website Down
2 min read