I am having a few issues with a newly installed home server I am preparing. I have installed CentOS7 on it and I found that port 80 and 443 are off by default. I therefore added them to the iptables with the following commands:
iptables -I INPUT 5 -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT iptables -I INPUT 5 -i eth0 -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT service iptables save
I also installed the iptable service which was not present. The problem is that every time I reboot the machine the new configurations are wiped.
I tried to add the the iptable service to chkconfig but I get the following error:
[root@CentOS-7]# chkconfig --add iptables error reading information on service iptables: No such file or directory
I presume that the reason I get this error is because there is no iptable script in /etc/init.d/ however has anyone any ideas if I am actually doing the right thing and/or if there is an easier more solid way to do this? If not how can I solve this problem? In the end I just need to use my home server as a web/mail server...
I have also tried to use the 'systemctl enable iptables' command as flemingovirus kindly suggested but with no success. After I entered the command I got the following output:
ln -s '/usr/lib/systemd/system/iptables.service' '/etc/systemd/system/basic.target.wants`/iptables.service'`
UPDATE: I have looked at the iptables and the command "service iptables save" has worked properly. The problem seem to be due to the service not starting at reboot. I have managed to get the service running at reboot after adding the following line to /etc/rc.local
systemctl start iptables.service
however I wonder why the 'systemctl enable iptables' command is not working in this case. Am I missing something? Thanks