vps交流

获取中国IPV4 IPV6地址CIDR的办法


来源网上
各位大佬看看还有什么改进空间吗??

  1. curl ‘http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest’ | grep ipv4 | grep CN | awk -F| ‘{ printf("%s/%dn", $4, 32-log($5)/log(2)) }’ > IPV4.txt
  2. curl ‘http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest’ | grep ipv6 | grep CN | awk -F| ‘{ printf("%s/%dn", $4, 32-log($5)/log(2)) }’ > IPV6.txt

复制代码

  1. wget -c http://ftp.apnic.net/stats/apnic/delegated-apnic-latest
  2. cat delegated-apnic-latest | awk -F ‘|’ ‘/CN/&&/ipv4/ {print $4 "/" 32-log($5)/log(2)}’ | cat > ipv4.txt
  3. cat delegated-apnic-latest | awk -F ‘|’ ‘/CN/&&/ipv6/ {print $4 "/" 32-log($5)/log(2)}’ | cat > ipv6.txt

复制代码

1. IP 地址可以广播,APNIC 的更别说;
2. 建议 https://github.com/v2fly/geoip
最优方案

QQ截图20220317224954.png (50.23 KB, 下载次数: 0)

下载附件

半小时前 上传 获取中国IPV4 IPV6地址CIDR的办法 获取中国IPV4 IPV6地址CIDR的办法

获取中国IPV4 IPV6地址CIDR的办法

这是怎么做到的?