systemctl status firewalld

firewall-cmd --zone=public --list-ports ##查看已开放的端口

2.添加5901端口到白名单 执行

firewall-cmd --permanent --zone=public --add-port=5901/tcp

提示 success 表示成功

命令含义

--zone #作用域
--add-port=5901/tcp #添加端口,格式为:端口/通讯协议
--permanent #永久生效,没有此参数重启后失效

3.重启防火墙:添加成功之后需要重启防火墙

firewall-cmd --reload

其他常用命令:

firewall-cmd --state ##查看防火墙状态,是否是running
firewall-cmd --reload ##重新载入配置,比如添加规则之后,需要执行此命令
firewall-cmd --get-zones ##列出支持的zone
firewall-cmd --get-services ##列出支持的服务,在列表中的服务是放行的
firewall-cmd --query-service ftp ##查看ftp服务是否支持,返回yes或者no
firewall-cmd --add-service=ftp ##临时开放ftp服务
firewall-cmd --add-service=ftp --permanent ##永久开放ftp服务
firewall-cmd --remove-service=ftp --permanent ##永久移除ftp服务
firewall-cmd --add-port=80/tcp --permanent ##永久添加80端口
firewall-cmd --remove-port=80/tcp --permanent ##永久添加80端口
firewall-cmd --zone=public --list-ports ##查看已开放的端口

iptables -L -n ##查看规则,这个命令是和iptables的相同的
man firewall-cmd

Linux-firewall防火墙的更多相关文章

  1. 《Linux就该这么学》培训笔记_ch08_iptables与firewall防火墙

    <Linux就该这么学>培训笔记_ch08_iptables与firewall防火墙 文章最后会post上书本的笔记照片. 文章主要内容: 防火墙管理工具 iptables firewal ...

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

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

  3. 写了个Linux包过滤防火墙

    花几天写了个so easy的Linux包过滤防火墙,估计实际意义不是很大.防火墙包括用户态执行程序和内核模块,内核模块完全可以用iptable代替.由于在编写的过程一开始写的是内核模块所以就直接用上来 ...

  4. Linux firewalld 防火墙

    Linux firewalld 防火墙  简介 RHEL 7 系统中集成了多款防火墙管理工具,其中 firewalld(Dynamic Firewall Manager of Linux system ...

  5. Centos中iptables和firewall防火墙开启、关闭、查看状态、基本设置等(转)

    iptables防火墙 1.基本操作 # 查看防火墙状态 service iptables status   # 停止防火墙 service iptables stop   # 启动防火墙 servi ...

  6. Linux上防火墙开放对应的端口

    在Linux上防火墙开放对应的端口的命令如下: 方式一: [root@localhost sbin]# /sbin/iptables -I INPUT -p tcp --dport 80 -j ACC ...

  7. 使用 firewalld 构建 Linux 动态防火墙

    firewalld 是新一 Linux 代防火墙工具,它提供了支持网络 / 防火墙区域 (zone) 定义网络链接以及接口安全等级的动态防火墙管理工具.它也支持允许服务或者应用程序直接添加防火墙规则的 ...

  8. linux设置防火墙

    这样其他主机还是无法访问我们的数据库,linux关闭防火墙,其他主机就可以访问了. 关闭防火墙:/etc/init.d/iptables  stop 开启防火墙:/etc/init.d/iptable ...

  9. Linux的防火墙概念

    #linux的防火墙概念#因为如果你不关防火墙,很可能运行 django.nginx.mysql出错#防火墙可能会阻挡端口流量的 出口#也会阻挡外来请求的 入口 #selinux iptables f ...

  10. CentOS 7中firewall防火墙详解和配置以及切换为iptables防火墙--转载

    最近在linux(这里用到的是Centos7的64位版本)安装nginx时,在开放80端口时用iptables设置端口 和重启服务发现提示未找到文件,在网络上收集查找后发现在Centos7中iptab ...

随机推荐

  1. C#实体类null自动转空字符串

    C#实体类null自动转空字符串 using System.ComponentModel.DataAnnotations; [DisplayFormat(ConvertEmptyStringToNul ...

  2. C++ unordered_set运用实例

    C++ unordered_set运用实例 #include <unordered_set> #include <numeric> #include "print.h ...

  3. Generate a Certificate Signing Request (CSR) in macOS Keychain Access

    macOS 10.14 (Mojave) 1. Open the Keychain Access application, located at /Applications/Utilities/Key ...

  4. 【PHP】两个时间段间隔30分钟的所有时间

    运用场景: 比如在进行配送时候,需要让用户选择 送达时间, 平台只需要设置每天的营业时间.比如:08:00 到  22:30. 前台在展示时候: 就需要处理成各个时间段来展示: 代码实现: <? ...

  5. npx vs npm

    npx vs npm npx 使用教程

  6. codesmith设置mysql的连接字符串

    .net core,codesmith连不上 server=192.168.3.240;Initial Catalog=tpmdb;User=root;Password=root .net frame ...

  7. 【Python】解决使用pyinstaller打包Tkinker程序报错问题

    问题描述 使用pyinstaller打包使用Tkinter编写的控制台程序,出现报错 15793 INFO: Adding Microsoft.Windows.Common-Controls to d ...

  8. 【springcloud】【idea】启动服务报错Command line is too long. Shorten command line for XXXApplication or also for Spring Boot default configuration.

    在workspace.xml 在标签<component name="PropertiesComponent">里 添加<property name=" ...

  9. [转帖]rename(Perl语言版本) 详解

    rename(Perl语言版本) 详解 2019-03-19 22:51:23 wayne17 阅读数 464更多 分类专栏: Ubuntu之路   版权声明:本文为博主原创文章,遵循CC 4.0 B ...

  10. layui 动画 实现过程

    layui官方文档晦涩难懂,对小白特别不友好 为演示效果,js和css文件引用cdn 演示是ul套li标签进行演示,这不是固定的,你也可以div套div,div套span,外面和里面的标签类要一一对应 ...