zoukankan      html  css  js  c++  java
  • CentOS 7.X 防火墙简单配置

    CentOS7使用的是Linux Kernel 3.10.0的内核版本,新版的Kernel内核已经有了防火墙netfilter,并且使用效能更高,稳定性更好

            配置防火墙的两种方法:

        一、使用xml配置

    方法一
    cp /usr/lib/firewalld/services/http.xml /etc/firewalld/services/
    firewall-cmd --reload

        二、使用命令的方式

      方法二

    ##Add
    firewall-cmd --permanent --zone=public --add-port=80/tcp

    ##Remove
    firewall-cmd --permanent --zone=public --remove-port=80/tcp

    ##Reload
    firewall-cmd --reload

     

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

       

        其中,方法二的firewalld/zones/public.xml文件,

        方案一也需要在public.xml里面新增<service name="http"/>,否则http的防火墙规则不会生效,

        而且两种配置方式都需要重新载入防火墙。

    附:

    查看防火墙状态

    systemctl status firewalld.service

     

    启动防火墙

    systemctl start firewalld.service

     

    关闭防火墙

    systemctl stop firewalld.service

     

    重新启动防火墙

    systemctl restart firewalld.service

  • 相关阅读:
    dbcp 详细配置
    InetAddress
    Qrcode 二维码
    左值右值分析
    javaweb reponse 写出文件
    ehcache 在集群环境下 出现 Cause was not due to an IOException or NotBoundException
    lo4j 日志级别
    log4j xml配置
    cron 表达式
    RabbitMQ简介
  • 原文地址:https://www.cnblogs.com/activiti/p/7570555.html
Copyright © 2011-2022 走看看