To set up a firewall with UFW (Uncomplicated Firewall) on Ubuntu 24.10, follow these steps:
Step 1 : Update the System
Before installing or configuring any packages, ensure your system is up to date.
Step 2 : Install UFW
If UFW is not installed, you can install it with the following command:
Step 3 : Check the Firewall Status
Check whether UFW is active:
If it says "inactive," don't worry. You'll enable it soon.
Step 4 : Allow SSH
To prevent locking yourself out of the server when enabling the firewall, allow SSH access:
Step 5 : (Optional) Allow Additional Services
You can also allow other services like HTTP (port 80) and HTTPS (port 443).
Step 6 : Enable UFW
Enable the firewall to apply your rules:
You'll be prompted to confirm. Type y
and press Enter.
Step 7 : Check the Firewall Status Again
After enabling UFW, verify that it is active and your rules are applied:
Congratulations! You have successfully set up a firewall with UFW on Ubuntu 24.10.