作用未知,纯粹好玩

Google

首先是google的,我是从这个网站拿到的IP子网的范围。
格式例如这样的,写了子网的第一个地址和最后一个地址,但是没写掩码:

1
2
3
64.18.0.0 64.18.15.255
207.126.144.0 207.126.159.255
104.132.0.0 104.132.27.255

先拿excel简单处理下原数据,排序之后,然后拿python简单处理下得到网络号和掩码,人肉过滤下重复的子网。

python的netaddr和ipaddr可以直接处理IP,我这里用是python3内置的ipaddresss。summarize_address_range(ip1,ip2)会输出包含ip1起始到ip2这个范围内的所有子网。

1
2
3
4
5
6
7
8
9
10
from ipaddress import *

if __name__ == '__main__':
with open('ipi', 'r') as f:
for line in f.readlines():
ip_list = line.split('\n')[0].split(' ')
ip1 = IPv4Address(ip_list[0])
ip2 = IPv4Address(ip_list[1])
for x in summarize_address_range(ip1,ip2):
print(x)

最终结果不一定就完全准确,但是覆盖80%的业务应该可以吧。。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
8.6.48.0/21
8.8.4.0/24
8.8.8.0/24
8.15.202.0/24
8.34.208.0/20
8.35.192.0/20
12.216.80.0/24
23.228.128.0/18
23.236.48.0/20
23.251.128.0/19
23.255.128.0/17
34.64.0.0/10
35.184.0.0/13
35.192.0.0/11
35.224.0.0/12
35.240.0.0/13
35.206.0.0/15
35.208.0.0/12
38.97.108.0/24
45.121.228.0/22
45.56.0.0/18
63.243.168.0/22
64.15.112.0/20
64.18.0.0/20
64.233.160.0/19
64.79.152.0/23
64.9.224.0/19
66.102.0.0/20
66.249.64.0/19
70.32.128.0/19
72.14.192.0/18
74.114.24.0/21
74.125.0.0/16
89.207.224.0/21
99.198.128.0/17
103.62.64.0/22
103.86.148.0/24
104.132.0.0/14
104.154.0.0/15
104.196.0.0/14
104.237.161.0/24
104.237.162.0/23
104.237.164.0/23
104.237.172.0/24
104.237.174.0/23
104.237.188.0/22
107.167.160.0/19
107.178.192.0/18
107.188.128.0/17
108.170.192.0/18
108.177.0.0/17
108.59.80.0/20
113.197.104.0/22
130.211.0.0/16
136.112.0.0/12
136.22.0.0/23
136.22.129.0/24
136.22.159.0/24
136.22.64.0/18
136.32.0.0/11
142.250.0.0/15
146.148.0.0/17
159.192.27.0/24
162.216.148.0/22
162.222.176.0/21
165.193.245.0/24
172.102.8.0/21
172.110.32.0/21
172.217.0.0/16
172.253.0.0/16
173.194.0.0/16
173.255.112.0/20
185.150.148.0/22
185.25.28.0/22
192.104.160.0/23
192.119.16.0/20
192.158.28.0/22
192.178.0.0/15
192.200.224.0/19
199.192.112.0/22
199.223.232.0/21
199.36.152.0/21
199.91.151.0/24
203.190.122.0/24
207.126.144.0/20
207.223.160.0/20
207.251.96.0/24
208.117.224.0/19
208.211.225.0/24
208.65.152.0/22
208.68.108.0/22
208.81.188.0/22
209.107.176.0/20
209.210.68.0/23
209.62.176.0/20
209.63.122.0/23
209.63.62.0/23
209.85.128.0/17
216.21.160.0/20
216.239.32.0/19
216.252.220.0/22
216.58.192.0/19
216.73.80.0/20

亚马逊AWS

作为最大的云计算公司,亚马逊还是很给力的,他的IP范围在上面的网址中也有,另外它官方也公布了每个region的ip段:

https://ip-ranges.amazonaws.com/ip-ranges.json

微软Azura

同样微软也公开了自己的数据中心的IP范围,官网可以下载:
https://www.microsoft.com/en-us/download/details.aspx?id=41653

另外Azura中国区是世纪互联运营,不含在全球版里的ip:

https://www.microsoft.com/en-us/download/details.aspx?id=42064

line

基于业务需求,公司需要访问line,所以找了下这个公司的IP范围,然后发现了两个很有意思的网址

https://host.io/linecorp.com

host.io可以查询域名所在的公司,已经对应的AS

https://ipinfo.io/AS38631

ipinfo.io可以查询AS对应的公司和包含的IPv4/IPv6范围