[Solved] /etc/init.d/iptables: line 268: restorecon: command not found
What is iptables?
We can call, it’s the basics of Firewall for Linux. Iptables is a rule based firewall system and it is normally pre-installed on a Unix operating system which is controlling the incoming and outgoing packets. By-default the iptables is running without any rules, we can create, add, edit rules into it.
Read this “What is iptables?” to know more about Linux iptables.
The iptables rules are saved in the file “/etc/sysconfig/iptables” under a Unix architecture. You can view/edit iptables rules from this file. See the sample entries:
root@vps [~]# cat /etc/sysconfig/iptables # Generated by iptables-save v1.4.7 on Fri May 2 00:54:58 2014 *nat :PREROUTING ACCEPT [1:60] :POSTROUTING ACCEPT [7:636] :OUTPUT ACCEPT [7:636] COMMIT # Completed on Fri May 2 00:54:58 2014 # Generated by iptables-save v1.4.7 on Fri May 2 00:54:58 2014 *mangle :PREROUTING ACCEPT [890360:501351591] :INPUT ACCEPT [890360:501351591] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [876347:125010352] :POSTROUTING ACCEPT [847830:121738569]
In this post I am focusing on an error related with the server iptables. I got an error while saving the iptables rules. See the error details pasted below:
[root@vps]# service iptables save iptables: Saving firewall rules to /etc/sysconfig/iptables: /etc/init.d/iptables: line 268: restorecon: command not found [FAILED]
I searched with this error message and found that installing “policycoreutils” using Yum will fix this issue. You can install it using Yum. The command for this is pasted below:
# yum install policycoreutils
The above installation will solve the problem with iptables save. Please try to save it again and let me know if any problems persists.
Iptables is very vast and interesting area in Linux. We have a lot discussions based on Linux Iptables.
See some of the interesting topics below:
1. What is the default configuration file for IPTables and where it is located – Linux?
2. How/command to block/unblock an IP address in your Linux server – IPTables command to block/unblock an IP?
3. How to prevent DoS attack on server using IPTables or CSF?
4. Allow/deny PING on Linux server – iptables rules for icmp.