Home›Community›What is a firewall and how does it work?
What is a firewall and how does it work?
Coding Now Expert •
Jun 13, 2026 •
253 views
A firewall is a network security system that monitors and controls incoming/outgoing traffic based on predefined rules.
**Types of firewalls:**
1. **Packet filtering** — checks IP, port, protocol. Fast but basic.
2. **Stateful inspection** — tracks active connections. Blocks packets out of state.
3. **Application layer (Layer 7)** — inspects actual content (HTTP, FTP). Can block malware in traffic.
4. **Next-Gen Firewall (NGFW)** — combines all above + IPS, deep packet inspection, app awareness.
**Example rule:**
```
DENY inbound TCP any → :22 (block SSH from outside)
ALLOW inbound TCP any → :443 (allow HTTPS)
DENY all any any → any (default deny)
```