UFW, which stands for Uncomplicated Firewall, is a user-friendly tool for managing firewall rules on Linux systems. It simplifies the process of controlling network traffic, making it easier for users to allow or block ports.
This guide will walk you through the steps to open ports 80 (HTTP) and 443 (HTTPS) using UFW. By following these instructions, you will learn how to enable these ports, check the status of your firewall rules, and how to remove these rules when they are no longer needed.
Open Port 80 and 443 in UFW
With UFW, you can allow ports either temporarily or permanently. By default, UFW rules are permanent and will remain even after a system reboot.
To allow incoming traffic on TCP ports 80 and 443, use the following commands:
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
These commands will open ports 80 and 443 for HTTP and HTTPS traffic respectively.
Check Active Firewall Rules
Once you have added the rules, you can check them to confirm that the ports are open. Use this command to see the list of all active rules:
sudo ufw status
The output will show the status of your firewall and the rules that are currently applied, like this:
Deleting Rules from UFW
If you decide that you no longer need to keep these ports open, you can remove them using the following commands:
sudo ufw delete allow 80/tcp
sudo ufw delete allow 443/tcp
These commands will remove the rules allowing traffic on ports 80 and 443.
Conclusion
This tutorial helped you to understand how to use UFW to manage firewall rules on a Linux system. You learned how to open ports 80 (HTTP) and 443 (HTTPS) traffic, check the status of your firewall rules, and remove these rules when they are no longer needed. By using UFW, you can easily control network access to your computer, improving its security and ensuring that only the necessary traffic is allowed.