ufw-default
Set Uncomplicated Firewall default incoming, outgoing, and routed policies
TLDR
SYNOPSIS
ufw [--dry-run] default allow|deny|reject [incoming|outgoing|routed]
DESCRIPTION
ufw default sets the fallback policy Uncomplicated Firewall uses for a traffic direction when no earlier user rule matches. It is a ufw subcommand, not a separate binary.On a fresh install the policies are deny incoming, allow outgoing, and deny routed/forwarded traffic, with stateful tracking of NEW incoming and forwarded connections. Changing a default does not rewrite existing user rules; those must be migrated by hand if they assumed the old fallback.deny silently drops packets. reject sends an explicit refusal (typically ICMP unreachable or TCP reset). Use allow as a default only when you intend to block with explicit deny/limit rules instead.Default policies live in `/etc/default/ufw` and are applied when the firewall is enabled or reloaded. Inspect the live values with `ufw status verbose`.
PARAMETERS
default
Change the policy that applies when no user rule matchesallow
Accept unmatched traffic in that directiondeny
Drop unmatched traffic silently (iptables/nftables DROP)reject
Refuse unmatched traffic and notify the peer (REJECT)incoming
Traffic destined for this host (INPUT). Installation default is denyoutgoing
Traffic originating on this host (OUTPUT). Installation default is allowrouted
Forwarded traffic (FORWARD). Installation default is deny (disabled forwarding)--dry-run
Show what would change without applying it
INSTALL
CAVEATS
Requires root or sudo. Changing a default policy can flush ufw's chains while the new policy is applied, which may drop existing connections (including SSH). Preview with `--dry-run` first. If the default is reject, rules added outside the ufw framework may not behave as expected. Setting routed to allow is not enough for a gateway: IP forwarding must also be enabled (for example via `/etc/ufw/sysctl.conf`). Do not confuse this command with `ufw app default`, which only controls how application profiles are added.
HISTORY
Part of ufw (Uncomplicated Firewall), the Ubuntu-originated frontend for iptables/nftables.
SEE ALSO
ufw(8), ufw-allow(8), ufw-deny(8), ufw-delete(8), ufw-status(8), ufw-enable(8), iptables(8)
