CentOS7防火墙查看、打开和关闭

VPSok
2019-05-23 / 0 评论 / 2,502 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2019年05月23日,已超过1792天没有更新,若内容或图片失效,请留言反馈。
腾讯云,腾讯云服务器,腾讯云促销

CentOS7都出来几年了,我个人基本上还在用6系,主要觉得他的这些命令上的操作变化太大了,比如这个防火墙查看和开关,记熟了6系命令总是习惯性,8都不远了也不能一直抱着6不放,这下把防火墙相关的命令记录下,方便自己搜索。

查看防火墙运行状态

firewall-cmd --state

停止防火墙

systemctl stop firewalld

禁止防火墙开机自启

systemctl disable firewalld

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
52

评论 (0)

取消