A firewall is a security system that monitors and controls incoming and outgoing network traffic based on defined rules.
It acts as a barrier between a trusted network (like your home or server) and untrusted networks (like the internet).
---
1. Why Do You Need a Firewall?
Without a firewall, your system would be directly exposed to the internet.
A firewall helps to:
- Block unauthorized access
- Protect services and ports
- Prevent attacks
- Control network traffic
2. How a Firewall Works
A firewall checks network traffic and decides:
- Allow the connection
- Block the connection
- Allow port 80 (web server)
- Allow port 443 (HTTPS)
- Block all other incoming traffic
3. Types of Firewalls
1. Network Firewall
- Protects an entire network
- Usually built into routers
- Runs on a single system
- Controls traffic for that device
- UFW (Uncomplicated Firewall)
- iptables / nftables
4. Common Firewall Rules
- All