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. Codeforces Round #485 (Div. 2) A. Infinity Gauntlet

    Codeforces Round #485 (Div. 2) A. Infinity Gauntlet 题目连接: http://codeforces.com/contest/987/problem/ ...

  2. windows安装mongodb及相关命令

      - 安装   解压: mongodb-win32-x86_64-2008plus-ssl-3.6.4.7z 将文件夹改名为mongodb 移动文件到指定目录下,如: C:\python\soft ...

  3. PMP:3.项目经理角色

    成员角色:整合指挥者 在团队中的职责:负终责 知识技能:综合技能&沟通   定义: 职能经理专注于对某个职能领域或业务部门的管理监督. 运营经理负责保证业务运营的高效性. 项目经理是由执行组织 ...

  4. 使用 mybatis-generator 自动生成 MyBatis 代码

    首先把这三个文件放到一个目录里,我是放到了C盘下的wangbo目录下: 接下来就是设置config.xml文件了,config.xml: <?xml version="1.0" ...

  5. a标签嵌套a标签在实际项目开发中遇到的坑

    大家都知道HTML的嵌套规范,其中一个规范是块元素嵌套行内元素,块元素嵌套块元素,行内元素嵌套行内元素,行内元素不能嵌套块元素. 其中需要注意的是行内元素嵌套行内元素,a标签虽然是行内元素,但是a标签 ...

  6. jQuery应用实例1:定时弹出图片

    以前用JS实现的:http://www.cnblogs.com/xuyiqing/p/8373064.html 这里利用jQuery实现,并且做得更完善: <!DOCTYPE html> ...

  7. [Swift]扩展UIColor:实现十六进制颜色字符串与UIColor之间的相互转换

    对[UIColor]进行扩展 import UIKit extension UIColor { // Hex String -> UIColor convenience init(hexStri ...

  8. kubernetes集群搭建(9):docker 镜像的导入与导出

    由于K8s搭建时官方提供的镜像不FQ是访问不了的,所以搭建过程中很多时间都耗费在去找镜像去了 下面是我搭建k8s集群用到的镜像  没有采用之前我用的二进制文件搭建(dns没成功),这里采用的Kubea ...

  9. centos7上安装cacti监控

     简介 在企业网络运维过程中,管理员必须时刻关注服务器的运行状态,如CPU.内存.磁盘空间使用情况等.为了能够及时的发现问题,尽量减少故障的发生.当网络中的设备,服务器等数量较多时,可以部署一套监控系 ...

  10. Linux - 修改内核启动顺序及删除无用内核

    现象: CentOS7开机启动界面显示多个内核选项 原因: 正常情况下,有两个启动项,一个是"正常启动",另一个是"救援模式启动"(rescue). 如果启动项 ...