1、firewalld的基本使用

启动: systemctl start firewalld

查看状态: systemctl status firewalld 

停止: systemctl disable firewalld

禁用: systemctl stop firewalld

 

2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。

启动一个服务:systemctl start firewalld.service
关闭一个服务:systemctlstop firewalld.service
重启一个服务:systemctlrestart firewalld.service
显示一个服务的状态:systemctlstatus firewalld.service
在开机时启用一个服务:systemctlenable firewalld.service
在开机时禁用一个服务:systemctldisable firewalld.service
查看服务是否开机启动:systemctlis-enabled firewalld.service
查看已启动的服务列表:systemctllist-unit-files|grep enabled
查看启动失败的服务列表:systemctl--failed

3.配置firewalld-cmd

查看版本: 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

 

那怎么开启一个端口呢

添加

firewall-cmd --zone=public --add-port=80/tcp --permanent   (--permanent永久生效,没有此参数重启后失效)

重新载入

firewall-cmd --reload

查看

firewall-cmd --zone=public --query-port=80/tcp

删除

firewall-cmd --zone=public --remove-port=80/tcp --permanent

 

 

 

查看firewall是否运行,下面两个命令都可以

systemctl status firewalld.service

firewall-cmd --state

 

 

查看当前开了哪些端口

其实一个服务对应一个端口,每个服务对应/usr/lib/firewalld/services下面一个xml文件。

firewall-cmd --list-services

 

 

 

查看还有哪些服务可以打开

firewall-cmd --get-services

 

 

 

查看所有打开的端口: 

firewall-cmd --zone=public --list-ports

 

 

 

 

更新防火墙规则: 

firewall-cmd --reload

CentOS7 防火墙Firewall常用命令的更多相关文章

  1. CentOS7防火墙设置常用命令

    目录 开/关/重启防火墙 查看所有开启的端口号 CentOS7环境下防火墙常用命令 开/关/重启防火墙 查看防火墙状态 firewall-cmd --state 启动防火墙 systemctl sta ...

  2. CentOS7下Firewall常用命令

    安装它,只需 yum install firewalld 如果需要图形界面的话,则再安装 yum install firewall-config 一.介绍 防火墙守护 firewalld 服务引入了一 ...

  3. CentOS7防火墙firewall

    一.Firewall 1. 从CentOS7开始,默认使用firewall来配置防火墙,没有安装iptables(旧版默认安装). 2. firewall的配置文件是以xml的格式,存储在 /usr/ ...

  4. 【RHEL7/CentOS7防火墙之firewall-cmd命令详解】

    目录 Firewalld zone firewall-cmd 开始配置防火墙策略 总结 Redhat Enterprise Linux7已默认使用firewalld防火墙,其管理工具是firewall ...

  5. CentOS7防火墙firewall相关操作

    1.firewalld的基本使用 启动: systemctl start firewalld 查看状态: systemctl status firewalld 停止: systemctl disabl ...

  6. Centos7之firewall配置命令

    firewalld的基本使用 查看状态:systemctl status firewalld 启动:systemctl start firewalld 停止:systemctl stop firewa ...

  7. centos7防火墙--firewall

    centos7的防火墙变成firewall了 systemctl start firewalld.service#启动firewallsystemctl stop firewalld.service# ...

  8. linux防火墙设置常用命令

    1.永久性生效,重启后不会复原 开启: chkconfig iptables on 关闭: chkconfig iptables off 2.即时生效,重启后复原 开启: service iptabl ...

  9. centos7 五大查找常用命令

    1.find find是最常见和最强大的查找命令,你可以用它找到任何你想找的文件. find的使用格式如下: $ find <指定目录> <指定条件> <指定动作> ...

随机推荐

  1. < python PIL - 批量图像处理 - 生成自定义大小图像 >

    < python PIL - 批量图像处理 - 生成自定义大小图像 > 直接用python自带的PIL图像库,对一个文件夹下所有jpg/png的图像进行自定义像素变换 from PIL i ...

  2. JS formData

    有时候,我们需要使用formData来上传文件,并根据反馈的结果做不同的处理, 这个时候使用form来提交文件不方便 #perform 获取的的上传文件所用的input标签 var formData ...

  3. 转 router-view 的理解

    主要是构建 SPA (单页应用) 时,方便渲染你指定路由对应的组件.你可以 router-view 当做是一个容器,它渲染的组件是你使用 vue-router 指定的.比如: 视图层: <div ...

  4. kmp(多次无重叠匹配)

    http://acm.hdu.edu.cn/showproblem.php?pid=2087 剪花布条 Problem Description 一块花布条,里面有些图案,另有一块直接可用的小饰条,里面 ...

  5. CodeChef Sereja and LCM(矩阵快速幂)

    Sereja and LCM   Problem code: SEALCM   Submit All Submissions   All submissions for this problem ar ...

  6. pycharm修改字体大小和主题

    一,修改文字大小: 二,修改主题:你可能对编辑器的外观仍不满意,例如你希望将文档字符串改变为另外一种颜色,下面介绍具体更改方法:  

  7. protocols - 协议定义文件

    描述 该文件为普通 ASCII 文件,它描述了 TCP/IP 子系统中各类 DARPA internet 协议族.你应该参考这个文件, 而不是使用 ARPA 的 include 文件中的号码, 更不必 ...

  8. Nginx学习总结:常用module(二)

    斜体下划线,表示建议采用默认配置,无需显式的配置 一.ngx_core_module 1.accept_mutex [on | off]         上下文:events 默认为“on”,在wor ...

  9. zabbix入门之定义触发器

    zabbix入门之定义触发器 触发器的概念 触发器的定义:界定某特定的item 采集到数据的非合理区间或非合理状态.通常为逻辑表达式. 逻辑表达式(阈值):通常用于定义数据的不合理区间,其结果如下: ...

  10. python集合set,交集,并集,差集,对称差集,子集和超集

    python集合set,交集,并集,差集,对称差集,子集和超集 x = {1, 2, 3, 4} y = {2, 4, 5, 6} # 交集(取x中与y中相同部分) print(x.intersect ...