Skip to content

Instantly share code, notes, and snippets.

@lsylsy2
lsylsy2 / cidr_merge
Last active April 30, 2016 17:01
2015-6-2生成,APNIC中国IP中北京大学免费地址可以访问部分,通过cidrmerge压缩
1.0.1.0/24
1.0.2.0/23
1.0.8.0/21
1.0.32.0/19
1.1.0.0/24
1.1.2.0/23
1.1.4.0/22
1.1.8.0/21
1.1.16.0/20
1.1.32.0/19
@lsylsy2
lsylsy2 / apnic_pku.sh
Last active August 23, 2018 00:17
从APNIC下载中国IP,并挑出免费地址
#!/bin/bash
echo "Downloading IP list from APNIC...."
apniclist=`wget -q -O- http://ftp.apnic.net/stats/apnic/delegated-apnic-latest |grep "apnic|CN|ipv4|"`
echo "Checking blocks..."
rm cidr.txt
for ipblock in ${apniclist[@]}
do
ip=`echo $ipblock | cut -d "|" -f4`