一、开放端口

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. $Django 路飞之课程下的分类,用户登陆成功前端存cookie,

    一 课程分类显示 宗旨:总的再次过滤 二 Cookie # export default new Vuex.Store({ state: { name:'', token:'', }, mutatio ...

  2. php的ts和nts安装包

    2017-12-29 15:17:05 星期五 翻译一下PHP对 ts , nts 的解释 官网说明地址:  http://windows.php.net/download  (windows下载页左 ...

  3. Golang channel 特性

    最近在项目中遇到了 Go channel 的一些问题,在此记录下 close channel 的一些特性. 关闭channel ch := make(chan bool) close(ch) clos ...

  4. win10:在关闭防火墙下如何屏蔽特定端口

    如果win10没有组策略,请参考:https://www.cnblogs.com/huiy/p/9291392.html 在"开始"菜单选择"运行",输入&qu ...

  5. 【原创】大数据基础之Presto(1)简介、安装、使用

    presto 0.217 官方:http://prestodb.github.io/ 一 简介 Presto is an open source distributed SQL query engin ...

  6. HTML网页背景图很长要有滚动条滑动

    1 前言 由于网页背景图非常长,然后会出现只显示当前页面,后面部分看不到,也不能滑动,开始以为不能滑动应该是没有加overflow-y: auto(scroll),结果加上去也是无效的. 2 代码 & ...

  7. JS访问SpringMVC后台

    var actions=ctx.path + "/api/stat/exportScheStatInfo.json"; var form = $("<form> ...

  8. 如何使用Jquery直接导入记事本的内容

    直接上代码 <!DOCTYPE html> <html> <head> <title> </title> </head> < ...

  9. 39)django-XSS 过滤

    使用kingedit别人是可以输入script代码.这在后台是不允许script代码运行的. 这里主要使用beatifulSoup过滤 示例1 beatufulsoup4 from bs4 impor ...

  10. Linux安装nodejs和npm

    先安装,nvm,即是Node Version Manager(Node版本管理器) curl -o- https://raw.githubusercontent.com/creationix/nvm/ ...