I have saved my iptables rules using the iptables-save >
command and i am trying to restore these rules when the machine boots up. I have added the command iptables-restore < "path to rules file"
in the rc.local
but it doesn't fire up the rules.
I tried directly running the command in the terminal and it worked, so i know there is nothing wrong with the command. I have made the rc.local
file executable as well with the command
sudo chmod +x /etc/rc.local
.
What might be the problem ?
Edit – am using fedora 22
Best Answer
I'm afraid time has moved on, and F22 is one of those cherishable distros using the adorable new
systemd
to start things up. One of the many happy enjoyable side effects is thatrc.local
is no longer run (or to be more precise, I haven't been able to make it run reliably) so that won't be helping.Put your firewall rules into
/etc/sysconfig/iptables
in the normal way, usingiptables-save > /etc/sysconfig/iptables
, clear your rules, then dosystemctl start iptables.service
to apply them. Ifiptables -L -n -v
confirms they've taken, dosystemctl enable iptables.service
to start them at boot time.