安装:yum install firewalld

1、firewalld的基本使用

启动: systemctl start firewalld
查看状态: systemctl status firewalld 
禁用,禁止开机启动: systemctl disable firewalld
停止运行: systemctl stop firewalld
 

2.配置firewalld-cmd

查看版本: firewall-cmd --version
查看帮助: firewall-cmd --help
显示状态: firewall-cmd --state
查看所有打开的端口: firewall-cmd --zone=public --list-ports
更新防火墙规则: firewall-cmd --reload
更新防火墙规则,重启服务: firewall-cmd --completely-reload
查看已激活的Zone信息:  firewall-cmd --get-active-zones
查看指定接口所属区域: firewall-cmd --get-zone-of-interface=eth0
拒绝所有包:firewall-cmd --panic-on
取消拒绝状态: firewall-cmd --panic-off
查看是否拒绝: firewall-cmd --query-panic
 

3.信任级别,通过Zone的值指定

drop: 丢弃所有进入的包,而不给出任何响应 
block: 拒绝所有外部发起的连接,允许内部发起的连接 
public: 允许指定的进入连接 
external: 同上,对伪装的进入连接,一般用于路由转发 
dmz: 允许受限制的进入连接 
work: 允许受信任的计算机被限制的进入连接,类似 workgroup 
home: 同上,类似 homegroup 
internal: 同上,范围针对所有互联网用户 
trusted: 信任所有连接

4.firewall开启和关闭端口

以下都是指在public的zone下的操作,不同的Zone只要改变Zone后面的值就可以
添加:
firewall-cmd --zone=public --add-port=80/tcp --permanent    (--permanent永久生效,没有此参数重启后失效)
重新载入:
firewall-cmd --reload
查看:
firewall-cmd --zone=public --query-port=80/tcp
删除:
firewall-cmd --zone=public --remove-port=80/tcp --permanent
 

5.管理服务

以smtp服务为例, 添加到work zone
添加:
firewall-cmd --zone=work --add-service=smtp
查看:
firewall-cmd --zone=work --query-service=smtp
删除:
firewall-cmd --zone=work --remove-service=smtp
 

5.配置 IP 地址伪装

查看:
firewall-cmd --zone=external --query-masquerade
打开:
firewall-cmd --zone=external --add-masquerade
关闭:
firewall-cmd --zone=external --remove-masquerade

6.端口转发

打开端口转发,首先需要打开IP地址伪装
  firewall-cmd --zone=external --add-masquerade
 
转发 tcp 22 端口至 3753:
firewall-cmd --zone=external --add-forward-port=22:porto=tcp:toport=3753
转发端口数据至另一个IP的相同端口:
firewall-cmd --zone=external --add-forward-port=22:porto=tcp:toaddr=192.168.1.112
转发端口数据至另一个IP的 3753 端口:
firewall-cmd --zone=external --add-forward-port=22:porto=tcp::toport=3753:toaddr=192.168.1.112
 

6.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。

启动一个服务:systemctl start firewalld.service
关闭一个服务:systemctl stop firewalld.service
重启一个服务:systemctl restart firewalld.service
显示一个服务的状态:systemctl status firewalld.service
在开机时启用一个服务:systemctl enable firewalld.service
在开机时禁用一个服务:systemctl disable firewalld.service
查看服务是否开机启动:systemctl is-enabled firewalld.service
查看已启动的服务列表:systemctl list-unit-files|grep enabled
查看启动失败的服务列表:systemctl --failed

CentOS7 防火墙(firewall)的操作命令(转)的更多相关文章

  1. CentOS7防火墙firewall相关操作

    1.firewalld的基本使用 启动: systemctl start firewalld 查看状态: systemctl status firewalld 停止: systemctl disabl ...

  2. centos7防火墙--firewall

    centos7的防火墙变成firewall了 systemctl start firewalld.service#启动firewallsystemctl stop firewalld.service# ...

  3. CentOS7 防火墙Firewall常用命令

    1.firewalld的基本使用 启动: systemctl start firewalld 查看状态: systemctl status firewalld  停止: systemctl disab ...

  4. CentOS7防火墙firewall

    一.Firewall 1. 从CentOS7开始,默认使用firewall来配置防火墙,没有安装iptables(旧版默认安装). 2. firewall的配置文件是以xml的格式,存储在 /usr/ ...

  5. CentOS7 防火墙(firewall)的操作命令

    CentOS7 防火墙(firewall)的操作命令 安装:yum install firewalld 1.firewalld的基本使用 启动: systemctl start firewalld 查 ...

  6. CentOS7下Firewall防火墙配置用法详解

    官方文档地址: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Security_Guide ...

  7. Centos7 使用firewall管理防火墙

    一.Centos7使用firewall的管理防火墙 1.firewalld基本使用 启动:systemctl start firewalld 关闭:systemctl stop firewalld 状 ...

  8. 防火墙 firewall iptables

    firewalld FirewallD 使用服务service 和区域zone来代替 iptables 的规则rule和链chain,默认情况下,有以下的区域zone可用: drop – 丢弃所有传入 ...

  9. Centos7防火墙快速开放端口配置方法

    ▲这篇文章主要为大家详细介绍了Centos7防火墙开放端口的快速方法,感兴趣的小伙伴们可以参考一下! Firewalld服务是红帽RHEL7系统中默认的防火墙管理工具,特点是拥有运行时配置与永久配置选 ...

  10. CentOS7 防火墙设置

    CentOS7 防火墙命令 最近在公司服务器上安装了oracle12c数据库,在用数据库客户端连接的时候,连接不了.最后查找资料的原因是因为oracle的服务端口未开放. 首先还是还是输入以往的开启某 ...

随机推荐

  1. UGUI打字机效果文本组件

    using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; ...

  2. 三、vue之router

    三.vue之router 此时vue的脚手架.创建项目已经完成. ... vue的运行流程 index.html-->main.js-->App.vue-->router/index ...

  3. Cyclone IV FPGA 器件笔记

    LE(逻辑单元)操作模式 1) 正常模式 2)算术模式 可以看到对于Cy4来说正常模式和算术模式的区别就是正常模式有一个4输入LUT没有cout进位输出,而算术模式有两个3输入LUT有cout进位输出 ...

  4. 利用Owin解决CORS报错问题

    我的项目是vue + ASP.NET .在 Vue调试时,由于vue开启的调试用的服务器端口号 和 后台.NET程序的端口号是不同的,发送Ajax请求时,就会报错.这里就不提报错的原因了,网上有很多, ...

  5. MySQL之排序、分组(五)

    一.排序 格式:select * from 表 order by 字段 asc|desc 1.查询所有的商品进行排序(升序asc.降序desc) mysql> select * from pro ...

  6. Motivation

    觉得一个需求不错,却没有意愿去做,唯一可能的意愿就是生活需要.可这并不能很好的带动起来什么,除了让自己觉得在逼自己. 后来在这个需求的基础上,延伸出新的需求,可能更适应生活.仍然没有意愿去动手,虽然生 ...

  7. 4327: JSOI2012 玄武密码

    4327: JSOI2012 玄武密码 Description 在美丽的玄武湖畔,鸡鸣寺边,鸡笼山前,有一块富饶而秀美的土地,人们唤作进香河.相传一日,一缕紫气从天而至,只一瞬间便消失在了进香河中.老 ...

  8. [原创]Zynq SDIO WIFI SotfAP调试

    编译好kernel和driver 加载firmware后,运行下述命令. mkdir /var/run/ mkdir /var/run/hostapd   ifconfig -a           ...

  9. 【转载】详解一条sql语句的执行过程

    转载自 https://www.cnblogs.com/cdf-opensource-007/p/6502556.html SQL是一套标准,全称结构化查询语言,是用来完成和数据库之间的通信的编程语言 ...

  10. RN和IOS原生端交互

    1.RCTBridgeModule #import <Foundation/Foundation.h> #import "RCTBridgeModule.h" #imp ...