了解如何使用APNIC资源或如何获得每个国家的所有子网
我正在尝试获取分配给某个国家/地区的IPv4范围的最新列表。 我使用http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest获取列表,然后按国家/地区扩展名筛选。 我们来拿中国吧。 curl 'http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest' | grep ipv4 | grep CN | awk -F\| '{ printf("%s/%d\n", $4, 32-log($5)/log(2)) }' > chnroute.txt curl 'http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest' | grep ipv4 | grep CN | awk -F\| '{ printf("%s/%d\n", $4, 32-log($5)/log(2)) }' > chnroute.txt给我们提供了IPv4的列表,如果我没有弄错的话。 到现在为止还挺好。 但是这个列表中似乎没有一些IP范围。 为了这个例子,我们把重点放在106.0.0.0/8范围。 我们可以知道整个范围是从这个页面分配给亚太地区https://www.apnic.net/publications/research-and-insights/apnic-resource-range 摘录: APNIC allocates resources in the following ranges within the Asia Pacific […]