Easy firewall setup for Manjaro Linux
After installing Manjaro on my notebook, I was astounded to see that unlike numerous other distributions of Linux it did not enable a firewall by default - especially since it ships with iptables and its user-friendly frontend, ufw.
Admittedly, this would not be too big of a deal if I did not run services on my laptop nor connected to public networks once in a while, but even then, having a firewall configured let’s me work more soundly. Here is how I set up and enabled iptables on Manjaro using ufw:
-
ufw is a command line application. Don’t let that scare you though, its commands are pretty easy to understand and type in. If in doubt, just enter the lines highlighted below into a terminal.
-
Tell ufw to deny incoming requests by default:
Terminal window sudo ufw default deny -
In my case, I wanted to be able to access my computer via SSH from anywhere, so I ran this line:
Terminal window sudo ufw allow SSH -
Now enable ufw itself:
Terminal window sudo ufw enable -
Enable ufw as a systemd service (so it starts together with Linux):
Terminal window sudo systemctl enable ufw -
The firewall will be active after the next boot, but let’s start it immediately without restarting the computer:
Terminal window sudo systemctl start ufw -
Finally we can check the status of ufw:
Terminal window sudo ufw status
That command should output something similar to this:
Status: active
To Action From -- ------ ---- SSH ALLOW Anywhere SSH (v6) ALLOW Anywhere (v6)