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. Ubuntu 卸载重装 IntelliJ Idea Community

    参考: https://stackoverflow.com/questions/22983101/how-to-uninstall-intellij-idea-on-ubuntu-13-10 @SLH ...

  2. 设计模式---策略模式Strategy(对象行为型)

    1. 概述 策略模式定义了一系列的算法,并将每一个算法封装起来,而且使它们还可以相互替换.策略模式让算法独立于使用它的客户而独立变化. 策略模式是对算法的封装,它把算法的责任和算法本身分割开,委派给不 ...

  3. ThinkPad T420 Fn+F5

    关于F5,可做如下设置:     1)官网win7系统下载SIhotkey[8jvu39ww].exe:最新版本的我没测试,应该也可以用.     2)双击安装,并按程序安装,直到要你选择安装on s ...

  4. Future 模式简介

    简介 Future 模式是多线程开发中的一种常见设计模式,它的核心思想是异步调用. 比如我们在网上购物,付款后就会产生一个订单,之后你该干嘛干嘛,快递小哥会上门送货,而不必像在超市结账那样,付款后要等 ...

  5. c++中局部变量初始化的问题

    在C语言里,全局变量如果不初始化的话,默认为0,也就是说在全局空间里: int x =0; 跟 int x; 的效果看起来是一样的.但其实这里面的差别很大,强烈建议大家所有的全局变量都要初始化,他们的 ...

  6. [algorithm] 汉诺塔问题

    汉诺塔是根据一个传说形成的一个问题.汉诺塔(又称河内塔)问题是源于印度一个古老传说的益智玩具.大梵天创造世界的时候做了三根金刚石柱子,在一根柱子上从下往上按照大小顺序摞着64片黄金圆盘.大梵天命令婆罗 ...

  7. INTERVAL

    select sysdate - interval '10' day as "10天前",       sysdate - interval '10' hour as " ...

  8. 【python】并查集

    转自:http://blog.csdn.net/rav009/article/details/12781899 # -*- coding: UTF-8 -*- class unionfind: def ...

  9. 【黑金原创教程】【FPGA那些事儿-驱动篇I 】实验六:数码管模块

    实验六:数码管模块 有关数码管的驱动,想必读者已经学烂了 ... 不过,作为学习的新仪式,再烂的东西也要温故知新,不然学习就会不健全.黑金开发板上的数码管资源,由始至终都没有改变过,笔者因此由身怀念. ...

  10. ASP.NET MVC与ASP.NET Web Form简单区别

    概论: Asp.net  微软 提供web开发框架或者技术.分Web Form和ASP.NET MVC.下面简单说明各自优缺点及使用场景. Web Form 优点: 1.支持丰富的服务器控件.如:Gr ...