If you are using Centos 7 or RHEL 7 or any of it’s variant, you are probably using ‘Firewalld’ by default. Although, if you are a iptables fan like me, who likes it’s simplicity and manipulative nature instead of a full form firewall, then you probably have disabled firewalld from your CentOS 7 instance and using iptables. There are couple of servers, where I use runtime iptables rules for postrouting and masquerading. These rules are dynamically generated by my scripts instead of the sysconfig file under:
/etc/sysconfig/iptables
This file is generated upon running the iptables save command:
service iptables save
which I rarely do so.
Error Details
Which is why, I don’t have a /etc/sysconfig/iptables file in those servers and a common error I see while restarting iptables in those system is the following:
# systemctl restart iptables.service
Assertion failed on job for iptables.service.
How to Fix The Error
The error appears because you don’t have any rule in /etc/sysconfig/iptables or the file doesn’t exist either. You can ignore the error as iptables would still run. To eradicate the error, simply make sure you have some iptables rules loaded on your system using the status command:
iptables -S
And then, run:
service iptables save
Once done, restarting iptables shouldn’t show the error any longer.