ufw
Uncomplicated Firewall management interface
TLDR
Enable ufw
SYNOPSIS
ufw [--dry-run] command [rule]
DESCRIPTION
ufw (Uncomplicated Firewall) is a frontend for iptables designed to make firewall configuration easier. It provides a user-friendly interface for managing netfilter firewall rules while supporting both simple and complex rule specifications.
PARAMETERS
enable
Enable the firewall and load rules on bootdisable
Disable the firewall and unload rulesreload
Reload the firewall configurationreset
Reset to installation defaultsstatus
Show firewall status and rulesstatus verbose
Show detailed status with logging and default policiesstatus numbered
Show rules with line numbers for deletion--dry-run
Show changes without applying them--force
Execute without confirmation prompts
CONFIGURATION
/etc/ufw/ufw.conf
Main configuration file controlling enable/disable state, logging level, and IPv6 support./etc/ufw/before.rules
Custom iptables rules applied before ufw-managed rules./etc/ufw/after.rules
Custom iptables rules applied after ufw-managed rules./etc/default/ufw
Default policy settings and input/output/forward policy configuration.
RULE COMMANDS
allow
Permit matching trafficdeny
Block matching traffic silentlyreject
Block matching traffic and notify senderlimit
Rate-limit connections (blocks after 6+ attempts in 30 seconds)delete
Remove a rule by specification or numberinsert NUM
Add rule at specified positionprepend
Add rule before all others of same IP type
RULE SYNTAX
Simple: ufw allow 22/tcp
With comment: ufw allow 80 comment 'HTTP'
Port range: ufw allow 6000:6007/tcp
Multiple ports: ufw allow 80,443/tcp
From address: ufw allow from 192.168.1.0/24
Full syntax: ufw allow proto tcp from any to any port 80
LOGGING
logging off
Disable logginglogging on
Enable logging (low level)logging low|medium|high|full
Set logging verbosity level
CAVEATS
Default policies are deny incoming, allow outgoing, deny forwarding. Enabling ufw may disrupt existing connections if rules are not configured first. Use --dry-run to preview changes before applying.
HISTORY
ufw was developed by Canonical for Ubuntu to simplify iptables firewall management. It was first released in Ubuntu 8.04 (2008) and has become a popular firewall tool across many Linux distributions.
SEE ALSO
iptables(8), ip6tables(8), ufw-framework(8)
