在 CentOS 中,防火墙通常是 firewalld(CentOS 7 及以后)。下面分别说明不同版本和方式的“停止防火墙服务”。
systemctl stop firewalld
systemctl disable firewalld
systemctl status firewalld
systemctl mask firewalld
这样防止被其他服务误启动
service iptables stop
chkconfig iptables off
如果只是访问某个端口,更安全的方式是:
firewall-cmd --zone=public --add-port=端口/tcp --permanent
firewall-cmd --reload
如果你告诉我:
我可以给你更合适的命令。