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

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

  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值