Configuring the most common firewall settings interactively
Firewall configuration is just one of those things – we often need to do it, but we don't necessarily know all of the commands off the top of our heads. Let's do this via shell scripts, for both CentOS (firewalld
) and Ubuntu (ufw
).
Getting ready
Before you start this recipe, you need to make sure that you have firewalld
on your CentOS machine and ufw
on your Ubuntu machine up. So, first, you need to use the following command:
systemctl status firewalld
Use the following command for CentOS and Ubuntu:
systemctl status ufw
If they're disabled, we need to turn them on, like so:
systemctl enable --now firewalld
On CentOS and Ubuntu, you can use the following command:
systemctl enable --now ufw
Now, we're ready to get started. Of course, you need to be logged in as an administrator to be able to change your firewall configuration, so make sure that you're either logged...