Skip to content

ufw

ufw - Uncomplicated Firewall

Syntax

ufw [options] [rule]

Options

  • enable: Enable the firewall.
  • disable: Disable the firewall.
  • default: Set the default policy.
  • allow: Allow a connection.
  • deny: Deny a connection.
  • reject: Reject a connection.
  • limit: Limit a connection.
  • status: Display the status of the firewall.
  • status numbered: Display the status of the firewall with rule numbers.
  • status verbose: Display the status of the firewall with verbose output.
  • reset: Reset the firewall.
  • reload: Reload the firewall.
  • logging: Enable or disable logging.
  • logging on: Enable logging.
  • logging off: Disable logging.
  • logging low: Set logging to low.
  • logging medium: Set logging to medium.
  • logging high: Set logging to high.
  • logging full: Set logging to full.
  • insert: Insert a rule.
  • delete: Delete a rule.
  • route: Add a route.
  • route delete: Delete a route.
  • route flush: Flush the routes.
  • route reload: Reload the routes.
  • route show: Show the routes.
  • route show numbered: Show the routes with numbers.
  • route show verbose: Show the routes with verbose output.
  • route show raw: Show the routes in raw format.
  • route show summary: Show the routes in summary format.
  • route show full: Show the routes in full format.
  • route show full numbered: Show the routes in full format with numbers.
  • route show full verbose: Show the routes in full format with verbose output.
  • route show full raw: Show the routes in full format in raw format.
  • route show full summary: Show the routes in full format in summary format.
  • route show full summary numbered: Show the routes in full format in summary format with numbers.
  • route show full summary verbose: Show the routes in full format in summary format with verbose output.
  • route show full summary raw: Show the routes in full format in summary format in raw format.
  • route show full summary full: Show the routes in full format in summary format in full format.
  • route show full summary full numbered: Show the routes in full format in summary format in full format with numbers.
  • route show full summary full verbose: Show the routes in full format in summary format in full format with verbose output.
  • route show full summary full raw: Show the routes in full format in summary format in full format in raw format.

Examples

Enable the firewall

ufw enable

Disable the firewall

ufw disable

Set the default policy

ufw default allow

Allow a connection

ufw allow 22

Deny a connection

ufw deny 22

Reject a connection

ufw reject 22

Limit a connection

ufw limit 22

Display the status of the firewall

ufw status

Display the status of the firewall with rule numbers

ufw status numbered

Display the status of the firewall with verbose output

ufw status verbose

Reset the firewall

ufw reset

Reload the firewall

ufw reload

Enable logging

ufw logging on

Disable logging

ufw logging off

Set logging to low

ufw logging low

allow ip 10.0.0.0 to any ip with port 22 and tcp protocol

ufw allow from 10.0.0.0 to any port 22 proto tcp