There are many firewall solutions available for Linux/Unix-based operating systems, such as Raspbian OS in the case of Raspberry Pi. These firewall solutions have IP tables underneath to filter packets coming from different sources and allow only the legitimate ones to enter the system. IP tables are installed in Raspberry Pi by default, but are not set up. It is a bit tedious to set up the default IP table. So, we will use an alternate tool, Uncomplicated Fire Wall (UFW), which is extremely easy to set up and use ufw.
To install ufw, run the following command (refer to Figure 10.17):
sudo apt install ufw
Once the download is complete, enable ufw (refer to Figure 10.18) with the following command:
sudo ufw enable
If you want to disable the firewall (refer to Figure 10.20), use the following command:
sudo ufw disable