防火墙centos7执行 service iptables status报错问题完美解决

在centos7 执行防火墙命令时 service iptables status 报错如下:

 

 解决方案 :

1.systemctl start firewalld.service(开启防火墙

2.systemctl stop firewalld.service(关闭防火墙)

3.service firewalld restart(从启防火墙

4.firewall-cmd --zone=public --add-port=4400-4600/udp --permanen(指定端口范围为4400-4600通过防火墙)

Warning: ALREADY_ENABLED: 3306:tcp(说明3306端口通过成功)

5.firewall-cmd --zone=public --remove-port=80/tcp --permanent(关闭指定端口)

6.firewall-cmd --zone=public --list-ports(查看通过的端口)

7.查看防火墙状态 :firewall-cmd --state

8.修改mysql密码:SET PASSWORD = PASSWORD('123456');

9.flush privileges;

10.grant all privileges on *.* to 'root'@'%' identified by'test1234';(将所root用户的所有ip 以密码为test1234登录)

11.flush privileges

从方案中可以看出,centos 7 并不是我以为的 service iptables status这个命令

记得关注我哈!

————————————————
原文链接:https://blog.csdn.net/qq_40084534/article/details/82928401

原文地址:https://www.cnblogs.com/zxy-come-on/p/11469639.html