maps.googleapis.com的IP是否一直在变化或固定

时间:2016-03-16 05:50:50

标签: api dynamic ip public

我们有一个内部服务器,我们希望在其上使用GEOCODING并访问来自网站maps.googleapis.com的网址。现在我们需要防火墙规则来允许内部服务器访问maps.googleapis.com并且从不同的DNS服务器获得3个不同的IP,这是可以的。

现在,如果我们完成了这些防火墙规则,那么可以谷歌将经常解析为maps.googleapis.com的IP更改为li。 请指教。

2 个答案:

答案 0 :(得分:0)

对于任何给定的Google网站,没有特定的固定IP地址,我担心,并且您已经注意到它们可以随时更改。您最好的选择是查找Google拥有的所有IP空间,并将其添加到您的出站防火墙规则中。

这是一篇可能有用的支持文章:

https://support.google.com/a/answer/60764?hl=en

答案 1 :(得分:0)

spf答案没有为您提供maps.googleapis的IP列表。这个链接显然是https://developers.google.com/maps/premium/prelaunch-checklist#firewall。使用域名配置防火墙不是一个好主意,因为它只能在一段有限的时间内运行...我写了一个快速的bash到nslookup并只添加到已知IP列表。然后我使用zabbix在发现新IP时提醒我并将其添加到iptables。您也可以自动执行此操作,但这不是我选择做的事情。

#!/bin/bash
# Check how many new IPs in this name?
#
# Usage: $0 <name> <ipfile>
#        <name>  : name to resolve
#        <ipfile>: file with IP addresses known for that name
#
# Example; $0 hello.google.com /usr/share/zabbix-agent/files/hello.google.com-iplist.txt

if [ $# -ne 2 ];  then echo "Error code 1 : wrong number of arguments" && exit 1; fi
if [ ! -f $2 ];   then echo "Error code 2 : file $2 does not exist" && exit 1; fi

name=$1
iplist=$2
dig="/usr/bin/dig"
lookup="/usr/bin/nslookup"

response=(`${lookup} ${name} | grep -i address | awk '{print $2}' | sed -e "1d"`)

if [ ${#response[@]} -lt 1 ]; then echo "Error code 3 : No Addresses returned by $lookup"  && exit 2; fi

for ip in "${response[@]}"
do
  if [ -z `grep ${ip} ${iplist}` ]; then
    echo "Error code 4 : Address ${ip} not found in $iplist" && exit 3
  fi
done

# All good.
echo "Return code 0 : All addresses for $name listed in $iplist"
exit 0

希望有所帮助..