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

CentOS 7.X 防火墙简单配置的更多相关文章

  1. CentOS 7 以上防火墙简单配置

    CentOS 7 版本以上默认的防火墙不是iptables,而是firewalle. 因此CentOS 7 以下的 iptables 的配置不能使用. 查看防火墙状态: systemctl statu ...

  2. 华为USG6000V防火墙简单配置案例

    如图,PC1是企业内网用户,要通过防火墙NAT方式( 1.1.1.105-1.1.1.106 )访问Internet,Server是企业的FTP服务器,通过静态NAT方式供外网用户访问,对外的地址是1 ...

  3. Centos 6\7 防火墙入门配置

    Centos 6 -- iptables iptables 用法: iptables (选项) (参数) 选项: -t<表>:指定要操纵的表: -A:向规则链中添加条目: -D:从规则链中 ...

  4. centos 6.5 samba简单配置

    1.安装samba yum -y install samba  (我的显示已经安装啦!) 2.编辑samba的配置文件 vi /etc/samba/smb.conf 用 testparm查看我配置后的 ...

  5. Centos 安装dhcp及简单配置

    install yum -y install dhcp file /etc/dhcp/dhcpd.conf eg:-------------------------------- ddns-updat ...

  6. Centos 6.5下一个SNMP简单配置(snmp protocol v3,监控宝)

    Centos 6.5下一个SNMP简单配置(snmp protocol v3.监控宝) jom_ch@2014/7/25 1,安装 >yum -y install net-snmp net-sn ...

  7. CentOS 7.0 使用 yum 安装 MariaDB 与 MariaDB 的简单配置

    1.安装MariaDB 安装命令 yum -y install mariadb mariadb-server 安装完成MariaDB,首先启动MariaDB,两条命令都可以 systemctl sta ...

  8. Centos7 关于防火墙的一些简单配置

    近期安装了linux系统Centos7,接触下来发现了与原来的Centos6.5有一些差别,这里主要记录下来我的一些关于Centos7防火墙的了解. 一.firewall简介 CentOS 7中防火墙 ...

  9. CentOS 7 防火墙端口配置

    CentOS 7 防火墙端口配置查看防火墙是否开启systemctl status firewalld 若没有开启则开启systemctl start firewalld 查看所有开启的端口firew ...

随机推荐

  1. python3基础13(format的使用)

    #!/usr/bin/env python# -*- coding:utf-8 -*- from string import Templatedict={'name':'python','age':2 ...

  2. Centos 7.0_64bit 下安装 Zabbix server 3.0服务器的安装

    一.关闭selinux   修改配置文件/ etc / selinux / config,将SELINU置为禁用(disabled)   vim /etc/selinux/config  # This ...

  3. C++ POD类型

    POD( Plain Old Data)概念: Arithmetic types (3.9.1), enumeration types, pointer types, and pointer to m ...

  4. Python 看书的一些记录 运算符重载

    1.类和模块有什么关系? (1)类是模块的一部分,是模块对象的属性. (2)类和模块都是命名空间,但是类是对于语法的.模块是对于文件的 (3)类支持多个实例,但是模块被导入时只有一个. 2.什么是抽象 ...

  5. 【转载】#330 - Derived Classes Do Not Inherit Constructors

    A derived class inherits all of the members of a base class except for its constructors. You must de ...

  6. 计算时间 相加,相减 的方法,TimeSpan 数据转换

    #region Time calculation method public static string DelayTypeTime_1(DateTime ArrivalTime_1, DateTim ...

  7. 其他信息: 尝试加载 Oracle 客户端库时引发 BadImageFormatException。如果在安装 32 位 Oracle 客户端组件的情况下以 64 位模式运行,将出现此问题。在VS中的解决方法

    第一种,不使用dataaccess,使用通用的Oracle.ManagedDataAccess,可以忽略版本问题 第二种,在属性——生成——web中iis express换成用本地IIS执行,但是这样 ...

  8. hdu-3449 Consumer---有依赖性质的背包

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=3449 题目大意: fj打算去买一些东西,在那之前,他需要一些盒子去装他打算要买的不同的物品.每一个盒 ...

  9. create-react-app项目使用假数据

    做新项目的时候,前端每次要等后端接口准备好再开始,就会延期,等后端接口准备好了,前端这边的项目又会相互紧张,如果前端跟后端同时进行,前期将框架,基础做好,定好接口文档,前端在后端没准备好接口的时候使用 ...

  10. linux命令之sed命令

    sed是一种流编辑器,它是文本处理中非常中的工具,能够完美的配合正则表达式使用,功能不同凡响.处理时,把当前处理的行存储在临时缓冲区中,称为“模式空间”(pattern space),接着用sed命令 ...