OS: Debian 11 (Bullseye)
In this tutorial I will show you how to quickly install ufw in Debian 11. Do take note that if you do not specific the protocol by default both TCP and UDP protocol will be enabled
Install ufw in Debian.
sudo apt install ufw
- First lets allow ssh connection
sudo ufw allow 22
- Next configure default connection for incoming and outgoing.
sudo ufw default deny incoming
sudo ufw default allow outgoing
- Enable ufw logging
sudo ufw logging on
- Enabling ufw firewall
sudo ufw enable
- Show added ufw allowed ports
sudo ufw show added
- Show the current configurations.
sudo ufw status verbose
For those of you who are configuring vpn server you might want to enable the following UDP ports for IP Sec.
sudo ufw allow 500/udp
sudo ufw allow 4500/udp
To allow the default port for vnc.
sudo ufw allow 5901/tcp