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. Google File System 论文阅读笔记

    核心目标:Google File System是一个面向密集应用的,可伸缩的大规模分布式文件系统.GFS运行在廉价的设备上,提供给了灾难冗余的能力,为大量客户机提供了高性能的服务. 1.一系列前提 G ...

  2. 使EasyUI的window、panel、dialog 不被拖出页面

    function easyuiPanelOnMove(left, top) {  var l = left;  var t = top;  if (l < 1) {    l = 1;  }  ...

  3. python学习三十五天函数递归的用法

    python函数递归就是自己调用自己,无限循环,但是python限制了调用的次数1000次,就会终止,递归用在栏目分类,采集程序比较多,下面简单说函数递归用法和实例 1,函数递归用法 def func ...

  4. 如何学习 websocket ?

    如何学习 websocket ? 使用 HTML https://github.com/phoboslab/jsmpeg MPEG1 进行播放 https://w3c.github.io/media- ...

  5. ORM多对多的实现

    #coding=utf-8 from sqlalchemy import Table, Column, Integer,String,DATE, ForeignKey from sqlalchemy. ...

  6. 洛谷P1446/BZOJ1004 Cards Burnside引理+01背包

    题意:有n张牌,有R+G+B=n的3种颜色及其数量,要求用这三种颜色去染n张牌.n张牌有m中洗牌方式,问在不同洗牌方式下本质相同的染色方案数. 解法:这道题非常有意思,题解参考Hzwer学长的.我这里 ...

  7. 【抓包工具之Fiddler】中session的请求/响应类型与图标对照表

  8. 【串线篇】Mybatis之动态sql

    一.if标签 <select id="getTeacherByCondition" resultMap="teacherMap"> select * ...

  9. BZOJ2695 保护古迹

    非常带劲之计算几何 写的头晕= = 就是平面图转对偶图然后最小割 由于p非常小我们枚举所有保护状态然后割一下 建图真的烦 就是把区域划分出来看一下每一个古迹点是否被小区域包含[好像也可以写点定位] 然 ...

  10. Redis Bloom Filter

    原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/11632622.html 背景 比如刷抖音的时候,抖音会不停的推荐新的内容,而它每次推荐时候都要去重,以 ...