When you are configuring email handling for your domain, say seeking to prevent Google messages from being marked as spam, you may need to know the IP addresses of the Google Apps mail servers.
Google maintains a global infrastructure, which grows dynamically to accommodate increasing demand. As a result, Google Apps mail servers use a large range of IP addresses, and the addresses often change. The most effective means of finding the current range of Google IP addresses is to query Google's SPF record.
To create an SPF record for your domain, you can simply have the record refer to the Google SPF record for the current list of IP addresses:
v=spf1 include:_spf.google.com ~all
With this method, your domain automatically inherits changes to the Google IP addresses as they happen.
When you need the literal IP addresses for Google Apps mail servers, start by using one of the common DNS lookup commands (
host) to retrieve the SPF records for the domain _spf.google.com, like so:
nslookup -q=TXT _spf.google.com 126.96.36.199
This returns a list of the domains included in Google's SPF record, such as:
_netblocks.google.com, _netblocks2.google.com, _netblocks3.google.com
Now look up the DNS records associated with those domains, one at a time, like so:
nslookup -q=TXT _netblocks.google.com 188.8.131.52
nslookup -q=TXT _netblocks2.google.com 184.108.40.206
nslookup -q=TXT _netblocks3.google.com 220.127.116.11
The results of these commands contain the current range of addresses.