ufw Command Generator
Generate ufw commands to manage the Uncomplicated Firewall on Ubuntu/Debian
Getting Started with ufw
## What is ufw?
`ufw` (Uncomplicated Firewall) is a friendly front-end to iptables/ufw shipped with Ubuntu and Debian. It hides raw chain syntax behind simple verbs like `allow` and `deny`. Rules take effect immediately and persist across reboots once ufw is enabled.
## How to Use
1. **Enable the firewall**: Run `ufw enable` once (the default policy denies incoming, allows outgoing). 2. **Pick an action**: `allow`, `deny`, `reject`, `delete`, `status`, `enable`, `disable`, `reload`, or `reset`. 3. **Add a rule**: For `allow`/`deny`/`reject`, specify a port (optionally with `/tcp` or `/udp`) and/or a source with `from`. 4. **Copy & Run**: Prefix with `sudo`.
Common Actions & Rules
### `allow` / `deny` / `reject` Open or close access. `deny` silently drops packets; `reject` responds with an ICMP error so the client fails fast.
### `status` Show the current rule set. `ufw status verbose` adds the default policy and logging level.
### `enable` / `disable` / `reload` / `reset` `enable` activates the firewall at boot; `disable` turns it off; `reload` re-reads the rules; `reset` wipes all rules back to defaults.
### Port with protocol `ufw allow 80/tcp` opens TCP port 80. Omit the suffix to allow both TCP and UDP.
### `from` Source restriction Limit a rule to a source IP or CIDR: `ufw allow from 192.168.1.0/24` or `ufw allow from 10.0.0.5 to any port 22`.
### `delete` Remove a rule Repeat an existing rule prefixed with `delete` (`ufw delete allow 80/tcp`), or use numbered mode (`ufw status numbered` then `ufw delete 3`).
▶What is the difference between ufw and iptables?
▶How do I allow SSH before enabling the firewall?
▶How do I delete a rule?
If this tool has been helpful to you, consider buying me a coffee.
Buy me a coffee