Spamhaus ZEN not working on Google DNS 8.8.8.8: the fix
Spamhaus does not answer DNSBL queries that arrive through large public resolvers like Google 8.8.8.8 and Cloudflare 1.1.1.1. Your checker or Postfix then sees an error code or an empty answer instead of a real verdict. Query from a local recursive resolver such as Unbound, or use a free Spamhaus DQS key.
Sohail Hussain8 min readShort answer
- Spamhaus refuses to give real answers to queries that arrive through public resolvers such as 8.8.8.8 and 1.1.1.1. You get an error code like 127.255.255.254 or a false "not listed" result, not a verdict on your IP.
- Run dig +short 2.0.0.127.zen.spamhaus.org against the resolver your mail server uses. If you don't get 127.0.0.2, switch to your own recursive resolver or a free Spamhaus DQS key, and make Postfix ignore 127.255.255.x codes.
Your blacklist checker says an IP is clean, or Postfix suddenly rejects everything, and the lookups went through Google (8.8.8.8) or Cloudflare (1.1.1.1). The answer is probably not a real verdict. The query reached Spamhaus through a resolver it won't serve.
Why it happens
A DNSBL lookup is an ordinary DNS query. To check 203.0.113.5 you query 5.113.0.203.zen.spamhaus.org. Spamhaus's free public mirrors are for small-scale, non-commercial use, and when queries arrive via a public resolver, Spamhaus can't tell how many queries you are making. So it blocks them.
What you see depends on the path:
- Error code. 127.255.255.254 means the query came via a public/open resolver or an IP with generic, unattributable reverse DNS. It carries no reputation data.
- False "not listed." Spamhaus's own FAQ says that with a resolver like Google Public DNS (8.8.8.8), in most cases you get a "not listed" (NXDOMAIN) reply from the public DNSBL servers. A listed IP looks clean.
- False "listed." Software that treats any
127.*answer as a hit will flag every sender. People on Cloudflare's community forum reported this in 2022. Spamhaus began rolling out the error code across Cloudflare's IP space on February 15, 2022.
The generic-rDNS part matters. It means the problem isn't limited to Google and Cloudflare. Spamhaus has published similar notices for AWS, DigitalOcean, Vultr and Hetzner, among others. A local resolver on a cloud VM with generic reverse DNS can still be refused.
| Return code | Meaning | What your software does wrong |
|---|---|---|
127.255.255.252 | Typo in the DNSBL name | Treats it as a listing |
127.255.255.254 | Query via public resolver or generic rDNS | Rejects mail, or ignores the list |
127.255.255.255 | Excessive number of queries | Same |
| NXDOMAIN from a public resolver | Looks like "not listed" | Reports a listed IP as clean |
Spamhaus states that none of these return codes relate to reputation; they are error codes. The first three come from Spamhaus's return-code reference.
Step-by-step fixes
Fix 1: confirm which resolver is answering
- Query the test entry through each resolver.
127.0.0.2is always listed, so it must come back as a hit.
dig +short 2.0.0.127.zen.spamhaus.org @8.8.8.8
dig +short 2.0.0.127.zen.spamhaus.org @1.1.1.1
dig +short 2.0.0.127.zen.spamhaus.org
- Read the results. A healthy setup returns
127.0.0.2, usually with other127.0.0.xcodes alongside it. Spamhaus's FAQ lists the normal test results as 127.0.0.4, 127.0.0.2 and 127.0.0.10, for its three test queries. Empty output, NXDOMAIN or127.255.255.254means you have this problem. - Find out which resolver your mail server really uses. Spamhaus suggests running
dig txt whoami.fastly.netto see which resolver is in play. Also check/etc/resolv.conf,resolvectl statuson systemd-resolved hosts, and your router or VPC DHCP settings.
Shell vs mail server
Your shell and your mail daemon can use different resolvers. Spamhaus calls this out in its FAQ as a possible reason for different answers, so test from the same host and the same DNS settings the MTA uses.
Fix 2: run a local recursive resolver
This is the fix I'd pick for a mail server you run yourself. Spamhaus recommends it too: use your own DNS servers for Spamhaus queries.
- Install Unbound from your distribution's packages.
- Keep the config minimal. Do not add a
forward-zonepointing at8.8.8.8,1.1.1.1or similar, because forwarding brings the problem straight back.
server:
interface: 127.0.0.1
access-control: 127.0.0.0/8 allow
- Start Unbound and set
nameserver 127.0.0.1in/etc/resolv.conf. If systemd-resolved or NetworkManager rewrites that file, set the resolver there instead. - Rerun the
digtest without the@part. You should see127.0.0.2.
Spamhaus says that to keep using the free public infrastructure, queries must come from a dedicated IP with attributable reverse and forward DNS. If your host gives the server generic rDNS, set a proper PTR record first or use Fix 3.
Fix 3: use a free Spamhaus DQS key
If you can't run a resolver (managed hosting, containers with locked DNS, a cloud range with generic rDNS), use Spamhaus Technology's Data Query Service. Spamhaus describes it as a way to query successfully via public/open resolvers, and the same usage terms apply. That means the free tier is for non-commercial use; commercial or heavy senders need a paid datafeed.
Spamhaus's sign-up steps, as published on its Cloudflare migration page: sign up, verify your email, log in to get your DQS key, then update your mail configuration.
Remove old config first
Spamhaus advises removing all legacy DNSBL configuration before you sign up. Otherwise the account verification email may not reach you, because your server's lookups are being blocked.
Query a hostname built from your key instead of the shared one:
dig +short 2.0.0.127.{your-dqs-key}.zen.dq.spamhaus.net
You should get the same 127.0.0.2 response. Check Spamhaus's technical documentation for the exact zone names your MTA needs.
Fix 4: stop Postfix treating error codes as listings
Whichever resolver you use, restrict which return codes count as a hit. Without a pattern, reject_rbl_client rejects on any A record, including the 127.255.255.x errors. Spamhaus warns that if servers aren't set up to handle the error code, all emails could be rejected and bounced.
smtpd_recipient_restrictions =
permit_mynetworks,
reject_unauth_destination,
reject_rbl_client zen.spamhaus.org=127.0.0.[2..11]
Reload with postfix reload. With a DQS key, use {your-dqs-key}.zen.dq.spamhaus.net as the zone. The same idea applies to Rspamd, SpamAssassin and similar tools: match the real 127.0.0.x codes only.
Checking your own sending IP
If you only want to know whether your IP is listed, you don't need to change any server. Use Spamhaus's own IP and domain reputation checker, or run dig from a machine with a non-public recursive resolver. Third-party checker sites run lookups from their own servers, and I can't tell you which resolver each one uses. Treat a "clean" result from an unfamiliar tool as unconfirmed until it matches a direct query.
If the IP is genuinely listed, the fix is on Spamhaus's side: read the listing record, fix the cause, and request removal there. Our blacklist glossary entry and deliverability checklist cover next steps, and fixing email deliverability issues helps if bounces continue after delisting.
Checklist before you try again
dig +short 2.0.0.127.zen.spamhaus.orgreturns127.0.0.2from the same host and resolver your MTA uses.- No
forward-zoneor DHCP-supplied DNS points at a public resolver. - The server has sensible reverse DNS, or you are using a DQS key.
- Postfix (or your filter) matches
127.0.0.[2..11], not every127.*answer. - A cron job alerts you when the test query stops returning
127.0.0.2.
Why a canary check pays off
A new VM image with 8.8.8.8 in its DHCP config will silently break lookups again. The canary query catches that within a day, instead of when a listed IP slips through.
If nothing works
If the local-resolver or DQS test still fails, contact Spamhaus support through its website, or your hosting provider if the VM's reverse DNS is the issue. Include the exact dig output (query, server used, timestamp), your sending IP, whether DNS goes direct or through a forwarder, and what whoami.fastly.net returned.
Subject: DNSBL queries return 127.255.255.254 from my mail server
My mail server (IP: {your-ip}, rDNS: {your-ptr}) gets 127.255.255.254 when
querying 2.0.0.127.zen.spamhaus.org.
Resolver in use: {local Unbound / provider resolver / DQS key}
Timestamp (UTC): {time}
dig output: {paste output}
whoami.fastly.net result: {paste output}
I have removed forwarders to public resolvers. Please confirm whether my
queries are being classified as public-resolver traffic.
Common questions
Is 127.255.255.254 a sign my IP is blacklisted?
No. It is an error code meaning the query arrived via a public resolver or an IP with generic rDNS. It says nothing about your reputation, and nothing should reject mail because of it.
Does the free DQS cost anything?
Spamhaus advertises it as free, with the same usage terms as the public mirrors. Those terms are for non-commercial use, so check them before relying on it for a business mail stream.
Why does a checker show clean when Spamhaus lists my IP?
The checker may be querying through a public resolver and reading the NXDOMAIN reply as "not listed." Rerun the lookup yourself with the dig commands above, and use Spamhaus's own checker for a definite answer.
Can I keep using 8.8.8.8 for everything else?
Yes. The restriction applies to DNSBL lookups. Just point your MTA and anything that queries Spamhaus at a resolver Spamhaus will answer, or use a DQS key.
Explore: Email Deliverability
Related Articles
550 5.7.1 MailFrom domain is listed in Spamhaus DBL: how to delist
This bounce means the receiving server found your envelope sender domain on the Spamhaus Domain Block List (DBL). Changing your IP won't help. Look the domain up at check.spamhaus.org, find and stop the abuse behind the listing, publish DMARC to see who sends as you, then submit a removal request.
554 5.7.5 Permanent error evaluating DMARC policy: fixes
The bounce 554 5.7.5 Permanent error evaluating DMARC policy means the receiving server could not process your domain's DMARC record. Usual causes are a malformed or duplicate record, a DNS lookup failure, or a broken SPF record. Check your records with dig, fix them, and contact the recipient's admin if only one provider bounces.
Cloudflare CNAME "authentication error" in SendLayer: use DNS only
When SendLayer or another email provider reports an "authentication error" on CNAME records you added in Cloudflare, the records are almost always proxied. Set Proxy status to DNS only (grey cloud) on every DKIM and return-path CNAME, wait a few minutes, then verify again.
DMARC Policy Not Enabled: Is p=none a Problem, and What to Do
"DMARC Policy Not Enabled" means your record says `p=none`, so receivers report on failing mail but don't act on it. The record is valid and the right starting point. Add an `rua` address, read the reports, align every sender, then move to quarantine and reject. Don't jump straight to reject.
Ready to supercharge your email marketing?
Start sending smarter emails with AI-powered campaigns. No credit card required.
Get Started Free