CentOS6关闭防火墙使用以下命令,

//临时关闭
service iptables stop
//禁止开机启动
chkconfig iptables off

CentOS7中若使用同样的命令会报错,

stop  iptables.service
Failed to stop iptables.service: Unit iptables.service not loaded.

这是因为CentOS7版本后防火墙默认使用firewalld,因此在CentOS7中关闭防火墙使用以下命令,

//临时关闭
systemctl stop firewalld
//禁止开机启动
systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

1、firewalld的基本使用

启动: systemctl start firewalld
关闭: systemctl stop firewalld
查看状态: systemctl status firewalld 
开机禁用  : systemctl disable firewalld
开机启用  : systemctl enable firewalld
 
 
2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。

启动一个服务: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
查看已启动的服务列表:systemctl list-unit-files|grep enabled
查看启动失败的服务列表:systemctl --failed

3.配置firewalld-cmd

查看版本: firewall-cmd --version
查看帮助: firewall-cmd --help
显示状态: firewall-cmd --state
查看所有打开的端口: firewall-cmd --zone=public --list-ports
更新防火墙规则: firewall-cmd --reload
查看区域信息:  firewall-cmd --get-active-zones
查看指定接口所属区域: firewall-cmd --get-zone-of-interface=eth0
拒绝所有包:firewall-cmd --panic-on
取消拒绝状态: firewall-cmd --panic-off
查看是否拒绝: firewall-cmd --query-panic
 
那怎么开启一个端口呢
添加
firewall-cmd --zone=public --add-port=80/tcp --permanent    (--permanent永久生效,没有此参数重启后失效)
重新载入
firewall-cmd --reload
查看
firewall-cmd --zone= public --query-port=80/tcp
删除
firewall-cmd  --remove-port=80/tcp --permanent
---------------------------------------------------------------------------
centos6关闭防火墙
先进入init.d目录,命令如下:
[root@centos6 ~]# cd /etc/init.d/

[root@centos6 init.d]#

然后
查看防火墙状态:
[root@centos6 init.d]# /etc/init.d/iptables status

暂时关闭防火墙:
[root@centos6 init.d]# /etc/init.d/iptables stop

重启iptables:
[root@centos6 init.d]# /etc/init.d/iptables restart
 
centos6 开启端口:
写入修改
        /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT   
保存修改 
         /etc/init.d/iptables save   
 重启防火墙,修改生效
        service iptables restart    

CentOS7/6 关闭防火墙(转载)的更多相关文章

  1. CentOS7/6 关闭防火墙

    CentOS6关闭防火墙使用以下命令, //临时关闭 service iptables stop //禁止开机启动 chkconfig iptables off CentOS7中若使用同样的命令会报错 ...

  2. Centos7永久关闭防火墙

    Centos7永久关闭防火墙 查看防火墙状态: systemctl status firewalld.service 绿的running表示防火墙开启 执行关闭命令: systemctl stop f ...

  3. centos7上关闭防火墙

    centos7上默认开启的是+firewalld,关闭了iptables 停止防护墙: systemctl stop firewalld.service 开机不启动: systemctl disabl ...

  4. 003 centos7中关闭防火墙

    在centos7中,防火墙有了新的变化.下面是常用的几个命令. 1.查看状态 systemctl status firewalld 2.关闭防火墙 systemctl stop firewalld.s ...

  5. Centos7设置关闭防火墙

    CentOS 7.0默认使用的是firewall作为防火墙,要想使用iptables必须重新设置一下. 1.关闭防火墙 [root@localhost ~]# systemctl stop firew ...

  6. LINUX关闭防火墙(转载)

    (1) 重启后永久性生效: 开启:chkconfig iptables on 关闭:chkconfig iptables off (2) 即时生效,重启后失效: 开启:service iptables ...

  7. Centos7.0关闭防火墙

    CentOS 7.0默认使用的是firewall作为防火墙,使用iptables必须重新设置一下 1.直接关闭防火墙 systemctl stop firewalld.service #关闭firew ...

  8. centos7上面关闭防火墙

    CentOS 7.0默认使用的是firewall作为防火墙:若没有启用iptables 作为防火墙,则使用以下方式关闭防火墙: systemctl stop firewalld.service 关闭开 ...

  9. centos7下关闭防火墙

    查看防火墙:systemctl status firewalld.service 关闭防火墙:systemctl stop firewalld.service 以上方式是暂时的,重启系统则防火墙仍然开 ...

  10. 【Linux】CentOS7 打开关闭防火墙及端口

    一.centos7版本对防火墙进行加强,不再使用原来的iptables,启用firewalld1.firewalld的基本使用启动: systemctl start firewalld查状态:syst ...

随机推荐

  1. python 中的lamda 表达式

      #1. print(list(filter(lambda x: x%2,range(10))))    #[1, 3, 5, 7, 9]# 非lamda表示def odd(x): return x ...

  2. 正确处理iOS从下方滑出滚动视图

    本文提供 Demo下载 在iOS 11开始,从最早的地图应用到最近的捷径,陆续有系统应用使用从下方滑出列表的形式,这种系统提供的圆角风格视图用手势划出和隐藏时非常自然流畅.国内的一些应用也跟进了这种交 ...

  3. MyBatis_10(分页插件)

    主题:分页插件 --> 针对:查询功能 一.分页插件使用步骤: 1-添加依赖 <!-- https://mvnrepository.com/artifact/com.github.page ...

  4. The Nine Arches Bridge

  5. noi 1.5 42画矩形

    noi 1.5 42画矩形 1.描述 根据参数,画出矩形. 2.输入 输入一行,包括四个参数:前两个参数为整数,依次代表矩形的高和宽(高不少于3行不多于10行,宽不少于5列不多于10列):第三个参数是 ...

  6. python实现web应用程序(1)虚拟环境与Django

    前言 在这个系列博客中,我将使用python实现一个名为"OI笔记"的项目. 1 建立项目目录 第一步,我们先为自己的项目建立一个目录. 首先,打开终端. win+r键,然后输入c ...

  7. https原理(六)系统分析

    先解决此前的问题: 1 http原理(三)双向实践(curl) need时java 客户端可访问,但没客户端证书:want时有 后来发现,没有给truststore,猜测为,当springboot读到 ...

  8. 【转】BIO,NIO和AIO

    本文转自:https://blog.csdn.net/qxy_1218/article/details/123941039 BIO,NIO和AIO是Java网络编程的三种模型 BIO:同步并阻塞,服务 ...

  9. lineHeight 和fontSize的区别

    参考资料:https://blog.csdn.net/WuLex/article/details/94667136 暂时记录,待测试确认. lineHeight包含了行间距,而fontSize只是字体 ...

  10. VUE+elementUI 分页请求回显问题解决方案

    一直专注写后台的本人,之前新产品回显问题,一直没处理,这对实施配置系统,会产生很大影响 由于写页面的同事要离职,一直在游泳,只能自己上手去干了.本人对 vue 和elementUI 处于一知半解,所以 ...