解决service iptables save出错please try to use systemctl

  

# service iptables save
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.

 

出错信息如上所示

解决方案:

首先停止防火墙

systemctl stop firewalld
systemctl mask firewalld

 

然后安装iptables-services

yum install iptables-services

 

设置开机启动防火墙

systemctl enable iptables

 

可以使用下面命令管理iptables

systemctl [stop|start|restart] iptables

 

这时可以保存防火墙规则了

service iptables save
or
/usr/libexec/iptables/iptables.init save

 

 如果你之后要使用firewall的话:

  执行命令,即可实现取消服务的锁定

  # systemctl unmask firewalld

  下次需要锁定该服务时执行

  # systemctl mask firewalld

 

posted @ 2018-08-02 00:32  feiquan  阅读(1833)  评论(0编辑  收藏  举报
如果是此文是转载文章,本人会附上转载链接,此篇文章的版权归原创作者所属,如果侵权请与我联系,我会删除此文。

若没有标明转载链接,此篇文章属于本人的原创文章,其版权所属:
作者:feiquan
出处:http://www.cnblogs.com/feiquan/
版权声明:本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
大家写文都不容易,请尊重劳动成果~ 这里谢谢大家啦(*/ω\*)