Why is the below command necessary after making changes to the FirewallD configuration?
FirewallD has two separate sets of configuration: runtime and permanent. The runtime configuration are the currently active firewall rules loaded in to the kernel. This configuration is stored in memory and will be lost if the firewalld service is restarted. The permanent configuration set consists of the configuration files that are loaded from disk and in to memory when FirewallD is started or when the configuration is reloaded.
Changes to the runtime configuration isn’t saved to the permanent configuration unless you specify the
--permanent argument to
firewall-cmd command. However, when you do make permanent configuration changes those changes will not be part of the runtime configuration before you reload it. This is why you’ll see the reload command in nearly all tutorials on FirewallD configuration.
As a rule of thumb, you should reload your FirewallD configuration after using the
--permanent argument to make changes to your firewall configuration with
If you make many changes to your configuration without reloading between the changes, you may run in to situations where the current runtime isn’t aware of the other changes you’ve made to the permanent configuration. This can lead to errors where the
firewall-cmd commend fail to make changes to the firewall configuration.
E.g. the following will result in an error unless you reload your runtime configuration before issuing the second command:
Feature image based on a photo by © 2016 Aaron Barnaby.