centos – Iptables列表在重新启动时不会持续存在

我试图通过发出以下命令在我的服务器上列出CloudFlare的IP地址:
iptables -N whitelist
iptables -A whitelist -s 204.93.177.0/24 -j ACCEPT
iptables -A whitelist -s 199.27.128.0/21 -j ACCEPT
iptables -A whitelist -s 173.245.48.0/20 -j ACCEPT
iptables -A whitelist -s 103.22.200.0/22 -j ACCEPT
iptables -A whitelist -s 141.101.64.0/18 -j ACCEPT
iptables -A whitelist -s 108.162.192.0/18 -j ACCEPT

当我输入:iptables -L我看到:

Chain whitelist (0 references)
target     prot opt source               destination
ACCEPT     all  --  network/24           anywhere
ACCEPT     all  --  199.27.128.0/21      anywhere
ACCEPT     all  --  173.245.48.0/20      anywhere
ACCEPT     all  --  103.22.200.0/22      anywhere
ACCEPT     all  --  141.101.64.0/18      anywhere
ACCEPT     all  --  108.162.192.0/18     anywhere

然后我通过服务iptables restart重新启动iptables.然而,没有任何改变,它没有列出那些IP :(我错过了什么?

您需要在重新启动之前保存配置.在Redhat系统上,它位于/ etc / sysconfig / iptables中.最简单的方法是:

>发出命令>运行iptables -L来检查配置>运行服务iptables保存>运行service iptables restart重新加载>使用iptables -L再次检查配置

相关文章

Centos下搭建性能监控Spotlight
CentOS 6.3下Strongswan搭建IPSec VPN
在CentOS6.5上安装Skype与QQ
阿里云基于centos6.5主机VPN配置
CentOS 6.3下配置multipah
CentOS安装、配置APR和tomcat-native