Google-Compute-Engine

Google 計算引擎 IP 範圍

  • January 14, 2020

我試圖弄清楚Google計算引擎的 IP 範圍是多少。

我有一個庫被鎖定以在某些 IP 範圍內使用。瘋了,我知道,這有點特別。

我在Google文件中搜尋,但找不到列表。有沒有辦法以某種方式查找或查詢它?

正如另一個答案所說,Google描述瞭如何在此處獲取列表: https ://cloud.google.com/compute/docs/faq#where_can_i_find_product_name_short_ip_ranges

我在這裡找到了一個用於以下 spf 記錄的好腳本:

https://aplawrence.com/Kerio/recursive_spf.html

創建文件 lookup.perl 為:

#!/usr/bin/perl
$domain=shift @ARGV;
@results=getit($domain);


sub getit {
 my $domain=shift;

 my @foo=`nslookup -q=TXT $domain`;
 my @results=();
 foreach (@foo) {
  next if not /$domain\ttext/;
  s/$domain\ttext = "v=spf1//;
  @results=split /\s+/;
  foreach (@results) {
   next if /-all/;
   print "$_\n";
   if (/include:/) {
    s/include://;
    getit($_);
   }
  } 
 } 
}

然後執行: ./lookup.perl _cloud-netblocks.googleusercontent.com | grep ip4

ip4:35.190.224.0/20
ip4:35.232.0.0/15
ip4:35.234.0.0/16
ip4:35.235.0.0/17
ip4:35.235.192.0/20
ip4:35.236.0.0/14
ip4:35.240.0.0/15
ip4:35.203.232.0/21
ip4:130.211.4.0/22
ip4:35.220.0.0/14
ip4:35.242.0.0/15
ip4:35.244.0.0/14
ip4:34.64.0.0/11
ip4:34.96.0.0/14
ip4:34.100.0.0/18
ip4:34.100.64.0/19
ip4:108.170.216.0/22
ip4:108.170.220.0/23
ip4:108.170.222.0/24
ip4:35.224.0.0/13
ip4:35.202.0.0/16
ip4:35.190.240.0/22
ip4:35.190.242.0/23
ip4:35.206.0.0/15
ip4:8.34.208.0/20
ip4:8.35.192.0/21
ip4:8.35.200.0/23
ip4:108.59.80.0/20
ip4:108.170.192.0/20
ip4:108.170.208.0/21
ip4:162.216.148.0/22
ip4:162.222.176.0/21
ip4:173.255.112.0/20
ip4:192.158.28.0/22
ip4:199.192.112.0/22
ip4:199.223.232.0/22
ip4:199.223.236.0/23
ip4:23.236.48.0/20
ip4:23.251.128.0/19
ip4:35.204.0.0/14
ip4:35.208.0.0/13
ip4:107.167.160.0/19
ip4:107.178.192.0/18
ip4:146.148.2.0/23
ip4:146.148.4.0/22
ip4:146.148.8.0/21
ip4:146.148.16.0/20
ip4:146.148.32.0/19
ip4:146.148.64.0/18
ip4:35.203.0.0/17
ip4:35.203.128.0/18
ip4:35.203.192.0/19
ip4:35.203.240.0/20
ip4:130.211.8.0/21
ip4:130.211.16.0/20
ip4:130.211.32.0/19
ip4:130.211.64.0/18
ip4:130.211.128.0/17
ip4:104.154.0.0/15
ip4:104.196.0.0/14
ip4:208.68.108.0/23
ip4:35.184.0.0/14
ip4:35.188.0.0/15
ip4:35.216.0.0/15
ip4:35.190.0.0/17
ip4:35.190.128.0/18
ip4:35.190.192.0/19
ip4:35.235.224.0/20
ip4:35.192.0.0/14
ip4:35.196.0.0/15
ip4:35.198.0.0/16
ip4:35.199.0.0/17
ip4:35.199.128.0/18
ip4:35.200.0.0/15
ip4:35.235.216.0/21

引用自:https://serverfault.com/questions/854509