A firewall controls which network traffic is allowed or blocked. Think of it as a security guard that checks every visitor before entering a building.
- Network firewall: Protects the entire network.
- Host-based firewall: Protects a single device.
- Web Application Firewall (WAF): Protects websites from attacks like SQL Injection.
Example:
A server may block all ports except 443 (HTTPS) to prevent hackers from accessing other services.