我有一个Redhat服务器(Red Hat Enterprise
Linux Server 7.2(Maipo)),它在re / boot上重置了iptable规则.
根据version 6 documentation,我执行:
/sbin/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.
如果我正确理解了消息,我尝试了以下方法:
sudo systemctl iptables save
返回:
Unknown operation 'iptables'.
我没有具体在保存IP表上找到version 7 documentation,但以前的版本支持相同的命令.
What command should I run to save iptables config?
以供参考:
防火墙d satatus:
systemctl status firewalld firewalld.service Loaded: not-found (Reason: No such file or directory) Active: inactive (dead)
解决方法
你应该安装iptables-services包.
然后服务iptables保存将工作.这些命令也可以工作:
# iptables-save > /etc/sysconfig/iptables # ip6tables-save > /etc/sysconfig/ip6tables
AFAIK,systemctl没有任何保存iptables-services配置的选项.
注意:systemctl语法如下:systemctl< operation> <单元>