如何configurationIpset来阻止整个国家的IP
我需要阻止一些使用ipset和iptables的国家。 我到目前为止所做的(创build新的ipset set'geoblock'): sudo ipset create geoblock hash:net,port 然后我创build了以下脚本/usr/sbin/ipsetfirewall.sh #!/bin/bash for IP in $(wget -O – http://www.ipdeny.com/ipblocks/data/countries/{cn,iq,af,ir,ae,sg,hk,kw,kg}.zone) do # ban everything – block countryX sudo ipset add geoblock $IP done 正如我在这里解释的,我也试过 wget -O – http://www.ipdeny.com/ipblocks/data/countries/{cn,iq,af,ir,ae,sg,hk,kw,kg}.zone –header "Referer: www.ipdeny.com" 我也试过(因为我使用的是ipv4) wget -4 http://www.ipdeny.com/ipblocks/data/countries/{cn,iq,af,ir,ae,sg,hk,kw,kg}.zone 对于我所有的尝试,我得到这个相同的错误: /usr/sbin$ sudo sh ipsetfirewall.sh –2016-04-21 15:40:58– http://www.ipdeny.com/ipblocks/data/countries/%7Bcn,iq,af,ir,ae,sg,hk,kw,kg%7D.zone Resolving www.ipdeny.com (www.ipdeny.com)… 192.241.240.22 Connecting […]