for i in `wget -qO- "http://rms.twnic.net.tw/twnic/User/Member/Search/main7.jsp?Order=ORG.ID" | awk -F'[-<]' '/^[1-9].*255/ {print $1":"$2}' | tr -d ' ' | sort -nu`
do
N=$N`netmask $i`
done
netmask $N
用這個 script 可以取得台灣 IP 的網段,
需先安裝 netmask (可以計算網段資料及把網段做 summary)
用這些網段資料, 可以做 IP 來源過濾, 例如只讓台灣的 IP 連.
2008-11-19 Update: 此資料是來自 TWNIC, 所以並不包含直接向 APNIC 申請的 IP 網段
結果 (2008-11-18資料, 188段)
58.86.0.0/16
58.99.64.0/18
59.104.0.0/15
59.112.0.0/12
60.198.0.0/15
60.244.128.0/17
60.245.64.0/19
60.248.0.0/14
61.20.0.0/16
61.30.0.0/15
61.56.64.0/20
61.57.240.0/20
61.58.48.0/20
61.59.0.0/16
61.60.240.0/20
61.61.240.0/20
61.62.0.0/16
61.63.32.0/19
61.63.64.0/19
61.64.32.0/20
61.65.192.0/18
61.66.0.0/16
61.67.112.0/20
61.216.0.0/13
61.224.0.0/13
61.247.160.0/20
113.21.160.0/19
113.61.128.0/17
114.24.0.0/14
114.30.32.0/20
114.32.0.0/12
114.136.0.0/15
114.140.0.0/16
114.198.160.0/20
115.30.64.0/18
115.42.112.0/21
115.43.0.0/16
115.80.0.0/14
115.85.144.0/20
115.165.192.0/18
116.50.32.0/20
116.59.0.0/16
116.89.128.0/20
116.118.128.0/18
116.212.80.0/20
117.19.0.0/16
117.56.0.0/16
117.103.96.0/20
118.160.0.0/13
118.168.0.0/14
118.231.0.0/16
118.232.0.0/15
119.14.0.0/16
119.15.192.0/18
119.30.16.0/20
119.31.176.0/20
119.75.240.0/20
119.77.128.0/17
120.96.0.0/11
121.50.176.0/20
122.99.0.0/18
122.100.64.0/18
122.116.0.0/15
122.118.0.0/16
122.120.0.0/13
122.128.80.0/21
122.146.0.0/15
122.200.152.0/21
122.201.128.0/17
122.252.160.0/20
122.254.0.0/18
122.255.80.0/20
123.0.32.0/19
123.50.32.0/19
123.99.32.0/19
123.110.0.0/16
123.192.0.0/14
123.204.0.0/15
123.240.0.0/15
123.252.0.0/17
124.6.0.0/19
124.8.0.0/14
124.12.0.0/16
124.29.128.0/19
124.108.128.0/18
124.109.112.0/20
124.155.160.0/19
124.199.64.0/19
124.218.0.0/16
124.219.0.0/17
125.224.0.0/13
125.232.0.0/15
139.175.0.0/16
140.109.0.0/16
140.110.0.0/15
140.112.0.0/12
140.128.0.0/13
140.136.0.0/15
140.138.0.0/16
163.13.0.0/16
163.14.0.0/15
163.16.0.0/12
163.32.0.0/16
168.95.0.0/16
192.72.3.0/24
192.83.194.0/24
192.192.0.0/16
202.3.129.0/24
202.5.4.0/23
202.6.104.0/23
202.8.14.0/23
202.39.128.0/17
202.144.208.0/20
202.148.208.0/20
202.151.48.0/20
202.160.64.0/19
202.168.192.0/20
202.169.160.0/20
202.174.16.0/20
202.178.128.0/17
203.64.0.0/16
203.65.160.0/19
203.66.0.0/15
203.68.0.0/14
203.72.0.0/14
203.78.176.0/20
203.79.128.0/17
203.84.144.0/21
203.111.208.0/20
203.118.224.0/20
203.119.3.0/24
203.121.240.0/20
203.145.192.0/20
203.160.144.0/20
203.190.16.0/21
203.201.32.0/20
203.207.32.0/20
210.58.0.0/16
210.59.128.0/17
210.60.0.0/15
210.62.192.0/19
210.63.224.0/19
210.64.0.0/15
210.66.0.0/16
210.67.96.0/20
210.68.0.0/15
210.70.0.0/16
210.71.128.0/17
210.85.0.0/16
210.200.0.0/15
210.202.32.0/20
210.203.0.0/17
210.240.0.0/16
210.241.160.0/19
210.242.0.0/17
210.243.128.0/17
210.244.192.0/19
211.20.0.0/14
211.72.128.0/17
211.73.32.0/19
211.74.0.0/17
211.75.128.0/17
211.76.192.0/19
211.77.0.0/18
211.78.80.0/20
211.79.192.0/20
218.32.0.0/16
218.34.0.0/15
218.160.0.0/12
218.184.0.0/16
218.187.0.0/16
218.210.0.0/15
219.80.0.0/15
219.84.0.0/14
219.91.0.0/17
220.128.0.0/18
220.129.0.0/16
220.130.0.0/15
220.132.0.0/14
220.136.0.0/13
220.157.112.0/20
220.228.0.0/15
221.120.0.0/18
221.120.64.0/19
221.169.0.0/16
222.156.0.0/15
222.250.0.0/16
222.251.0.0/17
所以建議使用apnic的資料
http://ftp.apnic.net/stats/apnic/delegated-apnic-latest
grep "TW|ipv4|" 即可y
這並不包含有些直接從 APNIC 取得 IP 的 ISP...
例如:
inetnum: 203.133.0.0 - 203.133.31.255
netname: HOSHIN-MULTIMEDIA
descr: Hoshin Multimedia Center Inc
descr: Cable/ADSL Broadband ISP in Taiwan.
country: TW