CentOS7 默认防火墙firewalld
firewalld基础
firewalld是CentOS7源生支持的防火墙,firewalld最大的好处有两个:支持动态更新,不用重启服务;第二个就是加入了防火墙的“zone”概念。
firewalld的字符界面管理工具是 firewall-cmd
firewalld默认配置文件有两个:/usr/lib/firewalld/ (系统配置,尽量不要修改)和 /etc/firewalld/ (用户配置地址)
zone概念类似于划分适用规则区域,firewalld引入这一概念系统默认存在以下区域:
drop:默认丢弃所有包
block:拒绝所有外部连接,允许内部发起的连接
public:指定外部连接可以进入
external:这个不太明白,功能上和上面相同,允许指定的外部连接
dmz:和硬件防火墙一样,受限制的公共连接可以进入
work:工作区,概念和workgoup一样,也是指定的外部连接允许
home:类似家庭组
internal:信任所有连接
安装firewalld
CentOS7默认安装firewalld。firewalld可以通过yum来安装和管理。
$ sudo yum install firewalld firewall-config
运行、停止、禁用firewalld
启动:
$ systemctl start firewalld
查看状态:
$ systemctl status firewalld
$ firewall-cmd --state
停止:
$ systemctl disable firewalld
禁用:
$ systemctl stop firewalld
常用配置firewalld命令
查看版本:
$ firewall-cmd --version
查看帮助:
$ firewall-cmd --help
显示状态:
$ firewall-cmd --state
查看区域信息:
$ firewall-cmd --get-active-zones
查看指定接口所属区域:
$ firewall-cmd --get-zone-of-interface=eth0
拒绝所有包:
$ firewall-cmd --panic-on
取消拒绝状态:
$ firewall-cmd --panic-off
查看是否拒绝:
$ firewall-cmd --query-panic
更新防火墙规则:
$ firewall-cmd --reload
$ firewall-cmd --complete-reload
两者的区别就是第一个无需断开连接,就是firewalld特性之一动态添加规则,第二个需要断开连接,类似重启服务
将接口添加到区域,默认接口都在public
$ firewall-cmd --zone=public --add-interface=eth0
设置默认接口区域
$ firewall-cmd --set-default-zone=public
查看所有打开的端口:
$ firewall-cmd --zone=dmz --list-ports
加入一个端口到区域:
$ firewall-cmd --zone=dmz --add-port=8080/tcp
打开一个服务,类似于将端口可视化,服务需要在配置文件中添加,/etc/firewalld 目录下有services文件夹
$ firewall-cmd --zone=work --add-service=smtp
移除服务
$ firewall-cmd --zone=work --remove-service=smtp
以上设置若要永久生效需再加上 --permanent 然后reload防火墙
CentOS7 默认防火墙firewalld的更多相关文章
- centos7默认防火墙firewalld
1.开关 启动: systemctl start firewalld 查看状态: systemctl status firewalld 停止: systemctl disable firewalld ...
- CentOS7.3防火墙firewalld简单配置
今天安装了centos7.3, 想用iptables的save功能保存规则的时候发现跟rhel不一样了, 后来度娘说centos用的是firewalld而不是iptables了, 平时工作都是用re ...
- Ubuntu下使用UFW,以及CentOS7的默认防火墙firewalld
UFW是一个简化版的iptables,基于iptables,配置比iptables简单 默认UFW是关闭状态,即Ubuntu默认打开所有端口,比较危险. 检测状态 ufw status 设置默认状态, ...
- Centos7开启防火墙并且使MYSQL外网访问开放3306端口
http://www.cnblogs.com/kreo/p/4368811.html CentOS7默认防火墙是firewalle,不是iptables #先检查是否安装了iptables servi ...
- Centos7启动防火墙时报错Failed to start IPv4 firewall with iptables
今天在虚拟机的Linux系统(centos7)里安装Redis,准备学习一下布隆过滤器呢,安装完后使用Windows本机访问不了虚拟机里的Redis,telnet不通能够ping通.于是就去看防火墙, ...
- linux(centos7)防火墙配置firewalld和iptables
linux系统中防火墙管理有2种方式,分别是iptables和firewalld(centos7.x),下面介绍centos7的配置方法 一.firewalld: 因为cenos7默认使用firewa ...
- centos7的防火墙(firewalld)
Centos7中默认将原来的防火墙iptables升级为了firewalld,firewalld跟iptables比起来至少有两大好处: 1.firewalld可以动态修改单条规则,而不需要像ipta ...
- fedora/centos7防火墙FirewallD详解
1 使用 FirewallD 构建动态防火墙 1.1 “守护进程” 1.2 静态防火墙(system-config-firewall/lokkit) 1.3 使用 iptables 和 ip6tabl ...
- CentOS7关闭默认防火墙启用iptables防火墙
CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙步骤. 1.关闭firewall: systemctl stop firewalld.service #停止f ...
随机推荐
- 【小程序】微信小程序开发实践
帐号相关流程 注册范围 企业 政府 媒体 其他组织 换句话讲就是不让个人开发者注册. :) 填写企业信息 不能使用和之前的公众号账户相同的邮箱,也就是说小程序是和微信公众号一个层级的. 填写公司机构信 ...
- WCF TCP通信方式 通过IIS承载调试
http://www.cnblogs.com/nikymaco/archive/2012/10/08/2715954.html IIS Express服务器只支持http/https,不支持net.t ...
- Redis(六):java里常用的redis客户端(Jedis和Redisson)
Redis的各种语言客户端列表,请参见Redis Client.其中Java客户端在github上start最高的是Jedis和Redisson.Jedis提供了完整Redis命令,而Redisson ...
- 整合Kafka到Spark Streaming——代码示例和挑战
作者Michael G. Noll是瑞士的一位工程师和研究员,效力于Verisign,是Verisign实验室的大规模数据分析基础设施(基础Hadoop)的技术主管.本文,Michael详细的演示了如 ...
- 10 redis--频道发布与消息订阅
消息订阅 使用办法: 订阅端: Subscribe 频道名称 发布端: publish 频道名称 发布内容 客户端例子: redis 127.0.0.1:6379> subscribe news ...
- load-on-startup 解释
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" &qu ...
- C++刷题——2736: 指针练习--输出最大值
Description 採用指针法,输出10个整型数中的最大值和最小值 Input 10个整数 Output 最大值和最小值 Sample Input 2 6 3 8 1 5 7 0 4 9 Samp ...
- swift基础教程笔记
http://www.imooc.com/learn/127 <玩儿转swift> 慕课网教程笔记,自己根据2.1的语法做了更新. I. 1.通过playground来学习.熟悉swift ...
- IntelliJ IDEA打可执行jar包
<plugins> <plugin> <artifactId>maven-assembly-plugin</artifactId> <config ...
- cf-341C Iahub and Permutations
C. Iahub and Permutations time limit per test 1 second memory limit per test 256 megabytes input sta ...