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. 从零自学Hadoop系列索引

    本文版权归mephisto和博客园共有,欢迎转载,但须保留此段声明,并给出原文链接,谢谢合作. 文章是哥(mephisto)写的,SourceLink 从零自学Hadoop(01):认识Hadoop ...

  2. jni操作jobject

    一. 注册JNI函数 1.         静态方法 一般使用javah进行编译,生成很长的文件名和函数名字,这个书写不方便,影响运行效率. 2.         动态注册 使用JNINativeMe ...

  3. MVC中的BASE.ONACTIONEXECUTING(FILTERCONTEXT) 的作用

    一句话,就是调用base.OnActionExecuting(filterContext)这个后,才会执行后续的ActionFilter,如果你确定只有一个,或是不想执行后续的话,那么可以不用调用该语 ...

  4. apache httpd服务器403 forbidden的问题

    一.问题描述 在apache2的httpd配置中,很多情况都会出现403. 刚安装好httpd服务,当然是不会有403的问题了.主要是修改了一些配置后出现,问题描述如下: 修改了DocumentRoo ...

  5. mac 键盘映射 karabiner

    mac 键盘映射 karabiner 今天在vim编辑的时候觉得用mac的方向键有点麻烦 需要移动我的小右手,然后就搜个映射方案. 百度出来了 karabiner. 官网 安装什么的就不说了, 安完了 ...

  6. BZOJ3160万径人踪灭

    Description Input & Output & Sample Input & Sample Output HINT 题解: 题意即求不连续但间隔长度对称的回文串个数. ...

  7. centos系统编译安装nginx+php环境另加独立mysql教程

    以前看过的安装nginx+php环境都带了mysql数据库了,这个是因为很多站长都是nginx+php+mysql都在同一台服务器了,那么今天我们是单独处理了,一个是nginx+php环境,然后mys ...

  8. [LeetCode] Flip Game 翻转游戏

    You are playing the following Flip Game with your friend: Given a string that contains only these tw ...

  9. [LeetCode] Remove Duplicates from Sorted Array II 有序数组中去除重复项之二

    Follow up for "Remove Duplicates":What if duplicates are allowed at most twice? For exampl ...

  10. JavaScript-简单的贪吃蛇小游戏

    实现逻辑: //获取Html中的格子(行,列) //建立数组存储所有格子(x,y) //建立数组用于存储蛇身(x,y) //生成随机坐标(x,y)的函数 //随机创建蛇身并存储到蛇身数组 //创建食物 ...