ITPub博客

首页 > IT基础架构 > > 解决 service iptables save 报错

解决 service iptables save 报错

作者:ebrain68 时间:2019-08-19 16:18:52 0 删除 编辑

报错

[root@Jaking ~]# 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.

解决方法

停止 firewalld

[root@Jaking ~]# systemctl stop firewalld
[root@Jaking ~]# systemctl mask firewalld
Created symlink from /etc/systemd/system/firewalld.service to /dev/null.

安装 iptables-services

[root@Jaking ~]# yum install -y iptables-services

开启 iptables

[root@Jaking ~]# service iptables start
Redirecting to /bin/systemctl start iptables.service

还可以使用 systemctl 来控制 iptables

systemctl [start|status|stop|restart|enable] iptables

把 iptables 加到开机启动项中

[root@Jaking ~]# systemctl enable iptables
Created symlink from /etc/systemd/system/basic.target.wants/iptables.service to /usr/lib/systemd/system/iptables.service.

清空防火墙

[root@Jaking ~]# iptables -F

保存防火墙规则

[root@Jaking ~]# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables: [  OK  ]
# 或者
[root@Jaking ~]# /usr/libexec/iptables/iptables.init save
iptables: Saving firewall rules to /etc/sysconfig/iptables: [  OK  ]


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/2920/viewspace-3146533/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-08-13

  • 博文量
    68
  • 访问量
    449