'service iptables save' command is not working in RHEL7 while it worked on RHEL6. Is there any other method to save the current iptables rules?
Environment
- Red Hat Enterprise Linux 7
- iptables
Issue
- When I execute the
service iptables savecommand on my RHEL7 node, it says the following :-
[root@rhel7]# 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.
- I would like to save the current iptables rules to some file. Whats the easiest way?
Resolution
- Execute the below command :-
[root@rhel7]# yum install iptables-services
- Now save the current iptables rules, the rules will be saved in /etc/sysconfig/iptables :-
[root@rhel7]# service iptables save
- If it is desired to
reloadORrestartthe iptables after modifying any rule , one may execute the below command :-
[root@rhel7]# service iptables restart
Redirecting to /bin/systemctl restart iptables.service
Diagnostic Steps
- Below is the realtime illustration :-
[root@rhel7]# 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@rhel7]# yum install iptables-services
Loaded plugins: langpacks, product-id, subscription-manager
Resolving Dependencies
--> Running transaction check
---> Package iptables-services.x86_64 0:1.4.21-13.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=========================================================================================================
Package Arch Version Repository Size
=========================================================================================================
Installing:
iptables-services x86_64 1.4.21-13.el7 rhel-7-server-eus-rpms 49 k
Transaction Summary
=========================================================================================================
Install 1 Package
Total download size: 49 k
Installed size: 23 k
Is this ok [y/d/N]: y
Downloading packages:
iptables-services-1.4.21-13.el7.x86_64.rpm | 49 kB 00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : iptables-services-1.4.21-13.el7.x86_64 1/1
Verifying : iptables-services-1.4.21-13.el7.x86_64 1/1
Installed:
iptables-services.x86_64 0:1.4.21-13.el7
Complete!
[root@rhel7]# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
SBR
Product(s)
Components
Category
Tags
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.