CentOS7都出来几年了,我个人基本上还在用6系,主要觉得他的这些命令上的操作变化太大了,比如这个防火墙查看和开关,记熟了6系命令总是习惯性,8都不远了也不能一直抱着6不放,这下把防火墙相关的命令记录下,方便自己搜索。
查看防火墙运行状态
firewall-cmd --state
停止防火墙
systemctl stop firewalld
禁止防火墙开机自启
systemctl disable firewalld
详细操作:
启动服务:systemctl start firewalld.service 关闭服务:systemctl stop firewalld.service 重启服务:systemctl restart firewalld.service 显示服务的状态:systemctl status firewalld.service 在开机时启用:systemctl enable firewalld.service 在开机时禁用:systemctl disable firewalld.service 查看服务是否开机启动:systemctl is-enabled firewalld.service 查看已启动的服务列表:systemctl list-unit-files|grep enabled 查看启动失败的服务列表:systemctl --failed 查看版本: firewall-cmd --version 查看帮助: firewall-cmd --help 显示状态: firewall-cmd --state 查看所有打开的端口: firewall-cmd --zone=public --list-ports 更新防火墙规则: firewall-cmd --reload 查看区域信息: firewall-cmd --get-active-zones 查看指定接口所属区域: firewall-cmd --get-zone-of-interface=eth0 拒绝所有包:firewall-cmd --panic-on 取消拒绝状态: firewall-cmd --panic-off 查看是否拒绝: firewall-cmd --query-panic
QQ群:683851361,投稿/廣告聯繫:admin@zrblog.net





![[11.11]lightlayer圣何塞/新加坡云服务器5折$3.5/月起,香港/洛杉矶独立服务器低至$40/月起-国外主机分享](https://www.zrblog.net/wp-content/uploads/2024/05/lightlayer.png)
![[11.11]666clouds/六六云全站8折,香港/韩国/日本/美国/英国/德国/菲律宾双ISP原生IP-国外主机分享](https://www.zrblog.net/wp-content/uploads/2023/01/666clouds.png)
![[11.11]OrangeVPS常规VPS优惠11%,新加坡/香港/美国VPS月付3.56美元起-国外主机分享](https://www.zrblog.net/wp-content/uploads/2024/09/orangevps.png)

![[11.11]edgeNAT双十一促销全场VPS主机7折28元起,美国洛杉矶/韩国原生IP/日本双ISP/香港双ISP住宅IP等-国外主机分享](https://www.zrblog.net/wp-content/uploads/2020/08/edgenet.jpg)


![[11.11]RAKsmart:VPS秒杀$1.99/月起-双核/2GB/50GB/10TB@5Gbps/可选国际BGP&大陆优化&精品CN2线路-国外主机分享](https://www.zrblog.net/wp-content/uploads/2026/10/raksmart-20261111.png)

