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

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

  

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

  

关闭防火墙:

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

  

  1. 启动一个服务:systemctl start firewalld.service
  2.  
  3. 关闭一个服务:systemctl stop firewalld.service
  4.  
  5. 重启一个服务:systemctl restart firewalld.service
  6.  
  7. 显示一个服务的状态:systemctl status firewalld.service
  8.  
  9. 在开机时启用一个服务:systemctl enable firewalld.service
  10.  
  11. 在开机时禁用一个服务:systemctl disable firewalld.service
  12.  
  13. 查看服务是否开机启动:systemctl is-enabled firewalld.service;echo $?
  14.  
  15. 查看已启动的服务列表: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. python3-开发进阶Django中序列化以及rest_framework的序列化

    一.django框架的序列化 直接上代码 1.这是app下的models.py from django.db import models # Create your models here. clas ...

  2. HDU 5638 Toposort 拓扑排序 优先队列

    Toposort 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5638 Description There is a directed acycli ...

  3. (转)Servlet

    1.  Servlet和GCI的区别? 答:Servlet是基于Java编写的,处于服务器进程中,它能够通过多线程方式运行service()方法,一个实例可以服务于多个请求,而且一般不会销毁:而CGI ...

  4. Hiho----无间道之并查集

    题目: 时间限制:20000ms 单点时限:1000ms 内存限制:256MB 描述 这天天气晴朗.阳光明媚.鸟语花香,空气中弥漫着春天的气息……额,说远了,总之,小Hi和小Ho决定趁着这朗朗春光出去 ...

  5. 【转】Gvim配置(Windows and Linux)for C++

    转载地址:http://blog.csdn.net/onepiecehuiyu/article/details/8934366 http://mawenhao19930620.blog.163.com ...

  6. 【js】js截取字符串 +转化字符串为数字

    js有两种方法可以截取字符串 substr(start , length ])和substring(start, end) parseInt('123') : 返回 123

  7. Thunderbird for Ubuntu

    转自:http://www.cnblogs.com/slave_wc/archive/2011/05/02/2034529.html   装好ubuntu 的一般基本配置见本博客另一篇文章: Ubun ...

  8. [转]初试visual studio2012的新型数据库LocalDB 及 在visual studio2012中如何使用localDB具体讲解

    本文转自:http://www.cnblogs.com/zhangran/archive/2012/08/26/2657864.html 初试visual studio2012的新型数据库LocalD ...

  9. [转]Using the Microsoft Connector for Oracle by Attunity with SQL Server 2008 Integration Services

    本文转自:http://technet.microsoft.com/en-us/library/ee470675(v=sql.100).aspx SQL Server Technical Articl ...

  10. URLRewrite地址重定向的实现

    URLRewrite就是我们通常说的地址重写,用户得到的全部都是经过处理后的URL地址.其优点有: (1)提高安全性,可以有效的避免一些参数名.ID等完全暴露在用户面前,如果用户随便乱输的话,不符合规 ...