UFW

UFW installation and configuration guide

UFW setup guide

Installation

sudo apt install ufw

Use IPv6 with UFW

sudo nano /etc/default/ufw

Make sure that IPv6=yes

Reset UFW to its defaults

sudo ufw reset

Set up default policies

sudo ufw default deny incoming
sudo ufw default allow outgoing

Allow ports

sudo ufw allow 22
sudo ufw allow 80
sudo ufw allow 443

Allow local network

sudo ufw allow from 192.168.1.0/24

Comment

sudo ufw allow 25565 comment 'Minecraft'

To add/update the comment for an existing rule, just add the exact same rule again, but with the new comment at the end.

Enable UFW

sudo ufw enable

Check UFW status

sudo ufw status verbose

Disable UFW

sudo ufw disable

Reference

https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-with-ufw-on-ubuntu-22-04

https://www.cyberciti.biz/faq/howto-adding-comments-to-ufw-firewall-rule/

https://serverfault.com/questions/925281/ufw-comment-existing-rule

Content Licensed under CC BY-SA 4.0. Code licensed under the MIT License.
Last updated on Sep 28, 2024 13:18 UTC