centos7 iptables无法保存转发规则,重启就没了

问题一:明明安装了IPtable,查询的时候确提示没安装
问题二:百度了下有的说还要安装iptable-service,如果不安如何让IPtable重启后保存的规则还在?
不是内行的问的问题也外行请见谅!

[root@VM_88_10_centos ~]# systemctl status iptables Unit
Unit iptables.service could not be found.

[root@VM_88_10_centos ~]# yum install iptables
Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile
Package iptables-1.4.21-24.1.el7_5.x86_64 already installed and latest version Nothing to do

但是 iptables -t nat -L 命令又可以用

[root@VM_88_10_centos ~]# iptables -t nat -L
Chain PREROUTING (policy
ACCEPT) target prot opt source destination

Chain INPUT (policy ACCEPT) target prot opt source
destination

Chain OUTPUT (policy ACCEPT) target prot opt source
destination

Chain POSTROUTING (policy ACCEPT) target prot opt source
destination

然后保存转发规则

[root@VM_88_10_centos ~]# iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE

保存完查询保存正常

[root@VM_88_10_centos ~]# iptables -t nat -L
Chain PREROUTING (policy ACCEPT) target
protopt source destination

Chain INPUT (policy ACCEPT) target prot opt source
destination

Chain OUTPUT (policy ACCEPT) target prot opt source
destination

Chain POSTROUTING (policy ACCEPT) target prot opt source
destination MASQUERADE all -- 192.168.0.0/24
anywhere

重启下在查询就没了

[root@VM_88_10_centos ~]# reboot [root@VM_88_10_centos ~]# iptables -t
nat -L

Chain PREROUTING (policy ACCEPT) target prot opt source
destination

Chain INPUT (policy ACCEPT) target prot opt source
destination

Chain OUTPUT (policy ACCEPT) target prot opt source
destination

阅读 6.7k
1 个回答
推荐问题