How google does it
Gmail.com redirects to the _spf.google.com
. Which is a different domain.
⟩ dig TXT gmail.com +short
"globalsign-smime-dv=CDYX+XFHUw2wml6/Gb8+59BsH31KzUr6c1l2BPvqKX8="
"v=spf1 redirect=_spf.google.com"
Google then includes all the records it needs and keeps the management somewhat simple with large complex records. It splits them up into their won thing _netblocks.google.com
, _netblocks2.google.com
etc.
⟩ dig TXT _spf.google.com +short
"v=spf1 include:_netblocks.google.com include:_netblocks2.google.com include:_netblocks3.google.com ~all"
⟩ dig TXT _netblocks.google.com +short
"v=spf1 ip4:35.190.247.0/24 ip4:64.233.160.0/19 ip4:66.102.0.0/20 ip4:66.249.80.0/20 ip4:72.14.192.0/18 ip4:74.125.0.0/16 ip4:108.177.8.0/21 ip4:173.194.0.0/16 ip4:209.85.128.0/17 ip4:216.58.192.0/19 ip4:216.239.32.0/19 ~all"
For different domains you use
dig TXT somedomain +short
"v=spf1 redirect=_spf.primarydomain"
For the primary, you stack your records into some organisation.
dig TXT primarydomain +short
"v=spf1 include:_exchange.primarydomain include:_smtp.primarydomain ~all"
Then put the actual addresses, etc.
dig TXT _smtp.primarydomain +short
"v=spf1 ip4:1.1.1.1/32 ip4:1.1.2.1/24 ~all"
dig TXT _exchange.primarydomain +short
"v=spf1 ip4:1.1.1.1/32 ~all"