从centos7开始使用systemctl来管理服务和程序,包括了service和chkconfig。

#systemctl list-unit-files|grep firewalld.service

  

[root@localhost ~]#systemctl status firewalld.service

  

关闭防火墙:

systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动

  

启动一个服务:systemctl start firewalld.service

关闭一个服务:systemctl stop firewalld.service

重启一个服务:systemctl restart firewalld.service

显示一个服务的状态:systemctl status firewalld.service

在开机时启用一个服务:systemctl enable firewalld.service

在开机时禁用一个服务:systemctl disable firewalld.service

查看服务是否开机启动:systemctl is-enabled firewalld.service;echo $?

查看已启动的服务列表:systemctl list-unit-files|grep enabled

  

Centos 7 firewall 命令:

查看已经开放的端口:

1
firewall-cmd --list-ports

开启端口

1
firewall-cmd --zone=public --add-port=80/tcp --permanent

命令含义:

–zone #作用域

–add-port=80/tcp #添加端口,格式为:端口/通讯协议

–permanent #永久生效,没有此参数重启后失效

关闭防火墙 

1) 永久性生效,重启后不会复原

开启: chkconfig iptables on

关闭: chkconfig iptables off

2) 即时生效,重启后复原

开启: service iptables start

关闭: service iptables stop

查看防火墙状态: service iptables status

entOS 7默认使用的是firewall作为防火墙,使用iptables必须重新设置一下

1、直接关闭防火墙

1
2
3
systemctl stop firewalld.service #停止firewall
 
systemctl disable firewalld.service #禁止firewall开机启动

2、设置 iptables service

1
yum -y install iptables-services

如果要修改防火墙配置,如增加防火墙端口3306

1
vi /etc/sysconfig/iptables

增加规则

1
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

保存退出后

1
2
3
systemctl restart iptables.service #重启防火墙使配置生效
 
systemctl enable iptables.service #设置防火墙开机启动

最后重启系统使设置生效即可。

1
2
3
systemctl start iptables.service #打开防火墙
 
systemctl stop iptables.service #关闭防火墙

centos7防火墙的关闭的更多相关文章

  1. centos6和centos7防火墙的关闭

    CentOS6.5查看防火墙的状态: [zh@localhost ~]$service iptable status 显示结果: [zh@localhost ~]$service iptable st ...

  2. 详解centos6和centos7防火墙的关闭

    http://www.jb51.net/article/101576.htm http://www.myhack58.com/Article/48/66/2013/37314.htm http://w ...

  3. CentOs7 使用iptables防火墙开启关闭端口

    CentOs7 使用iptables防火墙开启关闭端口   # 0x01介绍 iptables命令是Linux上常用的防火墙软件,是netfilter项目的一部分iptables文件设置路径:命令:v ...

  4. Centos7防火墙和SELinux的开启和关闭

    在虚拟机里面开启多个服务,对应多个端口,在防火墙开启的情况下,就要对外开放端口,这样客户端才能正常访问,但比较繁琐,关闭更直接点. 防火墙 临时关闭防火墙 systemctl stop firewal ...

  5. Linux防火墙开启关闭查询

    1.centos7防火墙 命令含义: –zone #作用域 –add-port=80/tcp #添加端口,格式为:端口/通讯协议 –permanent #永久生效,没有此参数重启后失效 服务与端口的启 ...

  6. Linux CentOS中防火墙的关闭及开启端口

    注:CentOS7之前用来管理防火墙的工具是iptable,7之后使用的是Firewall 样例:在CentOS7上安装tomcat后,在linux本机上可以访问tomcat主页,http://ip: ...

  7. 详解centos6和centos7防火墙

    CentOS6.5查看防火墙的状态: ? 1 [zh@localhost ~]$service iptable status 显示结果: ? 1 2 3 4 5 6 7 8 9 [zh@localho ...

  8. centos7 防火墙 开启端口 并测试

    1.防火墙 CentOS升级到7之后,发现无法使用iptables控制Linuxs的端口,google之后发现Centos 7使用firewalld代替了原来的iptables.下面记录如何使用fir ...

  9. CentOS 6和CentOS 7防火墙的关闭

    CentOS6.5查看防火墙的状态: 1 [linuxidc@localhost ~]$service iptable status 显示结果: 1 2 3 4 5 [linuxidc@localho ...

随机推荐

  1. 【SAM】POJ1509-Glass Beads

    [题目大意] 求一个循环数列的最小表示法. [思路] 把原创复制一遍放在后面,建立SAM,从s按字典序开始跑长度L即可. 板子来源(作者见连接内):

  2. [bzoj1012](JSOI2008)最大数maxnumber(Fenwick Tree)

    Description 现在请求你维护一个数列,要求提供以下两种操作: 1. 查询操作.语法:Q L 功能:查询当前数列中末尾L个数中的最大的数,并输出这个数的值.限制:L不超过当前数列的长度. 2. ...

  3. 推荐系统中的SVD

    本文主要参考:Factorization Meets the Neighborhood: a Multifaceted Collaborative Filtering Model 在用户对自己需求相对 ...

  4. 一日一点RakNet(3)--介绍

    介绍 安装 请参考Compiler Setup页,有什么问题在这块有解答.如果有额外的问题参考FAQ,http://www.jenkinssoftware.com,或者邮件联系我们.高级用户可以直接跳 ...

  5. jquery的表单验证方法,一个function能不能同时捕捉点击事件和按键事件?能不能再优化下,有代码。

    // 该jquery扩展引自 http://www.ghostsf.com/tools/389.html 方法名是作者博客的命名 $.fn.ghostsf_serialize = function ( ...

  6. ajax常用请求方式

    1.JAVA @RequestMapping(value = "testAjax") @ResponseBody public Map<String, Object> ...

  7. C++ 初始化列表(转载)

    何谓初始化列表 与其他函数不同,构造函数除了有名字,参数列表和函数体之外,还可以有初始化列表,初始化列表以冒号开头,后跟一系列以逗号分隔的初始化字段.在 C++中,struct和class的唯一区别是 ...

  8. Appium获取安卓页面toast(java版)

    toast是什么?安卓页面上弹出的提示框,这种提示框出现在屏幕上大概3秒左右就会消失.用uiautomatorviewer根本定位不到. 准备环境,Appium版本需要1.6.3以上. 代码 初始化设 ...

  9. android apktool 基本的安装与使用

    apktool: 1. 安装 http://ibotpeaches.github.io/Apktool/install/ 2. 基本使用 http://ibotpeaches.github.io/Ap ...

  10. 【4.29安恒杯】writeup

    #### 安恒杯_writeup 下面为比赛中做出的题目 MISC: SHOW ME THE FLAG-by-cyyzore CRYPTO: LAZYATTACK-by-GoldsNow 这一题非常巧 ...