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. VS2015 类模板保存位置

    如果安装在C盘,则是如下位置: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\ItemTemplates\CSharp ...

  2. Latex 自定义命令:用于一些特殊单词的显示

    \usepackage{xspace} \newcommand{\ie}{{\emph{i.e.}},\xspace} \newcommand{\viz}{{\emph{viz.}},\xspace} ...

  3. 说说xgboost算法

    xgboost算法最近真是越来越火,趁着这个浪头,我们在最近一次的精准营销活动中,也使用了xgboost算法对某产品签约行为进行预测和营销,取得了不错的效果.说到xgboost,不得不说它的两大优势, ...

  4. LINK1104:无法打开文件"\.obj"原因及解决办法

    那是由于具有空文件名的库导致的,只需要检查一下配置信息把出现空文件名的地方进行改正就可以了. 作者:耑新新,发布于  博客园 转载请注明出处,欢迎邮件交流:zhuanxinxin@foxmail.co ...

  5. WPF简单的分页控件实现

    XAML代码(使用ItemsControl控件实现): <UserControl x:Class="SunCreate.Vipf.Client.UI.CityDoor.PageCont ...

  6. Codeforces gym102152 K.Subarrays OR

    传送:http://codeforces.com/gym/102152/problem/K 题意:给定$n(n\le10^5)$个数$a_i(a_i\le10^9)$,对于任一个子数组中的数进行或操作 ...

  7. 如何运用kali-xplico网络取证分析?点开看看吧

    0x00前言: 本工具仅供安全技术学习和教育用途,禁止非法使用!      前方高能 建议物理机选作,虚拟机快照,万一你那个东西做错了,我还得背锅0x01介绍:      Xplico网络数据取证工具 ...

  8. HTTP 协议基础概念和报文结构

    基础概念 1.WWW(World Wide Web,万维网)构建技术有3项: (1)把SGML(Standard Generalized Markup Language,标准通用标记语言)作为页面的文 ...

  9. spring boot log4j2配置

    [传送门]:log4j官网配置文件详解 1. 排除 spring boot 自带的  spring-boot-starter-logging 依赖 <dependency> <gro ...

  10. SQL 的单引号转义字符

    SQL 的转义字符是:'(单引号) 例:select * from user where name = '''06' 其中红色的单引号即表示转义字符,上例中 name的实际条件值为 '06,而不是 ' ...