firewall-cmd

The firewalld command line client.

Install

All systems
curl cmd.cat/firewall-cmd.sh
Debian Debian
apt-get install firewalld
Ubuntu
apt-get install firewalld
Arch Arch Linux
pacman -S firewalld
image/svg+xml Kali Linux
apt-get install firewalld
CentOS
yum install firewalld
Fedora
dnf install firewalld
Raspbian
apt-get install firewalld

The firewalld command line client.

  • View the available firewall zones:
    firewall-cmd --get-active-zones
  • View the rules which are currently applied:
    firewall-cmd --list-all
  • Permanently open the port for a service in the specified zone (like port `443` when in the `public` zone):
    firewall-cmd --permanent --zone=public --add-service=https
  • Permanently close the port for a service in the specified zone (like port `80` when in the `public` zone):
    firewall-cmd --permanent --zone=public --remove-service=http
  • Reload firewalld to force rule changes to take effect:
    firewall-cmd --reload

© tl;dr; authors and contributors