Firewalld 的基本使用
firewalld 中常用的区域名称及测了规则
|
区域
|
默认策略规则
|
|
trusted
|
允许所有的数据包
|
|
home
|
拒绝流入的流量,除非与流出的流量相关;而如果流量与 ssh、mdns、ipp-client、 amba-client 与 dhcpv6-client 服务相关,则允许流量
|
|
internal
|
等同于 home 区域
|
|
work
|
拒绝流入的流量,除非与流出的流量数相关;而如果流量与 ssh、ipp-client 与 dhcpv6-client 服务相关,则允许流量
|
|
public
|
拒绝流入的流量,除非与流出的流量相关;而如果流量与 ssh、dhcpv6-client 服务 相关,则允许流量
|
|
external
|
拒绝流入的流量,除非与流出的流量相关;而如果流量与 ssh 服务相关,则允许流量
|
|
dmz
|
拒绝流入的流量,除非与流出的流量相关;而如果流量与 ssh 服务相关,则允许流量
|
|
block
|
拒绝流入的流量,除非与流出的流量相关
|
|
drop
|
拒绝流入的流量,除非与流出的流量相关
|
终端管理工具
|
参数
|
作用
|
|
--get-default-zone
|
查询默认的区域名称
|
|
--set-default-zone=<区域名称>
|
设置默认的区域,使其永久生效
|
|
--get-zones
|
显示可用的区域
|
|
--get-services
|
显示预先定义的服务
|
|
--get-active-zones
|
显示当前正在使用的区域与网卡名称
|
|
--add-source=
|
将源自此 IP 或子网的流量导向指定的区域
|
|
--remove-source=
|
不再将源自此 IP 或子网的流量导向某个指定区域
|
|
--add-interface=<网卡名称>
|
将源自该网卡的所有流量都导向某个指定区域
|
|
--change-interface=<网卡名称
|
将某个网卡与区域进行关联
|
|
--list-all
|
显示当前区域的网卡配置参数、资源、端口以及服务等信息
|
|
--list-all-zones
|
显示所有区域的网卡配置参数、资源、端口以及服务等信息
|
|
--add-service=<服务名>
|
设置默认区域允许该服务的流量
|
|
--add-port=<端口号/协议>
|
设置默认区域允许该端口的流量
|
|
--remove-service=<服务名>
|
设置默认区域不再允许该服务的流量
|
|
--remove-port=<端口号/协议>
|
设置默认区域不再允许该端口的流量
|
|
--reload
|
让“永久生效”的配置规则立即生效,并覆盖当前的配置规则
|
|
--panic-on
|
开启应急状况模式
|
|
--panic-off
|
关闭应急状况模式
|
常用示例
[root@linuxprobe ~]# firewall-cmd --get-default-zone
public
[root@linuxprobe ~]# firewall-cmd --get-zone-of-interface=eno16777728
public
[root@linuxprobe ~]# firewall-cmd --permanent --zone=external --change-interface= eno16777728 success
[root@linuxprobe ~]# firewall-cmd --get-zone-of-interface=eno16777728
public
[root@linuxprobe ~]# firewall-cmd --permanent --get-zone-of-interface=eno16777728 external
[root@linuxprobe ~]# firewall-cmd --set-default-zone=public
success
[root@linuxprobe ~]# firewall-cmd --get-default-zone
public
[root@linuxprobe ~]# firewall-cmd --panic-on
success
[root@linuxprobe ~]# firewall-cmd --panic-off
success
[root@linuxprobe ~]# firewall-cmd --zone=public --query-service=ssh
yes
[root@linuxprobe ~]# firewall-cmd --zone=public --query-service=https
no
[root@linuxprobe ~]# firewall-cmd --zone=public --add-service=https
success
[root@linuxprobe ~]# firewall-cmd --permanent --zone=public --add-service=https
success
[root@linuxprobe ~]# firewall-cmd --reload
success
[root@linuxprobe ~]# firewall-cmd --permanent --zone=public --remove-service=http
success [root@linuxprobe ~]# firewall-cmd --reload
success
[root@linuxprobe ~]# firewall-cmd --zone=public --add-port=8080-8081/tcp
success
[root@linuxprobe ~]# firewall-cmd --zone=public --list-ports
8080-8081/tcp
[root@linuxprobe ~]# firewall-cmd --permanent --zone=public --add-forward-port=port=888:proto=tcp:toport=22:toaddr=192.168.10.10
success
[root@linuxprobe ~]# firewall-cmd --reload
success
[root@client A ~]# ssh -p 888 192.168.10.10
The authenticity of host '[192.168.10.10]:888 ([192.168.10.10]:888)' can't be established.
ECDSA key fingerprint is b8:25:88:89:5c:05:b6:dd:ef:76:63:ff:1a:54:02:1a. Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[192.168.10.10]:888' (ECDSA) to the list of known hosts. root@192.168.10.10's password:此处输入远程 root 管理员的密码
Last login: Sun Jul 19 21:43:48 2017 from 192.168.10.10
[root@linuxprobe ~]# firewall-cmd --permanent --zone=public --add-rich-rule=" rule family="ipv4" source address="192.168.10.0/24" service name="ssh" reject"
success
[root@linuxprobe ~]# firewall-cmd --reload success
[root@client A ~]# ssh 192.168.10.10
Connecting to 192.168.10.10:22...
Could not connect to '192.168.10.10' (port 22): Connection failed.
Firewalld 的基本使用的更多相关文章
- CentOS7使用firewalld打开关闭防火墙与端口(转载)
1.firewalld的基本使用 启动: systemctl start firewalld 查看状态: systemctl status firewalld 停止: systemctl disabl ...
- CentOS7使用firewalld打开关闭防火墙与端口
1.firewalld的基本使用 启动: systemctl start firewalld 查看状态: systemctl status firewalld 停止: systemctl disab ...
- linux系统的初化始配置(包括网络,主机名,关闭firewalld与selinux)
每次我们使用Linux都会对系统进行初始化的配置,下面我们一一列出来. 1.服务的开启 systemctl enable firewalld.service //将指定的服务设置为开机启动 syste ...
- Centos7的firewalld配置
红帽官方的使用文档: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Security_Gu ...
- Linux防火墙配置(iptables, firewalld)
netfilter和底层实现 iptables firealld Linux中的防火墙 RHEL中有几种防火墙共存: iptables firewalld ip6tables ebtables 这些软 ...
- centos7 firewalld
1.firewalld简介 firewalld是centos7的一大特性,最大的好处有两个: 1.支持动态更新,不用重启服务: 2.加入了防火墙的"zone"概念 firewa ...
- centos7 开启防火墙端口 firewalld
systemctl start firewalld firewall-cmd --zone=public --add-port=3306/tcp --permanent firewall-cmd -- ...
- 关于firewalld防火墙的使用
要想使用该防火墙,应该需要安装 networkmanager 并启动其服务.因为之前使用的是 netctl 提供的wifi-menu 来连接无线网络,导致安装networkmanager之后启动 Ne ...
- Centos7 关闭防火墙(Firewalld ),使用防火墙(iptables)
1.直接关闭防火墙 systemctl stop firewalld.service: #停止firewall systemctl disable firewalld.service: #禁止fire ...
- Linux系统的初化始配置(包括配置网络,修改主机名,关闭firewalld与selinux的生效)
一.配置网络环境 1.运行 cmd 查看本机的ip地址,然后记录下来. 2.网络和共享中心--本地连接属性如下: 手工配置到本地连接上面 IP:172.16.191.215,DNS:101.7.8.9 ...
随机推荐
- MySQL++:liunx 安装 MySQL
第一步: 1):下载mysql安装包:这里选择下载版本 5.6.33,通用版,linux下64位 http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql- ...
- 11.1 Go Http
11.0 Go Http http客户端 package main import ( "fmt" "net/http" "net/http/httpu ...
- 5.6 Go 常用函数
5.6 Go 常用函数 最正确的学习模块姿势: https://golang.org/pkg/ //golang官网 程序开发常用函数 strings处理字符串相关 统计字符串长度,按字节 len(s ...
- flask之session
''' session使用: session创建: (1)导入session from flask import session (2)设置secret_key密钥 app.secret_key='s ...
- 05 返回静态文件的多线程web框架
05 返回静态文件的多线程web框架 服务器server端python程序(多线程版): import socket from threading import Thread,currentThrea ...
- jquery.min.js v1.10.3版本autocomplete方法会在text前添加搜索出多少项的文本信息 要去除
http://stackoverflow.com/questions/13011127/how-to-remove-change-jquery-ui-autocomplete-helper-text ...
- Scaner对象
目录 Scaner的基本概念 基本语法: 1.使用next() 的方式来接收字符串(使用频率较少) 2.使用nextLine()的方式来接收字符串 进阶使用(练习题) Scaner的基本概念 之前我们 ...
- MySQL(2)— 数据库的基本操作
二.数据库 2-1.操作数据库(了解) 1.创建数据库 CREATE DATABASE [IF NOT EXIST] myDatabase; 2.删除数据库 DROP DATABASE `myData ...
- Java入门以及使用IDEA安装和使用
目录 JAVA第一个程序 HelloWorld 可能会遇到的情况 JAVA程序运行机制 IDEA安装 什么是IDE IDEA介绍 IDEA下载 IDEA基本使用 关于一些创建项目的小tips JAVA ...
- python常见面试题讲解(二)计算字符个数
题目描述 写出一个程序,接受一个由字母和数字组成的字符串,和一个字符,然后输出输入字符串中含有该字符的个数.不区分大小写. 输入描述: 第一行输入一个有字母和数字以及空格组成的字符串,第二行输入一个字 ...