problem
The system is CentOS 7.2 and iptables service has been installed, but after executing the startup command, the error that iptables service cannot be started normally is reported.
The startup command is as follows:
systemctl start iptables.service
Errors are reported as follows:
Job for iptables.service failed because the control process exited with error code. See "systemctl status iptables.service" and "journalctl -xe" for details.
Both servers have the same environment, but one is normal and the other is in this situation. I think there is something wrong. Later, I tried several other methods, including reinstalling iptables service and restarting the server, but this error will still be reported.
Execute journalctl - Xe
to view the error log and find more specific reasons. The errors are as follows:
Failed to start IPv4 firewall with iptables.
Here we probably know the cause of the problem.
Solution:
Because the default firewall of CentOS 7 is firewall firewall instead of iptables, you need to turn off the firewall service first or simply use the default firewall firewall.
Because the server that reported the error this time is an alicloud server that has just been purchased, it forgot to turn off the default firewall in operation, which led to a waste of time on this matter.
Close firewall:
systemctl stop firewalld
systemctl mask firewalld
Using iptables services:
#Open 443 port(HTTPS)
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
#Save the above rules
service iptables save
#Turn on service
systemctl restart iptables.service
business as usual.