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