iptables and UFW Firewall Rules
Write firewall rules to allow, deny, and log traffic using iptables and the simpler UFW interface.
Linux Firewalls Overview
Linux filters network traffic via the netfilter kernel framework. iptables is the traditional userspace tool; nftables is its modern replacement. UFW (Uncomplicated Firewall) is a simplified frontend for iptables, ideal for Ubuntu/Debian servers.
iptables Chains
iptables uses chains to process packets:
- INPUT — packets destined for the local machine
- OUTPUT — packets originating from the local machine
- FORWARD — packets being routed through the machine
Rules in each chain are evaluated top-to-bottom; first match wins.
All lessons in this course
- File Permissions and Ownership
- User and Group Management
- SSH Hardening and Key-Based Auth
- iptables and UFW Firewall Rules