运维工程师常用的Linux常用命令——8.Linux关闭防火墙的方法以及问题总结

1. 方法一(iptables)

查看iptables状态

[root@hadoop01 hadoop-2.5.0]# service iptables status
Redirecting to /bin/systemctl status iptables.service
Unit iptables.service could not be found.

问题:Unit iptables.service could not be found.
解决方案:安装iptables
注:如果不想安装可以使用第二种方法firewalld.service关闭


安装iptables:


#安装
sudo yum install iptables-services  -y
#开启iptables
sudo systemctl enable iptables 
sudo systemctl enable ip6tables 
#启动服务
sudo systemctl start iptables 
sudo systemctl start ip6tables

1.1 临时方法

service iptables stop

1.2 永久方法

chkconfig iptables off
补充:

a. 防火墙还需要关闭ipv6的防火墙:

chkconfig ip6tables off

并且可以通过如下命令查看状态:

chkconfig --list iptables

b. selinux状态可以通过以下命令查看:

Sestatus

2. 方法二 (firewalld.service)

#停止防火墙
systemctl stop firewalld.service
停止防火墙并禁止这个服务(永久有效)
systemctl disable firewalld.service

3.方法三(selinux)

Redhat使用了SELinux来增强安全,关闭的办法为:

1. 永久有效

修改 /etc/selinux/config 文件中的 SELINUX="" 为 disabled ,然后重启。

2. 即时生效

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值