How to Use UFW (Uncomplicated Firewall)

Published: (January 6, 2026 at 11:10 PM EST)
1 min read
Source: Dev.to

Source: Dev.to

Basic Penggunaan UFW di Ubuntu Server 24.04

UFW (Uncomplicated Firewall) adalah firewall bawaan Ubuntu/Debian yang berfungsi untuk mengatur lalu lintas jaringan (port dan IP) agar server menjadi lebih aman.

Status

ufw status

Enable / Disable

ufw enable   # mengaktifkan UFW
ufw disable  # menonaktifkan UFW

Membuka Port

Contoh: membuka port SSH (port 22).

ufw allow 22/tcp

Membatasi Akses dari IP Tertentu

Misalnya hanya mengizinkan IP 10.10.10.5 untuk mengakses port 22.

ufw allow from 10.10.10.5 to any port 22 proto tcp

Membatasi Akses dari Subnet

Misalnya mengizinkan seluruh subnet 10.10.10.0/24 untuk mengakses port 22.

ufw allow from 10.10.10.0/24 to any port 22 proto tcp

Melihat Semua Rule

ufw status

Untuk menampilkan urutan rule:

ufw status numbered

Menghapus Rule

Gunakan nomor urutan yang ditampilkan oleh ufw status numbered.
Contoh: menghapus rule pada urutan ke‑2.

ufw delete 2

Semoga bermanfaat!

Back to Blog

Related posts

Read more »

Rapg: TUI-based Secret Manager

We've all been there. You join a new project, and the first thing you hear is: > 'Check the pinned message in Slack for the .env file.' Or you have several .env...

Technology is an Enabler, not a Saviour

Why clarity of thinking matters more than the tools you use Technology is often treated as a magic switch—flip it on, and everything improves. New software, pl...