google-compute-engine,google"/>
3Answers
  • 11
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Google compute engine IP ranges

I'm trying to figure out what the IP ranges for google compute engine are.

I have a library that is locked for use on certain IP ranges. Crazy I know, it's a bit special.

I hunted around the google document ion but couldn't find a list. Is there a way of looking this up or querying for it somehow?

Google Cloud Platform compute engine IP ranges change over time, that's why I would recommend to use the commands in this document to have an updated information.

  • 1
Reply Report
      • 2
    • You should include slightly more information in your answer such that it will remain useful even if the link for whatever reason stops working.

As the other answer says, Google describes how to get the list here: https://cloud.google.com/compute/docs/faq#where_can_i_find_product_name_short_ip_ranges

I found a good script here for following spf records:

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

create the file lookup.perl as:

#!/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($_);
    }
   } 
  } 
}

then run: ./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
  • 0
Reply Report

GCP Compute Engine IP ranges are changing over time, however you will be able to check the current IP ranges by following this documentation.

Also, you will be able to check it through the Cloud Shell by running this commands:

google_ips=$(for LINE in `dig txt _cloud-netblocks.googleusercontent.com +short | tr " " "\n" | grep include | cut -f 2 -d :`; do dig txt $LINE +short; done | tr " " "\n" | grep ip4 | cut -f 2 -d : | sort -n | xargs | tr " " ",")

echo $google_ips

The commands above will create and an environment variable that contains the current Compute Engine IP ranges.

Moreover, there's an issuetracker in order to improve this process.

Hope this helps!

  • 0
Reply Report

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags