[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
# Completed on Fri May  2 00:54:58 2014
# Generated by iptables-save v1.4.7 on Fri May  2 00:54:58 2014
:PREROUTING ACCEPT [890360:501351591]
:INPUT ACCEPT [890360:501351591]
: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.

Arunlal Ashok

Sr. Linux Server Administrator. I'm managing Linux servers since 2012. I started this blog to share and discuss my ideas. Check My Profile in uPwork (oDesk) and create a job, if you need any administration help. Thanks!!

You may also like...

Leave a Reply

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