@alivia
Configuring a firewall on Ubuntu can be done using the built-in firewall tool called ufw
(Uncomplicated Firewall). Here are the steps to configure a firewall on Ubuntu:
- Check if ufw is installed by running the following command:
If it's not installed, you can install it by running the following command:
1
|
sudo apt-get install ufw
|
- Set the default incoming policy to deny:
1
|
sudo ufw default deny incoming
|
- Allow incoming traffic for specific ports and protocols. For example, to allow incoming traffic for SSH (port 22) and HTTP (port 80), run the following commands:
1
2
|
sudo ufw allow ssh
sudo ufw allow http
|
- Enable the firewall:
- Verify the firewall status by running the following command:
That's it! You have successfully configured a firewall on your Ubuntu machine using ufw
.