因为想用写的代码来连接一下虚拟机的某一个端口,所以执行service iptables status/start/stop 的命令都是失效的


service iptables status/start/stop 命令失效


根据报错发现命令变成了 /bin/systemct1 status/start/stop iptables.service 


service iptables status/start/stop 命令失效


但是执行之后仍然显示找不到iptables.service服务


查找资料后发现在centos7中管理防火墙的是firewall


所以命令应该为 /bin/systemctl status/start/stop firewalld 


以查看防火墙的状态为例子


service iptables status/start/stop 命令失效


执行之后成功显示


出现这样的问题应该是centos7中的命令和centos6里面的有很多是不同的,所以导致原来在6里面的命令不能执行

相关文章: