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. vm-linux-格式化磁盘以及挂载

    数据盘大小20g 文件系统xfs 分区工具fdisk 1,虚拟机关机状态,打开设置新添加一个20g硬盘 2,重新启动虚拟机,并登陆linux,打开命令窗口 3,对磁盘进行分区 输入 fdisk -l ...

  2. Delphi 自定义窗体类名

    原理就是覆盖原CreateParams函数,重写新CreateParams函数,在新CreateParams函数继承完之后马上修改Parames.WinClassName type TForm1 = ...

  3. print语法

    循环体 是 缩进的 :缩进是 Python 组织语句的方式.在交互式命令行里,得为每个缩输入制表符或空格.使用文本编辑器可以实现更复杂的输入方式:所有像样的文本编辑器都支持自动缩进.交互式输入复合语句 ...

  4. Qt多线程编程之QThreadPool 和 QRunnable使用

    说到线程通常会想到QThread,但其实Qt中创建线程的方式有多种,这里主要介绍其中一种QRunnable,QRunnable和QThread用法有些不同,并且使用场景也有区别.要介绍QRunnabl ...

  5. JS实现复制富文本到剪贴板/粘贴板的最佳实践

    背景 最近有想实现一个功能,通过点击一个button按钮,来复制网页内容(含html)来实现复制后粘贴到邮件或者word具有富文本的效果.在网站翻了一些资料,要么就是方法已经被弃用,要么就是兼容性特别 ...

  6. 记录一次vue的报错

    1.主要代码 <div class="hello-ezuikit-js" v-for="(item,index) in list"> <div ...

  7. 使用python做基本的数据处理

    使用python做基本的数据处理 1.常用的基本数据结构 元组.列表.字典.集合.常用的序列函数 1.1基本操作 1.1.1 元组:逗号分开的序列值. tup = tuple (4,5,6) tup ...

  8. echarts——横向柱状堆叠图

    var data = { data: [[320], [120], [220], [150]], legend: ['华为', '中兴', '烽火', '瑞斯'], } var option; var ...

  9. 关于centos防火墙的一些问题

    防火墙有两种:firewall iptables. 两个都需要设置

  10. E: 无法获得锁 /var/lib/apt/lists/lock - open (11: 资源暂时不可用)E: 无法对目录 /var/lib/apt/lists/ 加锁

    问题: 解决:https://www.cnblogs.com/long5683/p/11058066.html 使用方法二 可以