运行service iptables status时报错;

运行service iptables status出现

Redirecting to /bin/systemctl status iptables.service
Unit iptables.service could not be found.如下图

 

 解决办法:

  yum install iptables-services

 

基本操作

  1. # 停止防火墙
  2.  service iptables stop  
  3. # 启动防火墙
  4. service iptables start 
  5. # 重启防火墙
  6. service iptables restart 
  7. # 永久关闭防火墙
  8. chkconfig iptables off  
  9. # 永久关闭后重启
  10. chkconfig iptables on 

开启80端口

 firewall-cmd --zone=public --add-port=80/tcp --permanent (--permanent永久生效,没有此参数重启后失效)

提示success,表示设置成功,这样就可以继续后面的设置了。

systemctl status firewalld查看firewalld状态,发现当前是dead状态,即防火墙未开启

ystemctl start firewalld开启防火墙,没有任何提示即开启成功。

通过systemctl status firewalld查看firewalld状态,显示running即已开启了。

 

重启防火墙

        service iptables restart

 

posted @ 2020-05-09 15:22  lyfor  阅读(12357)  评论(0编辑  收藏  举报