cnetos7 系统防火墙常见操作
启动防火墙
systemctl start firewalld
关闭防火墙
systemctl stop firewalld
查看防火墙状态
systemctl status firewalld
开启启用防火墙
systemctl enable firewalld
开机禁用防火墙
systemctl disable firewalld
开放某个端口,例如8080端口
firewall-cmd --zone=public --add-port=8080/tcp --permanent
重新加载配置
firewall-cmd --reload
查看防火墙开放的端口
firewall-cmd --zone=public --list-ports
查看某个端口的访问权限
firewall-cmd --zone=public --query-port=8080/tcp
关闭某个端口的防火墙
firewall-cmd --zone=public --remove-port=8080/tcp --permanent