linux防火墙命令(阿里云ECS为例)
一、打开linux的防火墙
systemctl start firewalld
二、查看防火墙状态
firewall-cmd --stat
三、查看端口是否开放(以80端口为例)
firewall-cmd --query-port=80/tcp
四、开放指定端口(以7000端口为例)
firewall-cmd --permanent --add-port=7000/tcp
五、移除指定端口(以7000端口为例)
firewall-cmd --permanent --remove-port=7000/tcp
六、关闭防火墙
systemctl stop firewall
七、关闭开机自动启动防火墙
systemctl disable firewall
若关闭防火墙时出现这个问题Failed to stop firewall.service: Unit firewall.service not loaded.
则执行以下命令:
pkill -f firewalld
然后打开防火增,最后再关闭防火墙:
systemctl start firewalld
systemctl stop firewall
systemctl disable firewall
原文地址:https://www.cnblogs.com/nanjo4373977/p/15291586.html 标签:为例,firewall,端口,防火墙,--,systemctl,Aliyun,Linux From: https://www.cnblogs.com/bitdog/p/16987252.html