解決service iptables save出錯please try to use systemctl

feiquan發表於2018-08-02

  

# 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

 

相關文章