• firewall-cmd 笔记


    检查firewall是否运行

    # systemctl status firewalld
    firewalld.service - firewalld - dynamic firewall daemon
       Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)
       Active: active (running) since Thu 2015-01-22 20:51:48 EST; 2h 15min ago
     Main PID: 564 (firewalld)
       CGroup: /system.slice/firewalld.service
               └─564 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
    
    Jan 22 20:51:48 localhost.localdomain systemd[1]: Started firewalld - dynamic...
    Hint: Some lines were ellipsized, use -l to show in full.

    or

    # firewall-cmd --state
    running

    查看当前配置

    # firewall-cmd --get-default-zone
    internal
    # firewall-cmd --get-active-zones
    internal
      interfaces: enp0s3

    这里enp0s3是网卡的配置

     列出可用的zone

    # firewall-cmd --get-zones
    block dmz drop external home internal public trusted work

    修改默认的zone, 这种修改只是暂时(tempoary)的,重启之后会失效

    # firewall-cmd --set-default-zone=home
    success

    获得public zone的细节

    # firewall-cmd --zone=public --list-all
    public
      interfaces:
      sources:
      services: dhcpv6-client ssh
      ports:
      masquerade: no
      forward-ports:
      icmp-blocks:
      rich rules:

    注意:--list-all只显示永久(permanent, 重启后不会丢失)的配置

    Service的管理

    http服务permanently加入internal zone

    # firewall-cmd --permanent --zone=internal --add-service=http
    success
    # firewall-cmd --reload

     note: 使用 -remove-service=http 来禁止http service
     note: 必须使用 firewall-cmd --reload 命令来激活先前的改变

  • 相关阅读:
    datatables插件适用示例
    RabbitMQ三----'任务分发 '
    ftp上传下载
    运用JS导出ecxel表格、实现文件重命名
    浅谈MySQL索引背后的数据结构及算法【转】
    SQL语句导致性能问题
    由浅入深理解索引的实现【转】
    MySQL ACID及四种隔离级别的解释
    MyISAM引擎和InnoDB引擎的特点
    MySQL复制中slave延迟监控
  • 原文地址:https://www.cnblogs.com/jHenry/p/4243846.html
Copyright © 2020-2023  润新知