The ip4 and ip6 SPF mechanisms compare the connecting address with a published address or CIDR network. They are straightforward when you control stable outbound servers, but a small prefix error can grant permission to far more infrastructure than intended.
Use the address the recipient actually sees. A server's private interface address, a website address and a cloud account's general network range are not substitutes for the outbound SMTP source.
Choose the narrowest justified scope
ip4:192.0.2.70 identifies one IPv4 address because the omitted prefix defaults to /32. ip6:2001:db8::70 similarly defaults to /128. A /24 IPv4 prefix represents 256 addresses, while a /64 IPv6 prefix covers an enormous address space. Network size is not a reason to authorise it; control and operational need are.
RFC 7208 section 5.6 defines the matching and prefix rules. Use complete addresses and proper CIDR notation. An abbreviated value such as 192.0.2. is not a valid replacement for 192.0.2.0/24.
Worked example: boundary tests catch broad grants
Consider the synthetic policy v=spf1 ip4:192.0.2.64/28 ip6:2001:db8:1::/64 -all. The IPv4 range runs from 192.0.2.64 through 192.0.2.79. A connecting address of 192.0.2.70 matches; 192.0.2.80 does not and reaches -all if nothing else matches.
The IPv6 address 2001:db8:1::25 matches the /64. The address 2001:db8:2::25 does not. These reserved documentation addresses are for reasoning about the policy, not live senders.
For a real proposed range, create the same boundary tests and list who controls every included segment. If the only approved sender is one host, compare the permission set with a single-address mechanism before approving the broader prefix.
Check both network families and egress paths
A native IPv6 source requires an IPv6 permission. RFC 7208 RFC 7208 §5 separately requires IPv4-mapped IPv6 addresses to be checked as IPv4; this does not make an ip4 range cover native IPv6. A system that begins using IPv6 may suddenly reach the policy ending even though its IPv4 messages continue to pass. Obtain received-message evidence or outbound infrastructure records for both families actually used.
Also account for NAT, failover gateways, regional relays and scheduled jobs. A test from a single active node may miss a standby route. Do not solve uncertainty by authorising a whole hosting provider. Establish the supported egress set and ownership instead.
Understand the maintenance tradeoff
Under RFC 7208 §4.6.4, ip4 and ip6 do not consume the ten DNS-query-causing-term budget during mechanism evaluation. The receiver still has to obtain the SPF record, and policy size and correctness still matter. A record with hundreds of copied ranges is not automatically maintainable merely because those terms do not count toward that limit.
When a provider recommends an include, replacing it with a snapshot of IP addresses makes you responsible for future changes. Record how changes will be detected, who will approve them and how obsolete addresses will be removed. Stale permissions can both disrupt legitimate mail and retain access for infrastructure you no longer use.
Publish with a permission diff
Keep the old record and explain the exact ranges being added and removed. Validate the entire proposed SPF record, test known sender addresses and nearby unauthorised addresses, and verify the published TXT answer. Then send representative messages through normal and failover paths.
If an address is unexpectedly outside the approved range, investigate the route before widening it. An unexpected egress may reveal a configuration error or an unapproved sender rather than a missing permission.
The practical takeaway
An address mechanism is explicit only when its ownership and boundaries are explicit. Use observed egress, test range edges and treat future address changes as part of the authorisation lifecycle.
Record the decision and its limits
For the /28 fixture, record 192.0.2.63 as outside, .64 and .79 as inside, and .80 as outside. SPF prefix matching includes all addresses in the block, not only the conventional host-address subset. If only .70 is justified, compare /32 with /28: the latter grants 16 addresses, not one. These are calculated membership examples, not executed SPF tests.