zoukankan      html  css  js  c++  java
  • Red hat/CentOs7关闭防火墙及firewalld介绍

    一、Red hat/CentOs7关闭防火墙

    1:查看防火状态

    systemctl status firewalld

    service  iptables status

    2:暂时关闭防火墙

    systemctl stop firewalld

    service  iptables stop

    3:永久关闭防火墙

    systemctl disable firewalld

    chkconfig iptables off

    4:重启防火墙

    systemctl enable firewalld

    service iptables restart  

    5:永久关闭后重启

    //暂时还没有试过

    chkconfig iptables on

    二、firewalld常用选项

    1.启动防火墙

    systemctl start firewalld 

    2.禁用防火墙

    systemctl stop firewalld

    3.设置开机启动

    systemctl enable firewalld

    4.停止并禁用开机启动

    sytemctl disable firewalld

    5.重启防火墙

    firewall-cmd --reload
    

    6.查看状态

    systemctl status firewalld或者 firewall-cmd --state

    7.查看版本

    firewall-cmd --version

    8.查看帮助

    firewall-cmd --help

    9.查看区域信息

    firewall-cmd --get-active-zones

    10.查看指定接口所属区域信息

    firewall-cmd --get-zone-of-interface=eth0

    11.拒绝所有包

    firewall-cmd --panic-on

    12.取消拒绝状态

    firewall-cmd --panic-off

    13.查看是否拒绝

    firewall-cmd --query-panic

    14.将接口添加到区域(默认接口都在public)

    firewall-cmd --zone=public --add-interface=eth0(永久生效再加上 --permanent 然后reload防火墙)

    15.设置默认接口区域

    firewall-cmd --set-default-zone=public(立即生效,无需重启)

    16.更新防火墙规则

    firewall-cmd --reload或firewall-cmd --complete-reload(两者的区别就是第一个无需断开连接,就是firewalld特性之一动态
    添加规则,第二个需要断开连接,类似重启服务)

    17.查看指定区域所有打开的端口

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

    18.在指定区域打开端口(记得重启防火墙)

     firewall-cmd --zone=public --add-port=80/tcp(永久生效再加上 --permanent)

    说明:
    –zone 作用域
    –add-port=8080/tcp 添加端口,格式为:端口/通讯协议
    –permanent #永久生效,没有此参数重启后失效

    三、其他

    防火墙守护 firewalld 服务引入了一个信任级别的概念来管理与之相关联的连接与接口。它支持 ipv4 与 ipv6,并支持网桥,采用 firewall-cmd (command) 或 firewall-config (gui) 来动态的管理 kernel netfilter 的临时或永久的接口规则,并实时生效而无需重启服务。

    Centos7默认安装了firewalld,如果没有安装的话,

    可以使用 yum install firewalld firewalld-config进行安装。

    3.1zone

    Firewall 能将不同的网络连接归类到不同的信任级别,Zone 提供了以下几个级别

    • drop: 丢弃所有进入的包,而不给出任何响应
    • block: 拒绝所有外部发起的连接,允许内部发起的连接
    • public: 允许指定的进入连接
    • external: 同上,对伪装的进入连接,一般用于路由转发
    • dmz: 允许受限制的进入连接
    • work: 允许受信任的计算机被限制的进入连接,类似 workgroup
    • home: 同上,类似 homegroup
    • internal: 同上,范围针对所有互联网用户
    • trusted: 信任所有连接

    3.1过滤规则

    • source: 根据源地址过滤
    • interface: 根据网卡过滤
    • service: 根据服务名过滤
    • port: 根据端口过滤
    • icmp-block: icmp 报文过滤,按照 icmp 类型配置
    • masquerade: ip 地址伪装
    • forward-port: 端口转发
    • rule: 自定义规则

    其中,过滤规则的优先级遵循如下顺序

    1. source
    2. interface
    3. firewalld.conf

    3.3使用方法

    1.  
      # systemctl start firewalld # 启动,
    2.  
      # systemctl enable firewalld # 开机启动
    3.  
      # systemctl stop firewalld # 关闭
    4.  
      # systemctl disable firewalld # 取消开机启动

    具体的规则管理,可以使用 firewall-cmd,具体的使用方法可以

    1. $ firewall-cmd --help
    2. --zone=NAME # 指定 zone 
    3. --permanent # 永久修改,--reload 后生效
    4. --timeout=seconds # 持续效果,到期后自动移除,用于调试,不能与 --permanent 同时使用
  • 相关阅读:
    AX 2012 Security Framework
    The new concept 'Model' in AX 2012
    How to debug the SSRS report in AX 2012
    Using The 'Report Data Provider' As The Data Source For AX 2012 SSRS Report
    Deploy SSRS Report In AX 2012
    AX 2012 SSRS Report Data Source Type
    《Taurus Database: How to be Fast, Available, and Frugal in the Cloud》阅读笔记
    图分析理论 大纲小结
    一文快速了解Posix IO 缓冲
    #转载备忘# Linux程序调试工具
  • 原文地址:https://www.cnblogs.com/yihr/p/13625546.html
Copyright © 2011-2022 走看看