Beginner
Package: ufw
ufw
Uncomplicated Firewall — simplified iptables management.
Syntax
ufw [command]
Description
ufw provides a much simpler command syntax for the common firewall tasks that would otherwise require verbose iptables rules, and is the default front-end firewall tool on Ubuntu.
Examples
sudo ufw enable
Turn the firewall on
sudo ufw allow 22/tcp
Allow incoming SSH traffic
sudo ufw allow from 192.168.1.0/24
Allow all traffic from a specific subnet
sudo ufw status verbose
Show current rules and firewall state
Primarily Debian/Ubuntu; other distributions typically use firewalld or raw iptables/nftables instead.