zoukankan      html  css  js  c++  java
  • 第二篇:zone(区域)

    什么是区域?

    网络区域定义网络连接的信任级别(the level of trust for network connections)。一个网络连接只能是一个区域的一部分,但一个区域可以包含许多网络连接。

    预定义的服务

    服务是端口和/或协议条目的组合。可以随意添加netfilter助手模块(netfilter helper modules ),以及IPv4和IPv6目标地址

    端口和协议

    定义tcp或udp端口,其中端口可以是单个端口或端口范围。

    ICMP块

    选定的Internet控制消息协议(ICMP)消息。这些消息要么是信息请求,要么是作为对信息请求或错误条件的回复创建的。

    地址伪装(Masquerading)

    一个私有网络的地址被映射到一个公共IP地址后面。这是地址转换的一种形式。

    转发端口(Forward ports)

    端口要么映射到另一个端口,要么映射到另一个主机。

    哪些区域可用 (Which zones are available)?

    这些区域由firewalld提供,根据从不受信任到可信的区域的默认信任级别进行排序。

    drop

    Any incoming network packets are dropped, there is no reply. Only outgoing network connections are possible.

    block

    Any incoming network connections are rejected with an icmp-host-prohibited message for IPv4 and icmp6-adm-prohibited for IPv6. Only network connections initiated within this system are possible.

    public

    For use in public areas(公共网络). You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.

    external(对外的)

    For use on external networks with masquerading enabled especially for routers(用于在外部网络上进行伪装,特别是路由器。). You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.

    dmz(非军事区)

    For computers in your demilitarized zone(非军事区) that are publicly-accessible with limited access to your internal network. Only selected incoming connections are accepted.

    work

    For use in work areas. You mostly trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.

    home

    For use in home areas. You mostly trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.

    internal(内网)

    For use on internal networks. You mostly trust the other computers on the networks to not harm your computer. Only selected incoming connections are accepted.

    trusted

    All network connections are accepted.

    应该使用哪个区域?

    例如,公共WIFI网络连接总体上是不受信任的,有线家庭网络连接应当相当可信。选择与您使用的网络连接最匹配的zone。

    如何配置或添加区域?

    要配置或添加区域,您可以使用firewalld接口之一来处理和更改配置。这些接口包括图形化配置工具firewall-config,命令行配置工具firewall-cmd或者是D-BUS接口。或者你可以在两个配置文件夹中创建或者拷贝一个zone文件。/lib/firewalld/zones配置文件夹用于默认和回退配置/etc/firewalld/zones配置文件夹用于用户创建和自定义配置文件

    [root@bogon zones]# ls
    block.xml  dmz.xml  drop.xml  external.xml  home.xml  internal.xml  public.xml  trusted.xml  work.xml
    [root@bogon zones]# pwd
    /lib/firewalld/zones
    [root@bogon zones]# cd /etc/firewalld/zones
    [root@bogon zones]# ls
    internal.xml  public.xml  public.xml.old  seccon.xml  work.xml
    [root@bogon zones]# pwd
    /etc/firewalld/zones

    如何设置或更改连接的区域(How to set or change a zone for a connection

    该zone存储在ifcfg-*配置文件中的ZONE选项。如果选项缺失或为空,则使用firewalld中设置的默认区域。

    [root@bogon network-scripts]# less ifcfg-enp0s3
    
    TYPE="Ethernet"
    PROXY_METHOD="none"
    BROWSER_ONLY="no"
    BOOTPROTO="dhcp"
    DEFROUTE="yes"
    IPV4_FAILURE_FATAL="no"
    IPV6INIT="yes"
    IPV6_AUTOCONF="yes"
    IPV6_DEFROUTE="yes"
    IPV6_FAILURE_FATAL="no"
    IPV6_ADDR_GEN_MODE="stable-privacy"
    NAME="enp0s3"
    UUID="76f0285c-24c4-40f0-982e-4b9b6a1d3383"
    DEVICE="enp0s3"
    ONBOOT="yes"
    ZONE=public

    如果连接由NetworkManager控制,则还可以使用nm-connection-editor更改区域。

    通过NetworkManager处理网络连接(Network connections

    防火墙无法使用NetworkManager显示的名称处理网络连接,它只能处理网络接口。因此,NetworkManager会告诉firewalld在连接建立之前将与连接相关的网络接口放置在由连接的配置文件(ifcfg)定义的区域中。如果该区域未在配置文件中设置,则接口将被放入由firewalld设置的默认区域。如果连接有多个接口,则都将提供给firewalld。接口名称的更改也将由NetworkManager处理并提供给firewalld。

    为了简化这个连接,从现在开始将使用与区域相关的连接。

    如果连接断开,NetworkManager还会通知firewalld再次从区域移除连接。

    如果firewalld由systemd或init脚本启动或重新启动,则firewalld会通知NetworkManager,并将连接添加到zone。

    网络连接由网络脚本处理....

  • 相关阅读:
    动态规划之解决01背包问题 【转载】
    暴力搜索解0-1背包问题 【转载】
    回溯法之地图着色
    贪心算法之最小生成树
    贪心算法之最短路径
    HMM隐马尔科夫模型
    变分贝叶斯
    Leetcode好的微博
    HMM隐马尔科夫模型浅析
    向量的协方差矩阵浅析
  • 原文地址:https://www.cnblogs.com/jimboi/p/8452402.html
Copyright © 2011-2022 走看看