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. python_opencv应用系列1:图片读写

    opencv的读写非常简单,主要用到的就是imread和imwrite两个函数 读取图片示例 import cv2 #imread(filename[, flags]) -> retval im ...

  2. Node.js-sublime text3 配置node.js(ERROR: The process "node.exe" not found.)

    默认已经安装好sublime.node和npm 1.sublime的node.js插件下载 由于在package control上经常下载失败,所以这里直接从GitHub上进行下载! GitHub下载 ...

  3. 洛谷 P2814 家谱

    题目背景 现代的人对于本家族血统越来越感兴趣. 题目描述 给出充足的父子关系,请你编写程序找到某个人的最早的祖先. 输入输出格式 输入格式: 输入由多行组成,首先是一系列有关父子关系的描述,其中每一组 ...

  4. SIEMENS Simotion 运动控制器设置Web service, HTTP, FTP访问密码

    早期版本的web service, 访问密码是 用户名 : simotion 密码 : simotion 新版本,Firmware >= 4.4之后,考虑到安全性,控制器没有默认密码.设置密码方 ...

  5. hdu-3584 Cube---三维树状数组+区域更新单点查询

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=3584 题目大意: 给定一个N*N*N多维数据集A,其元素是0或是1.A[i,j,k]表示集合中第 i ...

  6. POJ-3669 Meteor Shower---BFS+预处理

    题目链接: https://vjudge.net/problem/POJ-3669 题目大意: 巨大流星雨即将袭来.每个流星会对击中的地方以及周围(上下左右四格)造成破坏.Bessie开始时位于(0, ...

  7. C++11 新特性之 decltypekeyword

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/lr982330245/article/details/30728131 decltypekeywor ...

  8. poj 2115 扩展欧几里得

    题目链接:http://poj.org/problem?id=2115 题意: 给出一段循环程序,循环体变量初始值为 a,结束不等于 b ,步长为 c,看要循环多少次,其中运算限制在 k位:死循环输出 ...

  9. Mac 修改用户环境变量

    Mac 修改用户环境变量 sudo vim ~/.bash_profile

  10. Could not autowire. No beans of 'TbAssetsMapper' type found. less... (Ctrl+F1) Inspection info:Checks autowiring problems in a bean class.

    报错:Could not autowire. No beans of 'TbAssetsMapper' type found. less... (Ctrl+F1) Inspection info:Ch ...