All Guides

UFW Firewall Einrichtung

Sichern Sie Ihren Server mit Ubuntu UFW.

Beginner10 Min.

Setup Steps

1. Install UFW (usually pre-installed on Ubuntu):

sudo apt install ufw -y

2. Set default policies:

sudo ufw default deny incoming
sudo ufw default allow outgoing

3. Allow SSH access (IMPORTANT - do this first!):

sudo ufw allow ssh
# or if using a custom port:
sudo ufw allow 2222/tcp

4. Allow web traffic:

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

5. Enable UFW:

sudo ufw enable

6. Check status:

sudo ufw status verbose

7. Allow access from a specific IP:

sudo ufw allow from 192.168.1.100 to any port 3306

8. Delete a rule:

sudo ufw status numbered
sudo ufw delete 5

9. Reset all rules:

sudo ufw reset

10. Check UFW logs:

sudo ufw logging on
sudo tail -f /var/log/ufw.log