Skip to content

Instantly share code, notes, and snippets.

@lsylsy2
lsylsy2 / cidr_merge
Last active Apr 30, 2016
2015-6-2生成,APNIC中国IP中北京大学免费地址可以访问部分,通过cidrmerge压缩
View cidr_merge
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 Aug 23, 2018
从APNIC下载中国IP,并挑出免费地址
View apnic_pku.sh
#!/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`