Linux學習筆記之解決 service iptables save 報錯 please try to use systemctl

本博客爲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

六、保存防火牆規則

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章