How to fix error can’t save iptables settings on CentOS 7

On CentOS 7, you can’t save iptables settings, how to fix this issue

[root@tutorialspots ~]# service iptables save
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.
[root@tutorialspots ~]# systemctl save iptables
Unknown operation 'save'.

Step 1: check service firewalld:

[root@tutorialspots ~]# systemctl status firewalld
‚óŹ firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

If this service is running, disable it

systemctl disable firewalld

Step 2: install iptables-service

yum install iptables-services


[root@tutorialspots ~]# yum install iptables-services
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base:
 * epel:
 * extras:
 * ius:
 * nux-dextop:
 * remi-safe:
 * updates:
Resolving Dependencies
--> Running transaction check
---> Package iptables-services.x86_64 0:1.4.21-28.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

 Package                  Arch          Version               Repository   Size
 iptables-services        x86_64        1.4.21-28.el7         base         52 k

Transaction Summary
Install  1 Package

Total download size: 52 k
Installed size: 26 k
Is this ok [y/d/N]: y
Downloading packages:
iptables-services-1.4.21-28.el7.x86_64.rpm                 |  52 kB   00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : iptables-services-1.4.21-28.el7.x86_64                       1/1
  Verifying  : iptables-services-1.4.21-28.el7.x86_64                       1/1

  iptables-services.x86_64 0:1.4.21-28.el7


Step 3:

systemctl enable iptables
service iptables start


[root@tutorialspots ~]# systemctl enable iptables
Created symlink from /etc/systemd/system/ to /usr/lib/systemd/system/iptables.service.
[root@tutorialspots ~]# service iptables start
Redirecting to /bin/systemctl start iptables.service

Done, now you can save iptables settings:

[root@tutorialspots ~]# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]

Leave a Reply