安裝systemctl:
yum install iptables-services 設置開機啟動 systemctl enable iptables.service 如果報錯:Failed to start IPv4 firewall with iptables. 因為centos7默認的防火牆是firewalld防火牆,不是使用iptables,因此需要先關閉firewalld服務,或者干脆使用默認的firewalld防火牆。 關閉firewalld: systemctl stop firewalld systemctl mask firewalld 開啟443端口 iptables -A INPUT -p tcp --dport 443 -j ACCEPT 保存規則 service iptables save 開啟服務 systemctl restart iptables.service