Fast commands for enabling firewalld on RHEL7 and CENTOS7. I had to enable these for a secondary control on a project I am on.

  1. Check the Status of the Firewall on Each Machine and confirm firewalld is started.
systemctl status firewalld
● firewalld.service - firewalld -
dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled;
vendor preset: enabled)
Active: active (running) since Wed 2019-04-10 09:40:23 EDT; 3h 38min ago
     Docs: man:firewalld(1)
 Main PID: 2878 (firewalld)
Tasks: 2
CGroup: /system.slice/firewalld.service
           └─2878 /usr/bin/python -Es
/usr/sbin/firewalld --nofork --nopid
  1. If the firewalld is stopped, enable and start the firewall.
$ systemctl enable firewalld
  1. Start firewalld
$ systemctl start firewalld
  1. Check the machines to see each have a public zone
$ firewall-cmd --get-active-zones


interfaces: <>
  1. Add SSH
firewall-cmd --add-service=ssh --timeout 15m

Warning: ALREADY_ENABLED: 'ssh' already in 'public'

  1. Transition the Changes to Permanent
$ firewall-cmd
  1. Reload the Rules
$ firewall-cmd --reload
  1. Check to see if the list of rules is saved
$ firewall-cmd --permanent
--zone=public --list-rich-rules
rule family="ipv4"
source address="" accept
rule family="ipv4"
source address="" accept


Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.