# service firewalld status; #查看防火墙状态 || firewall-cmd --state
# service firewalld start; 或者 #systemctl start firewalld.service;#开启防火墙 || systemctl start firewalld.service
# service firewalld stop; 或者 #systemctl stop firewalld.service;#关闭防火墙 || systemctl stop firewalld.service
# service firewalld restart; 或者 #systemctl restart firewalld.service; #重启防火墙
# systemctl disable firewalld.service#禁止防火墙开启自启 || systemctl disable firewalld.service
# systemctl enable firewalld#设置防火墙开机启动
#yum remove firewalld#卸载firewall
firewall-cmd --reload # 更新防火墙规则
firewall-cmd --zone=public --list-ports # 查看打开的端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent # 添加开放端口
firewall-cmd --add-service=mysql # 开放mysql端口
firewall-cmd --remove-service=http # 阻止http端口
firewall-cmd --list-services # 查看开放的服务
firewall-cmd --add-port=3306/tcp # 开放通过tcp访问3306
firewall-cmd --remove-port=80tcp # 阻止通过tcp访问3306
firewall-cmd --add-port=233/udp # 开放通过udp访问233
firewall-cmd --list-ports # 查看开放的端口
查询指定端口号是否开启:firewall-cmd --query-port=3306/tcp
永久开放指定端口号:firewall-cmd --permanent --zone=public --add-port=3306/tcp
移除指定端口号:firewall-cmd --permanent --zone=public --remove-port=3306/tcp