What Is Google’s IP?

One of our readers asked us a question yesterday about how did we find out Google public IP address ranges in this blog post. Well, the answer is simple.

We ran the nslookup command against Google DNS to get associated records for their domain’s netblocks.

If you ever wanted to white-list or use any of Google proxies, you may want to get their IP addresses to add to your setup. When we setup our Nginx web server to use Google PageSpeed proxy, we had to setup an X-Forwarder-For.

Since our site is behind Google’s proxies, services that use IP addresses to track users and other feature may only see Google’s IP addresses and not the original users addresses.

Using X-Forwarder-For allows these services to get the original IP addresses of the users instead of Google proxies or any other proxies for that matter.

Here’s how to got Google IP address ranges for our setup in Nginx. If you you want to create an X-Forwarder-For when using Google proxies, or white-list Google IP addresses, use this method to get Google IP addresses.

To get it, open the terminal console in Ubuntu or command prompts when using Microsoft Windows. Then run the commands below one line at a time.

nslookup -q=TXT _netblocks.google.com 8.8.8.8
nslookup -q=TXT _netblocks2.google.com 8.8.8.8
nslookup -q=TXT _netblocks3.google.com 8.8.8.8

 

Each of the line above will display a CIDR block or Google’s IP addresses.

This is how we got Google IP addresses to use for our X-Forwarder-For setup in Nginx. Use it to get the IP addresses for your systems as well.

If you’re using Cloudflare instead, here’s a link to their IP address ranges you can use in your setup.

https://www.cloudflare.com/ips

The list is updated regularly when new networks are added so change it frequently.

 

Enjoy!