CentOS7中默认使用firewalld代替了iptables . 接下来将对firewalld, 做一些初步的了解.

首先读一下, redhat的文档:

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/security_guide/sec-using_firewalls

重要内容摘录如下:

1.  firewalld与iptables的区别:

. The iptables service stores configuration in /etc/sysconfig/iptables and /etc/sysconfig/ip6tables, 
while firewalld stores it in various XML files in /usr/lib/firewalld/ and /etc/firewalld/.
Note that the /etc/sysconfig/iptables file does not exist as firewalld is installed by default
on Red Hat Enterprise Linux.
. With the iptables service, every single change means flushing all the old rules and reading all
the new rules from /etc/sysconfig/iptables, while with firewalld there is no recreating of all the rules.
Only the differences are applied. Consequently, firewalld can change the settings
during runtime without existing connections being lost.

2. service

[root@S205 ~]# man firewalld.service

配置文件:

[root@S205 ~]# ls /usr/lib/firewalld/services/
amanda-client.xml dns.xml http.xml kpasswd.xml mysql.xml pop3.xml rpc-bind.xml squid.xml tor-socks.xml
amanda-k5-client.xml docker-registry.xml imaps.xml ldaps.xml nfs.xml postgresql.xml rsyncd.xml ssh.xml transmission-client.xml
bacula-client.xml dropbox-lansync.xml imap.xml ldap.xml ntp.xml privoxy.xml samba-client.xml synergy.xml vdsm.xml
bacula.xml freeipa-ldaps.xml ipp-client.xml libvirt-tls.xml openvpn.xml proxy-dhcp.xml samba.xml syslog-tls.xml vnc-server.xml
ceph-mon.xml freeipa-ldap.xml ipp.xml libvirt.xml pmcd.xml ptp.xml sane.xml syslog.xml wbem-https.xml
ceph.xml freeipa-replication.xml ipsec.xml mdns.xml pmproxy.xml pulseaudio.xml smtps.xml telnet.xml xmpp-bosh.xml
dhcpv6-client.xml ftp.xml iscsi-target.xml mosh.xml pmwebapis.xml puppetmaster.xml smtp.xml tftp-client.xml xmpp-client.xml
dhcpv6.xml high-availability.xml kadmin.xml mountd.xml pmwebapi.xml radius.xml snmptrap.xml tftp.xml xmpp-local.xml
dhcp.xml https.xml kerberos.xml ms-wbt.xml pop3s.xml RH-Satellite-.xml snmp.xml tinc.xml xmpp-server.xml
[root@S205 ~]#

查看当前系统里预置的(可以设置的)所有服务:

[root@S205 ~]# firewall-cmd --get-services

查看生效的服务:

[root@S205 ~]# firewall-cmd --list-services
dhcpv6-client ssh
[root@S205 ~]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: enp3s0
sources:
services: dhcpv6-client ssh
ports:
protocols:
masquerade: no
forward-ports:
sourceports:
icmp-blocks:
rich rules:

查看服务详情:

[root@S205 ~]# firewall-cmd --info-service=http
http
ports: /tcp
protocols:
source-ports:
modules:
destination:

/usr/lib/firewalld/services/ 下的服务是默认自带, 用户不应该对他们进行编辑, 用户定义的应该放在目录/etc/firewalld/services/,  这一点和systemd是一样的.

可以是有几个方法新增服务:

方法A:

cp /usr/lib/firewalld/services/service-name.xml /etc/firewalld/services/service-name.xml

方法B:

firewall-cmd --permanent --new-service-from-file=service-name.xml
[root@S205 zones]# firewall-cmd --add-service=http
success
[root@S205 zones]# firewall-cmd --list-services
dhcpv6-client ssh http
[root@S205 zones]#

方法C:

修改如下配置文件:

[root@S205 ~]# vim /etc/firewalld/zones/public.xml

[daily][centos][iptables][firewalld] firewalld的初步了解的更多相关文章

  1. [daily][centos][nginx] 在centos7使用nginx启用对文件目录的http访问

    1. 安装nginx yum install nginx 2. 修改配置 2.1 提供目录权限: 我需要访问的目录是 /home/data, 用户是data, 所以修改如下配置: [root@S205 ...

  2. CentOS 7关闭firewalld启用iptables

    在CentOS7中,有很多CentOS 6中的常用服务发生了变化. 其中iptables是其中比较大的一个.防火墙iptables被firewalld取代. 本文将介绍,如果采用systemctl关闭 ...

  3. CentOS 7关闭firewalld启用iptables 开放端口

    在CentOS7中,有很多CentOS 6中的常用服务发生了变化. 其中iptables是其中比较大的一个.防火墙iptables被firewalld取代. 本文将介绍,如果采用systemctl关闭 ...

  4. 腾讯云服务器CentOS 7防火墙firewalld管理

    在腾讯云上买了个服务器(centOS7),部署了Tomcat(8080),Apache(80),MySQL(3306)等,一开始按照百度教程配置是把防火墙关闭了的.最近一段时间服务器总是莫名的被人修改 ...

  5. Centos 7防火墙firewalld开放80端口(转)

    开启80端口 firewall-cmd --zone=public --add-port=80/tcp --permanent 出现success表明添加成功 命令含义: --zone #作用域 -- ...

  6. netfilter/iptables和firewalld的关系

    1.netfilter 是linux 内核模块,其中包含了大量的内核规则,而要想对这些内核规则进行操作,就需要用户态的工具. iptables和firewalld就是一个用户态的工具. 2.iptab ...

  7. 《linux就该这么学》第十节课:第8章iptables和firewalld

            网卡配置: 物理机:192.168.10.1/24 服务器:192.168.10.10/24 客户端:192.168.10.20/24         1.vim  /etc/sysc ...

  8. centos7之iptables与firewalld

    保障数据的安全性是继保障数据的可用性之后最为重要的一项工作.防火墙作为公网 与内网之间的保护屏障,在保障数据的安全性方面起着至关重要的作用. firewalld与iptables iptables f ...

  9. 第7章 Iptables与Firewalld防火墙。

    第7章 Iptables与Firewalld防火墙.     Chapter7_听较强节奏的音乐能够让您更长时间的投入在学习中. <Linux就该这么学> 00:00/00:00     ...

随机推荐

  1. ORA-03297: 文件包含在请求的 RESIZE 值以外使用的数据

    本文中的45,对应 修改数据文件大小 里面的45 1.移动表前先对表空间做整理 alter tablespace data_cis_test coalesce; 2.在dba_extents找到与ID ...

  2. JavaScript Scroll家族以及封装

    JavaScript Scroll家族以及封装 scrollTop & scrollLeft 别卷去的值,就是当滑动滚轮浏览网页的时候,网页隐藏在屏幕上方或左侧的距离 获得scrollTop ...

  3. hdoj:2034

    #include <iostream> #include <vector> #include<algorithm> //包含sort函数 using namespa ...

  4. 卷积、矩阵乘积、高斯模糊滤波(降噪)、空域计算(2D卷积计算)、频域计算(FFT)的理解

    矩阵乘积:对应行列对应元素相乘的和组成新的矩阵 两个矩阵的乘法仅当第一个矩阵A的列数和另一个矩阵B的行数相等时才能定义.如A是m×n矩阵和B是n×p矩阵,它们的乘积C是一个m×p矩阵 并将此乘积记为: ...

  5. Java知多少(中)

    Java知多少(上) )interface接口 )接口和抽象类的区别 )泛型详解 )泛型通配符和类型参数的范围 )异常处理基础 )异常类型 )未被捕获的异常 )try和catch的使用 )多重catc ...

  6. Python encode() 方法(转)

    转自:http://www.cnblogs.com/wushuaishuai/p/7686290.html 描述 encode() 方法以指定的编码格式编码字符串,默认编码为 'utf-8'. 对应的 ...

  7. 生产环境使用nginx做负载均衡配置的五种策略

    nginx的upstream目前支持5种方式的分配1.轮询(默认) 每个请求按时间顺序逐一分配到不同的后端服务器,如果后端服务器down掉,能自动剔除. 2.weight指定轮询几率,weight和访 ...

  8. [Bayes] Point --> Hist: Estimate "π" by R

    Verify the Monte Carlo sampling variability of "π". p = π/4 与 所得 0.7854 比较接近,故满足 Central L ...

  9. 检测浏览器是否支持某个css属性

    以浏览器是否支持translate3d 为例说明,当然现代浏览器已经支持该属性.如果浏览器实现了带有前缀的某个属性,比如说支持-webkit-transform,但是不支持直接写transform,可 ...

  10. 【代码审计】XYHCMS V3.5任意文件删除漏洞分析

      0x00 环境准备 XYHCMS官网:http://www.xyhcms.com/ 网站源码版本:XYHCMS V3.5(2017-12-04 更新) 程序源码下载:http://www.xyhc ...