# 出口和入口IP
# 出口IP列表
云应用是一个分布式的集群,出口有多个,且和入口不一致,出口IP列表如下:
123.125.23.211
123.125.23.212
123.125.23.213
123.125.23.214
123.126.57.32
123.126.57.35
61.172.201.27
61.172.201.28
183.60.187.57
183.60.187.58
14.116.224.3
14.116.224.4
14.116.224.5
14.116.224.6
14.116.224.7
14.116.224.8
14.116.224.9
14.116.224.10
什么时候使用出口IP
从云应用的程序中访问外部接口,对端看到的就是以上IP,需要全部填入。
# 入口IP列表
云应用的入口是一个分布式的负载均衡集群,因此有多个数据中心的入口,入口IP段列表如下:
123.125.23.0/24
123.126.57.0/24
61.172.201.0/24
183.60.187.0/24
14.116.224.0/24
WARNING
为了调度流量等,云应用的入口IP经常会发生变化,如果有绑定独立域名的需求请不要使用A记录,需要使用CNAME记录。
# 动态获取出口IP
# 使用dig命令
由于IP经常会发生变化,可以使用查询域名解析的方式获取最新的IP列表,查询域名 iplist.sinacloud.com
的A记录即可,例如:
dig iplist.sinacloud.com A
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 <<>> iplist.sinacloud.com A
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26681
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 22, AUTHORITY: 2, ADDITIONAL: 5
;; QUESTION SECTION:
;iplist.sinacloud.com. IN A
;; ANSWER SECTION:
iplist.sinacloud.com. 600 IN A 220.181.129.126
iplist.sinacloud.com. 600 IN A 220.181.129.119
iplist.sinacloud.com. 600 IN A 221.179.190.238
iplist.sinacloud.com. 600 IN A 221.179.190.240
iplist.sinacloud.com. 600 IN A 183.60.187.58
iplist.sinacloud.com. 600 IN A 123.125.23.212
iplist.sinacloud.com. 600 IN A 220.181.129.89
iplist.sinacloud.com. 600 IN A 123.125.23.211
iplist.sinacloud.com. 600 IN A 61.172.201.27
iplist.sinacloud.com. 600 IN A 220.181.84.185
iplist.sinacloud.com. 600 IN A 220.181.136.120
iplist.sinacloud.com. 600 IN A 220.181.136.56
iplist.sinacloud.com. 600 IN A 220.181.129.121
iplist.sinacloud.com. 600 IN A 220.181.129.99
iplist.sinacloud.com. 600 IN A 123.125.23.213
iplist.sinacloud.com. 600 IN A 220.181.136.57
iplist.sinacloud.com. 600 IN A 123.125.23.214
iplist.sinacloud.com. 600 IN A 220.181.136.141
iplist.sinacloud.com. 600 IN A 220.181.129.92
iplist.sinacloud.com. 600 IN A 220.181.129.102
iplist.sinacloud.com. 600 IN A 61.172.201.28
iplist.sinacloud.com. 600 IN A 183.60.187.57
# 使用dig +short
使用dig +short
可以获得IP列表,例如:
dig iplist.sinacloud.com A +short
220.181.129.126
183.60.187.57
61.172.201.28
220.181.129.102
220.181.129.92
220.181.136.141
123.125.23.214
220.181.136.57
123.125.23.213
220.181.129.99
220.181.129.121
220.181.136.56
220.181.136.120
220.181.84.185
61.172.201.27
123.125.23.211
220.181.129.89
123.125.23.212
183.60.187.58
221.179.190.240
221.179.190.238
220.181.129.119
# PHP获取示例
你也可以使用PHP程序获取域名iplist.sinacloud.com
的解析,如下:
<?php
$ret = dns_get_record('iplist.sinacloud.com', DNS_A);
var_dump($ret);
输入结果如下:
array(22) {
[0]=>
array(5) {
["host"]=>
string(20) "iplist.sinacloud.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(600)
["type"]=>
string(1) "A"
["ip"]=>
string(13) "61.172.201.28"
}
[1]=>
array(5) {
["host"]=>
string(20) "iplist.sinacloud.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(600)
["type"]=>
string(1) "A"
["ip"]=>
string(14) "220.181.84.185"
}
[2]=>
array(5) {
["host"]=>
string(20) "iplist.sinacloud.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(600)
["type"]=>
string(1) "A"
["ip"]=>
string(15) "221.179.190.238"
}
[3]=>
array(5) {
["host"]=>
string(20) "iplist.sinacloud.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(600)
["type"]=>
string(1) "A"
["ip"]=>
string(15) "220.181.129.102"
}
[4]=>
array(5) {
["host"]=>
string(20) "iplist.sinacloud.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(600)
["type"]=>
string(1) "A"
["ip"]=>
string(15) "220.181.129.126"
}
[5]=>
array(5) {
["host"]=>
string(20) "iplist.sinacloud.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(600)
["type"]=>
string(1) "A"
["ip"]=>
string(14) "220.181.129.89"
}
[6]=>
array(5) {
["host"]=>
string(20) "iplist.sinacloud.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(600)
["type"]=>
string(1) "A"
["ip"]=>
string(15) "221.179.190.240"
}
[7]=>
array(5) {
["host"]=>
string(20) "iplist.sinacloud.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(600)
["type"]=>
string(1) "A"
["ip"]=>
string(15) "220.181.129.121"
}
[8]=>
array(5) {
["host"]=>
string(20) "iplist.sinacloud.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(600)
["type"]=>
string(1) "A"
["ip"]=>
string(14) "220.181.136.57"
}
[9]=>
array(5) {
["host"]=>
string(20) "iplist.sinacloud.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(600)
["type"]=>
string(1) "A"
["ip"]=>
string(14) "123.125.23.214"
}
[10]=>
array(5) {
["host"]=>
string(20) "iplist.sinacloud.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(600)
["type"]=>
string(1) "A"
["ip"]=>
string(13) "183.60.187.57"
}
[11]=>
array(5) {
["host"]=>
string(20) "iplist.sinacloud.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(600)
["type"]=>
string(1) "A"
["ip"]=>
string(14) "220.181.136.56"
}
[12]=>
array(5) {
["host"]=>
string(20) "iplist.sinacloud.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(600)
["type"]=>
string(1) "A"
["ip"]=>
string(15) "220.181.136.120"
}
[13]=>
array(5) {
["host"]=>
string(20) "iplist.sinacloud.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(600)
["type"]=>
string(1) "A"
["ip"]=>
string(14) "123.125.23.213"
}
[14]=>
array(5) {
["host"]=>
string(20) "iplist.sinacloud.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(600)
["type"]=>
string(1) "A"
["ip"]=>
string(14) "123.125.23.212"
}
[15]=>
array(5) {
["host"]=>
string(20) "iplist.sinacloud.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(600)
["type"]=>
string(1) "A"
["ip"]=>
string(14) "220.181.129.92"
}
[16]=>
array(5) {
["host"]=>
string(20) "iplist.sinacloud.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(600)
["type"]=>
string(1) "A"
["ip"]=>
string(13) "61.172.201.27"
}
[17]=>
array(5) {
["host"]=>
string(20) "iplist.sinacloud.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(600)
["type"]=>
string(1) "A"
["ip"]=>
string(15) "220.181.136.141"
}
[18]=>
array(5) {
["host"]=>
string(20) "iplist.sinacloud.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(600)
["type"]=>
string(1) "A"
["ip"]=>
string(13) "183.60.187.58"
}
[19]=>
array(5) {
["host"]=>
string(20) "iplist.sinacloud.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(600)
["type"]=>
string(1) "A"
["ip"]=>
string(15) "220.181.129.119"
}
[20]=>
array(5) {
["host"]=>
string(20) "iplist.sinacloud.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(600)
["type"]=>
string(1) "A"
["ip"]=>
string(14) "123.125.23.211"
}
[21]=>
array(5) {
["host"]=>
string(20) "iplist.sinacloud.com"
["class"]=>
string(2) "IN"
["ttl"]=>
int(600)
["type"]=>
string(1) "A"
["ip"]=>
string(14) "220.181.129.99"
}
}