1.查看防火墙是否在运行  firewall-cmd --state

[root@localhost ~]# firewall-cmd --state
running

2.查看都有哪些端口添加到例外 firewall-cmd --permanent --list-port

permanent 永久配置

[root@localhost ~]# firewall-cmd --permanent --list-port
80/tcp

3.添加端口到例外 firewall-cmd --permanent --zone=public --add-port=48489/tcp

[root@localhost ~]# firewall-cmd --permanent --zone=public --add-port=48489/tcp
success

查看永久例外的端口列表

[root@localhost ~]# firewall-cmd --permanent --list-port
80/tcp 48489/tcp

4.删除端口例外 firewall-cmd --permanent --remove-port=80/tcp

[root@localhost ~]# firewall-cmd --permanent --remove-port=80/tcp
success

查看端口列表

[root@localhost ~]# firewall-cmd --permanent --list-port
48489/tcp

5. 停止firewald防火墙 systemctl stop firewalld

[root@localhost /]# systemctl stop firewalld
[root@localhost /]# firewall-cmd --state
not running

6.启动firewalld防火墙

systemctl start firewalld

在关闭防火墙后 仍然不能访问nginx,需要查看是否开启nginx进程

ps -ef | grep nginx  以下结果就是系统自带的nginx 说明并不没有开启服务

[root@localhost etc]# ps -ef | grep nginx
root 2340 2188 0 04:41 pts/0 00:00:00 grep --color=auto nginx

centos 7.0 firewall 防火墙常用命令的更多相关文章

  1. CentOS 7.0 firewall防火墙关闭firewall作为防火墙,这里改为iptables防火墙

    CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙步骤: 1.先检查是否安装了: iptables service iptables status 2.安装ip ...

  2. CentOS 7.0 Firewall防火墙配置

    启动停止 获取firewall状态 systemctl status firewalld.service firewall-cmd --state 开启停止防火墙 开机启动:systemctl ena ...

  3. Centos下磁盘管理的常用命令记录(如查找大文件)

    Centos下磁盘管理的常用命令记录 查看系统磁盘空间占用,使用命令: df -h 结果: 查看磁盘inode使用情况,如果inode用完了,磁盘就没法写入新的内容了: df -i 结果: 如何查找磁 ...

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

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

  5. firewall防火墙常用操作

    # firewall防火墙常用操作 - 启动```systemctl start firewalld```- 停止```systemctl stop firewalld```- 重启```system ...

  6. CentOS 7中firewall防火墙详解和配置以及切换为iptables防火墙

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

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

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

  8. Centos7防火墙常用命令

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

  9. Fortigate防火墙常用命令

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

随机推荐

  1. MVC 后台管理框架 FineUIMvc 在线示例

     FineUIMvc 在线示例 基础版下载

  2. GDB调试命令小结

    1.启动调试 前置条件:编译生成执行码时带上 -g,如果使用Makefile,通过给CFLAGS指定-g选项,否则调试时没有符号信息.gdb program //最常用的用gdb启动程序,开始调试的方 ...

  3. CentOS7中防火墙的一些常用配置

    # 启动 systemctl start firewalld # 查看状态 systemctl status firewalld # 停止关闭 systemctl disable firewalld ...

  4. 在使用EF时调用DBFUNCTION扩展方法时,发生ENTITYCOMMANDEXECUTIONEXCEPTION 异常的解决办法

    System.Data.Entity.Core.EntityCommandExecutionException : An error occurred while executing the comm ...

  5. vi安装Vundle+YouCompleteMe+注释快捷'scrooloose/nerdcommenter'

    Vundle is short for Vim bundle and is a Vim plugin manager. 从git上下载vundle $ git clone https://github ...

  6. ZooKeeper 笔记(6) 分布式锁

    目前分布式锁,比较成熟.主流的方案有基于redis及基于zookeeper的二种方案. 大体来讲,基于redis的分布式锁核心指令为SETNX,即如果目标key存在,写入缓存失败返回0,反之如果目标k ...

  7. [LeetCode] Maximal Rectangle 最大矩形

    Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and ...

  8. IT培训行业揭秘(四)

    IT培训班的老师前面已经说过,很多都是从一线程序员岗位转过来的,因为培训行业的收入整体上来看还是比作普通程序员要高一些,这是市场的普遍行情.还有一部分老师从培训班学习过并且留到培训班任教的.一般这种老 ...

  9. JS组件系列——Bootstrap组件福利篇:几款好用的组件推荐(二)

    前言:上篇 JS组件系列——Bootstrap组件福利篇:几款好用的组件推荐 分享了几个项目中比较常用的组件,引起了许多园友的关注.这篇还是继续,因为博主觉得还有几个非常简单.实用的组件,实在不愿自己 ...

  10. 委托,匿名函数和lambda表达式

    很早之前就接触到了委托,但是一直对他用的不是太多,主要是本人是菜鸟,能写的比较高级的代码确实不多,但是最近在看MSDN微软的类库的时候,发现了微软的类库好多都用到了委托,于是决定好好的研究研究,加深一 ...