本博客爲service iptables save 報錯 please try to use systemctl 提供解決方案。
報錯
[root@tencent ~]# 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@tencent ~]# systemctl stop firewalld
[root@tencent ~]# systemctl mask firewalld
Created symlink from /etc/systemd/system/firewalld.service to /dev/null.
二、安裝iptables-services
[root@tencent ~]# yum install -y iptables-services
三、開啓iptables-services
[root@tencent ~]# service iptables start
Redirecting to /bin/systemctl start iptables.service
或者使用systemctl控制iptables
systemctl [start|status|stop|restart|enable] iptables
四、將iptables加到開機啓動項中
[root@tencent ~]# systemctl enable iptables
Created symlink from /etc/systemd/system/basic.target.wants/iptables.service to /usr/lib/systemd/system/iptables.service.
五、清空防火牆
[root@tencent ~]# iptables -F
六、保存防火牆規則