在centos7上,经常修改了iptables规则后,重启后规则就没了。有些地方使用使用 iptables-save,然而并无卵用;
正确的保存操作是 service iptables save
$ 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.
说明没有安装 iptables-services
yum install -y iptables-services
再次保存,成功后会给出提示信息:
$ service iptables save iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]