In the past, Lao Zuo still liked the CENTOS system image, but when I arrived at CENTOS7, I didn't like it. Some command codes were changed, and I didn't feel very used to them. Now I basically use DEBIAN and UBUNTU, but sometimes I still need to use CENTOS. At present, the latest version is 8. X, but generally we don't use the latest version, so we will use CENTOS7. X.
When we need to execute the iptables firewall, you can use the "service iptables save" command. For example, an error will be prompted:
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.
Let's see how to solve it.
systemctl stop firewalld
systemctl mask firewalld
Let's close the firewall first, and then prepare to install the components.
yum install iptables-services -y
Because the systemctl command is used by default, you need to install the iptables service first, which is not available by default.
systemctl enable iptables
Then set the startup.
systemctl restart iptables
The restart takes effect. Finally, let's try the command again. It should be available.