Firewalls for beginners: what they block and why
In short: A firewall checks network traffic against a list of rules and lets through only what is allowed. It usually blocks connections coming in from the internet while letting replies to your own requests back in. Every home router has one, and so does your computer.
The simple idea
A firewall is a security guard for network traffic. It sits between two places, usually your network and the internet, looks at every connection trying to pass and checks it against a list of rules. Allowed traffic goes through; everything else is blocked.
What a rule looks like
Rules are usually based on a few simple facts about each connection:
- Where it comes from (source IP address or network);
- Where it is going (destination address);
- Which service it is for, identified by the port number (for example 443 for secure websites);
- The action: allow or block.
| # | From | To | Port | Action |
|---|---|---|---|---|
| 1 | Office network | Internet | 443 (HTTPS) | Allow |
| 2 | Internet | Web server | 443 (HTTPS) | Allow |
| 3 | Any | Any | Any | Block |
Rules are read from the top, and the first match wins. The last rule, "block everything else", is called deny by default. It is the most important idea in firewalls: allow only what you need, and block the rest.
Remembering the conversation
Modern firewalls are stateful: they remember connections you started. When your laptop opens a website, the firewall lets the website's reply back in, because it belongs to a conversation you began. A stranger on the internet trying to start a new connection to your laptop is blocked. That is why your home is protected even though you never wrote a single rule.
Network firewalls and device firewalls
- Network firewall: protects a whole network. Your home router has a simple one; businesses use dedicated firewalls.
- Host (device) firewall: runs on one computer, such as Windows Defender Firewall or the macOS firewall. It still protects you on hotel or café Wi-Fi.
Using both is called defence in depth: if one layer fails, the next still helps.
What a firewall cannot do
A firewall controls connections, not intentions. If you click a phishing link, the connection is one you started, so it is allowed. A firewall also does not remove viruses from files: that is the job of antivirus software. See firewall vs antivirus.
Real-world example: the "allow all" rule
A small company has trouble with a new video-meeting system. To "test", someone adds a rule allowing all traffic from the internet to the meeting server, and forgets it. Months later, attackers find a flaw on that server and walk straight in. Reviewing rules regularly, and writing them as narrowly as possible, prevents exactly this mistake.
Try this: on Windows, open Windows Security > Firewall & network protection and check the firewall is on for every network type. Then read firewall types to see how business firewalls go further.
Key takeaways
- A firewall compares traffic with rules and allows or blocks it.
- Rules use source, destination, port and an action; the first match wins.
- "Deny by default" means allow only what is needed.
- Stateful firewalls let replies to your own requests back in.
Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.