linux正确关闭防火墙命令,linux关闭防火墙命令

linux正确关闭防火墙命令,linux关闭防火墙命令1 Linux 系统 RedHatEnterp 5 Santiago 临时关闭防火墙命令 serviceiptab 永久关闭防火墙命令 chkconfigipt 查看防火墙状态命令 serviceiptab

1.  Linux系统:Red Hat Enterprise Linux Server release 6.5 (Santiago)

临时关闭防火墙命令:

service iptables stop

service ip6tables stop

永久关闭防火墙命令:

chkconfig iptables off

chkconfig ip6tables off

查看防火墙状态命令:

service iptables status

[root@hadoop ~]# cat /etc/redhat-release

Red Hat Enterprise Linux Server release6.5(Santiago)

[root@hadoop~]# service iptables stop

iptables: Setting chains to policy ACCEPT: filter [ OK ]

iptables: Flushing firewall rules: [ OK ]

iptables: Unloading modules: [ OK ]

[root@hadoop~]# service ip6tables stop

ip6tables: Setting chains to policy ACCEPT: filter [ OK ]

ip6tables: Flushing firewall rules: [ OK ]

ip6tables: Unloading modules: [ OK ]

[root@hadoop~]# service iptables status

iptables: Firewallisnot running.

[root@hadoop~]# service ip6tables status

ip6tables: Firewallisnot running.

[root@hadoop~]# chkconfig iptables off

[root@hadoop~]# chkconfig ip6tables off

2.  linux系统:CentOS Linux release 7.5.1804 (Core)

前面说的几个命令,我在centos 7上用着都失效了。网上说,centos从7开始默认用的是firewalld,这个是基于iptables的,虽然有iptables的核心,但是iptables的服务是没安装的。所以你只要停止firewalld服务即可

[root@hadoop ~]# sudo systemctl stop firewalld.service &&sudo systemctl disable firewalld.service

Removed symlink/etc/systemd/system/multi-user.target.wants/firewalld.service.

Removed symlink/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

如果你要改用iptables的话,需要安装iptables服务,并对命令做一些修改

[root@hadoop ~]# service iptables stop #命令失效

Redirecting to/bin/systemctl stop iptables.service

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

[root@hadoop~]# yum install iptables-services

[root@hadoop~]# /bin/systemctl stop iptables.service

[root@hadoop~]# /bin/systemctl stop ip6tables.service

永久关闭防火墙

[root@hadoop ~]# chkconfig iptables off #命令失效

Note: Forwarding request to’systemctl disable iptables.service’.

[root@hadoop~]# systemctl disable iptables.service

[root@hadoop~]# systemctl disable ip6tables.service

查看防火墙是否关闭

[root@hadoop ~]# firewall-cmd –state

not running

总结:centos 7系统关闭防火墙有2种方式:

方式1:

关闭防火墙:systemctl stop firewalld.service

永久关闭防火墙:systemctl disable firewalld.service

方式2:

首先安装iptables服务:yum install iptables-services

关闭防火墙:/bin/systemctl stop iptables.service && /bin/systemctl stop ip6tables.service

永久关闭防火墙:systemctl disable iptables.service && systemctl disable ip6tables.service

查看防火墙是否关闭:firewall-cmd –state

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/217823.html原文链接:https://javaforall.net

(0)
上一篇 2026年3月18日 上午8:40
下一篇 2026年3月18日 上午8:41


相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号