一、开放端口

sudo firewall-cmd --zone=public --add-port=3000/tcp --permanent
sudo firewall-cmd --reload

  

二、关闭防火墙

//临时关闭防火墙,重启后会重新自动打开
systemctl restart firewalld
//检查防火墙状态
firewall-cmd --state
firewall-cmd --list-all
//Disable firewall
systemctl disable firewalld
systemctl stop firewalld
systemctl status firewalld
//Enable firewall
systemctl enable firewalld
systemctl start firewalld
systemctl status firewalld

  

三、查看防火墙规则

firewall-cmd --list-all

  

四、执行 systemctl start firewalld 命令后出现Failed to start firewalld.service: Unit is masked

执行命令,即可实现取消服务的锁定

# systemctl unmask firewalld

下次需要锁定该服务时执行

# systemctl mask firewalld

  

五。常见问题:

更新了Python版本(version>=Python3),cnetos7系统自带的是Python2.7。
在安装python时,一般教程都会提示说,安装成功后,yum不能用,需要修改yum配置文件(vim /usr/bin/yum)。 把文件头部的#!/usr/bin/python改成#!/usr/bin/python2.7
那么这个方法,继续可以在这个问题上使用:
第一步,vim /usr/bin/firewall-cmd, 将#!/usr/bin/python -Es 改为 #!/usr/bin/python2.7 -Es(到目前为止,上面提到的问题已解决)
第二步,vim /usr/sbin/firewalld, 将#!/usr/bin/python -Es 改为 #!/usr/bin/python2.7 -Es (这一步是针对于防火墙报错,进行的修改)

  firewall-cmd --list-ports

Centos7防火墙常用命令及mask锁定不能添加端口问题的更多相关文章

  1. Centos7防火墙常用命令

    有些人安装的linux的系统默认防火墙不是iptables,而是firewall,那就得使用以下方式关闭防火墙了. >>>关闭防火墙 systemctl stop firewalld ...

  2. Centos7 防火墙常用命令 开启 关闭防火墙

    如果你的系统上没有安装使用命令安装 #yum install firewalld  //安装firewalld 防火墙 开启服务 # systemctl start firewalld.service ...

  3. linux下防火墙开启某个端口号及防火墙常用命令使用

    linux防火墙常用命令 1.永久性生效,重启后不会复原 开启:chkconfigiptables on 关闭:chkconfigiptables off 2.即时生效,重启后复原 重启防火墙 方式一 ...

  4. 【CentOS7】常用命令

    [CentOS7]常用命令 转载:https://www.cnblogs.com/yangchongxing/p/10646640.html 目录 ========================== ...

  5. Centos7 防火墙常用配置及说明

    一. Centos7和Centos6 防火墙的区别: 使用的工具不一样了.Centos6 使用的是iptables ,Centos7 使用的是filewall iptables 用于过滤数据包,属于网 ...

  6. iptables防火墙常用命令

    iptables防火墙启动停止和基本操作 iptables是centos7之前常用的防火墙,在centos7上使用了firewall 防火墙基本操作: # 查询防火墙状态 service iptabl ...

  7. Fortigate防火墙常用命令

    命令结构 #config 对策略,对象等进行配置 #get  查看相关对象的参数 #show 查看配置文件 #diagnose 诊断命令 #execute  常用的工具命令,如ping treacer ...

  8. centos6和centos7中常用命令区别

    以前一直接触的是centos6,最近因为新项目接触到centos7,发现有些命令还是有差异的(从centos7开始使用systemctl来管理服务和程序,包括了service和chkconfig),现 ...

  9. firewalld管理防火墙常用命令

    1.查看防火墙的状态 [root@localhost HMK]# firewall-cmd --state 查看防火墙的运行状态 not running [root@localhost HMK]# s ...

随机推荐

  1. UVALive 8513 lovers 2017 西安区域赛 B 贪心+multiset

    UVALive 8513 有2种人,每个人有自己的权值$A_i$ $B_i$ 当$A_i + B_i >=K$时 两个人可以配对 问最多多少人可以配对 解法 : 把$/{ A_i /}$ 排序 ...

  2. 全系列Unity4.x.x到2017.1.1破解Win&Mac!最新Unity2017.1.1p3&4.7.2f1破解!

    Unity官网所有版本下载地址请戳: http://unity3d.com/unity/download/archive 补丁版本请戳: http://unity3d.com/cn/unity/qa/ ...

  3. $Django 虚拟环境,2.0、1.0路由层区别,Httprequest对象,视图层(fbv,cbv),文件上传

    1 虚拟环境:解决问题同一台机器上可以运行不同版本的django,  1 用pychanrm创建--->files-->newproject--->选择虚拟环境  2 setting ...

  4. Keil和SourceInsight中文乱码解决方法

    一.KEIL乱码 到菜单栏Edit--->Configuration-->Encoding ---ChineseSimplied 二.SourceInsight乱码 错误现象:注释乱码,查 ...

  5. 将list集合转json

    public static class DataHelper { /// /// js 序列化器 /// static JavaScriptSerializer jss = new JavaScrip ...

  6. PHP 转义

    函数名 释义 介绍 htmlspecialchars 将与.单双引号.大于和小于号化成HTML格式 &转成&"转成"' 转成'<转成<>转成> ...

  7. Confluence 6 重构查找索引

    查找索引是自动维护的,但是你有时候可能会因为你在查找的时候或查看者邮件主题出现了异常,或者你的 Confluence 实例升级到了新的版本,你可能需要手动重构索引. 进行搜索索引重构: 在屏幕的右上角 ...

  8. Confluence 6 数据库连接方式

    你可以使用 JDBC URL 或者一个 JNDI 数据源来连接 Confluence 到你的数据库. 在默认的设置向导中,只提供了使用 JDBC 数据库连接选项,这个也是推荐的数据库连接选项. 如果你 ...

  9. ( linker command failed with exit code 1) 错误解决方案 项目使用的是pod

    targets -> build settings -> architectures -> build active architecture only -> debug 改成 ...

  10. flask 面试题

    1,什么是Flask,有什么优点?概念解释Flask是一个Web框架,就是提供一个工具,库和技术来允许你构建一个Web应用程序.这个Web应用程序可以是一些Web页面,博客,wiki,基于Web的日里 ...