一、开放端口

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. libunistring-0.9.9

    Introduction to libunistring Text files are nowadays usually encoded in Unicode, and may consist of ...

  2. canvas - 简单画板

    截图: Demo:Demo 上代码:. <!DOCTYPE html> <html lang="en"> <head> <meta cha ...

  3. FastCGI sent in stderr: "PHP Warning: simplexml_load_string(): Entity: line 1: parser error : Start tag expected, '&lt;' not found in

    2018-4-16 17:59:03 星期一 1. 发送带有xml参数的请求时如果是用php curl, 需要将数组形式的post data 用 http_build_query() 转换 2. 接收 ...

  4. 快速安装freeswitch

    前不久在Centos 6.4上安装了一台Freeswitch,测试已经OK.为了测试FS 的集群效果,从新在安装一台FS,快速安装的过程如下: 方案一:快速安装前提:不用重新下载Freeswitch. ...

  5. maven:手动安装JAR到本地仓库

    mvn install:install-file -DgroupId=com.test -DartifactId=test -Dversion=1.0.0 -Dpackaging=jar -Dfile ...

  6. Java的家庭记账本程序(B)

    日期:2019.2.3 博客期:029 星期日 看看今天想先完成jsp的连接操作,所以首先意识到自己的程序中,管理员可以对成员进行冻结.解封操作,所以先回去补了一下数据库的内容!成员的内容里多了一项i ...

  7. 动态获取后台传过来的值作为select选项

    问题描述:点击左侧菜单项,进入对应的具体页面a.html,页面上方有个select框,点击框后,会浮现选择项. 解决思路:对左侧菜单项添加一个onclick事件,进入后台做具体的查询,将查询到的lis ...

  8. bzoj 3529

    非常好的一道莫比乌斯反演题,对提升自己的能力有很大帮助. 首先我们分析一下题意:题意让我们求,其中 那么我们首先对后面的式子进行一下变形,变形过程详见https://blog.csdn.net/lle ...

  9. stylus入门教程,在webstorm中配置stylus

    转载:https://www.cnblogs.com/wenqiangit/p/9717715.html#undefined   stylus特点 富于表现力.具有健壮性.功能丰富.动态编码 不需要写 ...

  10. 关于C++ const 的全面总结 (转)

    C++中的const关键字的用法非常灵活,而使用const将大大改善程序的健壮性,本人根据各方面查到的资料进行总结如下,期望对朋友们有所帮助. Const 是C++中常用的类型修饰符,常类型是指使用类 ...