我试图通过发出以下命令将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
而当我input: 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
然后我通过service iptables restart 。 然而,没有任何改变,并没有白名单这些知识产权:(我是否错过了什么?
重新启动之前,您需要保存configuration。 在Redhat系统上,这个在/ etc / sysconfig / iptables中。 最简单的方法是:
iptables -L来检查configuration service iptables save service iptables restart加载 iptables -L检查configuration