Centos7 的防火墙 firewalld比较常见

  简单介绍使用

  详细介绍链接推荐:   https://blog.csdn.net/buster_zr/article/details/80604933

            http://blog.51cto.com/13503302/2095633

            https://www.jianshu.com/p/c06890b7739e

firewalld 使用:

  iptables firewalld 都是防火墙程序,并且firewalld内部也是通过iptables实现防火墙配置,但是两个程序不能同时运行

  安装

  如果iptables在运行,先关闭

  systemctl stop iptables    #关闭iptables

  systemctl disable iptables  #禁止iptables 开机启动

  systemctl status firewalld  #查看防火墙firewalld状态

  如果运行,会显示Active: active (running)  

  firewall-cmd --state      #查看防火墙firewalld状态的另一种方式

  no runing 表示没有运行

  yum -y install firewalld    #安装 firewalld

  systemctl enable firewalld  #设置开启启动

  systemctl start firewalld   #启动

  firewall-cmd --list-all   #查看默认区域已有规则  

  firewall-cmd --list-all-zones  #查看所有区域规则 

  添加端口

  firewall-cmd --zone=public --add-port=端口/类型 --permanent # 加上--permanent 表示永久生效

  如果修改了ssh端口,ssh端口修改为5511 那么可以开启5511端口

  firewall-cmd --zone=public --add-port=5511/tcp --permanent  #开启5511端口 tcp类型

  firewall-cmd --reload #重新加载规则,使设置马上生效

   

  配置文件

  两个位置      /usr/lib/firewalld/  /etc/firewalld/

  默认的配置在第一个位置,如果添加自己的规则,建议在第二个文件位置出修改

  添加服务  

  firewall-cmd --zone=pubic --add-service=服务名

  服务很多已经有了配置文件 就是在/usr/lib/firewalld/目录下面  如 http服务 就是 /usr/lib/firewalld/services/http.xml

  所以如若要开启80端口  可以有两种方式

  方式一: firewall-cmd --zone=pubic --add-service=http --permanent  #添加http 服务  配置文件中默认是80端口

  方式二: firewall-cmd --zone=public --add-port=80/tcp  --permanent  #添加 80/tcp 端口 

  firewall-cmd --reload #重载配置

  添加 443 端口https 服务

  firewall-cmd --zone=pubic --add-service=https --permanent

  firewall-cmd --reload        

  

Centos7 firewalld 基本使用的更多相关文章

  1. CentOS7 firewalld防火墙 启动 关闭 禁用 添加删除规则等 常用命令

    CentOS7 firewalld防火墙 常用命令1.firewalld的基本使用启动: systemctl start firewalld关闭: systemctl stop firewalld查看 ...

  2. centos7 firewalld

    1.firewalld简介 firewalld是centos7的一大特性,最大的好处有两个: 1.支持动态更新,不用重启服务: 2.加入了防火墙的"zone"概念   firewa ...

  3. CentOS7 firewalld 打开关闭端口

    1. firewalld的基本使用 启动: systemctl start firewalld 关闭: systemctl stop firewalld 查看状态: systemctl status ...

  4. centos7 Firewalld操作集合

    =============================================== 2019/4/15_第1次修改                       ccb_warlock == ...

  5. centos7 firewalld基本使用

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

  6. centos7 firewalld使用

    转 http://blog.csdn.net/jamesge2010/article/details/52449678 1.firewalld的基本使用 启动: systemctl start fir ...

  7. CentOS7 firewalld防火墙规则

    在CentOS7里有几种防火墙共存:firewalld.iptables.ebtables,默认是使用firewalld来管理netfilter子系统,不过底层调用的命令仍然是iptables等. f ...

  8. CentOS7,Firewalld防火墙使用方法

    查看防火墙状态 systemctl status firewalld.service 启动firewall systemctl stop firewalld.service 停止firewall sy ...

  9. centos7 firewalld 开放端口

    开通80端口 firewall-cmd --zone=public --add-port=80/tcp --permanent --zone #作用域 --add-port=80/tcp #添加端口, ...

随机推荐

  1. Javascript上传超大文件实例

    因业务需求需要向伺服器上传大于1GB以上的视频文件,其实网上也能找到很多大文件上传的第三方组件,问题是要么用起来相当不方便,总出现一些bug,要么收费太贵(费用几千,甚至还限定使用数量),最终自己开发 ...

  2. C++中的return和exit区别

    在main函数中,return和exit经常混用,两者的一个区别:return会执行statck unwinding,而exit不会.如果触发了信号,exit也同样不会做stack unwinding ...

  3. ReactNative学习笔记(一)环境搭建

    前言 本文开发环境为Windows,目标平台为Android,react-native版本为0.35.0. 环境搭建 注意,本文不是按照官网的教程来的,官网说必须安装什么Chocolatey,我懒得鸟 ...

  4. Adobe reader multiple languages pack

    用户打开客户发过来的PDF文档,显示不正常,这是电脑的Adobe Reader缺少相关的字体. 可以从下面地址下载相对版本的字体包安装:http://supportdownloads.adobe.co ...

  5. Go语言运算符

    目录 算术运算符 注意事项 赋值运算符 逻辑运算符 短路与和短路或 关系运算符 位运算符 其他运算符 运算符优先级 运算符用于在程序运行时执行数学或逻辑运算. Go 语言内置的运算符有:算术运算符.赋 ...

  6. box-sizing:border-box的作用

    其实一直没仔细研究过CSS3新增的这个属性box-sizing,只是经常会看到其它网页和公司项目里面有用到这个属性,然后就百度找到了一篇不错的介绍 https://www.jianshu.com/p/ ...

  7. Java学习笔记50(DBCP连接池)

    实际开发中,连接数据库是十分消耗资源的操作,但是,我们又需要频繁地连接数据库 这时候,为了提高效率,这里就会采用连接池技术: 连接池地通俗理解: 一个池里面放入很多的连接,需要哪一个取出来用即可,用完 ...

  8. sql 语句的limit的用法

    SELECT * FROM table  LIMIT [offset,] rows | rows OFFSET offset   mysql> SELECT * FROM table LIMIT ...

  9. Java的面向对象(初涉)

    Java的面向对象(初涉) 面向对象的分析根据抽象关键的问题域来分解系统.面向对象的设计是一种提供符号设计系统的面向对象的实现过程,它用非常接近实际领域术语的方法把系统构造成"现实世界&qu ...

  10. Dispatch Queue 之 dispatch_async

     可以看到,在queue里的任务,不仅仅是一个函数,也可以是一个其他的queue. 下面是一个例子.  全局队列的处理 一般一个全局队列有多个线程,这些个线程会遍历并处理链表里的任务. 对于全局队 ...