Someone runs their mail server IP through an online blacklist checker, and Spamhaus shows up red. Mail still seems to be delivered, and the lookup page on the Spamhaus site might even say the IP is clean. So which answer is true? Often the listing is real, but sometimes the checker misread an error response as a listing. You can settle it yourself with dig in a couple of minutes.
This comes up a lot at the support desk. A customer pastes a screenshot, asks why their IP is blacklisted, and the first useful step is not a delisting request. It is running the query yourself from a resolver you understand and reading the exact answer that comes back.
How a DNSBL lookup actually works
A DNSBL (DNS-based blocklist) is a normal DNS zone. To ask whether an IPv4 address is listed, you reverse its four octets, append the list's zone name, and request an A record. For the address 203.0.113.45 against Spamhaus ZEN (the combined zone that covers several Spamhaus lists), the name you query is 45.113.0.203.zen.spamhaus.org.
There are two normal outcomes. If the IP is not listed, the zone answers NXDOMAIN, meaning the name does not exist. If it is listed, you get one or more A records in the 127.0.0.x range. The last octet tells you which list matched. Spamhaus uses loopback addresses on purpose, so the answer can never point anywhere real on the network.
There is a third outcome that confuses many tools. Spamhaus can also answer with addresses in 127.255.255.x. These are not listings. They are error codes telling you something is wrong with how the query reached them. A checker that treats any 127.x.x.x answer as listed will report a false alarm.
Check which resolver dig is using before trusting anything
Spamhaus restricts free queries that arrive through large public resolvers. When your query comes through one of them, you may get an error code instead of a real answer. Depending on the resolver, you may also get NXDOMAIN or nothing at all, which looks exactly like a clean result. That second case is worse because it hides real listings.
So before looking at your own IP, find out which resolver dig is talking to, then query the Spamhaus test point. The address 127.0.0.2 is permanently listed as a test entry, so its reversed name should always return listing codes. If it does not, your resolver path is broken and every other answer from it is meaningless.
# Show which resolver the system uses (read-only)
grep nameserver /etc/resolv.conf
# Query the test point through the default resolver.
# A healthy path returns one or more 127.0.0.x addresses.
dig +short 2.0.0.127.zen.spamhaus.org
# Compare against a specific resolver, e.g. a public one
dig +short 2.0.0.127.zen.spamhaus.org @8.8.8.8
# The full output includes a SERVER: line confirming who answered
dig 2.0.0.127.zen.spamhaus.org | grep SERVER
If /etc/resolv.conf shows 127.0.0.53, the system uses systemd-resolved, which forwards to an upstream resolver. The test point result then depends on that upstream server, not on the stub. You can see the upstream with resolvectl status.
The cleanest setup for a mail server is a local recursive resolver, such as Unbound, that talks to the authoritative servers directly instead of forwarding to a shared public resolver. If you cannot run one, Spamhaus offers a registered query service with a personal key. Check its current terms on the Spamhaus site, since free-use limits depend on volume and whether the use is commercial.
Run the query for your own IP
Once the test point returns codes through a resolver you trust, query your actual IP through that same resolver. Ask for the A record first, then the TXT record. The TXT answer usually includes a short reason and a pointer to the Spamhaus lookup page for that listing.
# Reverse the octets without typing them by hand
IP=203.0.113.45
IFS=. read -r a b c d <<< $IP
NAME=d.c.b.a.zen.spamhaus.org
# A record: NXDOMAIN (empty +short output) means not listed
dig +short $NAME
# TXT record: reason text for each matching list
dig +short TXT $NAME
# Full answer shows status: NXDOMAIN vs NOERROR explicitly
dig $NAME | grep -E 'status:|SERVER:'
Empty output from dig +short is easy to misread, so the last command is worth keeping. A status: NXDOMAIN header from a resolver that passed the test point is a real not-listed answer. A status: NOERROR with addresses in the answer section is a listing or an error code, and the address tells you which.
Here is what an error response through a blocked resolver typically looks like:
# Illustrative output format
$ dig +short 45.113.0.203.zen.spamhaus.org @8.8.8.8
127.255.255.254
$ dig +short TXT 45.113.0.203.zen.spamhaus.org @8.8.8.8
"Error: open resolver; ..."
That answer says nothing about 203.0.113.45. It only says the query came through a resolver Spamhaus will not serve. Many blacklist checkers that show a red Spamhaus result while other lists stay green are hitting exactly this.
Reading the return codes
These are the codes ZEN uses at the time of writing. Spamhaus documents them on its site and can change them, so confirm against the current list if something unexpected comes back.
| Answer | Meaning |
|---|---|
| NXDOMAIN | Not listed |
| 127.0.0.2 | SBL: known spam source or spam operation |
| 127.0.0.3 | SBL CSS: low-reputation sender, often snowshoe-style spam |
| 127.0.0.4 to 127.0.0.7 | XBL: host shows signs of compromise, such as malware or an exploited script |
| 127.0.0.9 | SBL DROP/EDROP: range considered hijacked or controlled by bad actors |
| 127.0.0.10 | PBL, maintained by the network owner: range not meant to send mail directly |
| 127.0.0.11 | PBL, maintained by Spamhaus: same idea, inferred by Spamhaus |
| 127.255.255.252 | Error: typo in the DNSBL zone name |
| 127.255.255.254 | Error: query sent through a public or open resolver |
| 127.255.255.255 | Error: too many queries from your resolver |
An IP can match more than one list, so you may see several A records at once. Read each one separately.
When the listing is real
If a trusted resolver returns a 127.0.0.x code, the listing is real, and the code points to the next step. The lists differ a lot in what they mean for a hosting server.
XBL is the one to take seriously first. It usually means something on the server, or behind it, is behaving like infected software: a compromised WordPress plugin sending spam, a hijacked mailbox password, or a script making outbound SMTP connections it should not. Requesting removal before finding the cause tends to end with the IP listed again. Check the mail queue, outbound connection logs, and recently modified PHP files before touching the delisting form.
CSS and SBL listings are about sending reputation. They often follow bulk sending without proper list hygiene, or a compromised account that sent a burst of spam. Fix the source, then follow the removal steps shown on the Spamhaus lookup page for that IP.
PBL is different. It is not a judgment that the IP sent spam. It means the range is marked as one that should not deliver mail directly to other servers, which is common for residential ranges and sometimes for VPS ranges. If you run a properly configured mail server on that IP, with matching forward and reverse DNS, the Spamhaus site typically offers a self-service removal for your single address. Whether that applies depends on who maintains the entry. A code of 127.0.0.10 means the network owner listed it, and that request may need to go through your provider.
The practical takeaway
When a checker says your IP is on Spamhaus, run three queries before believing it: the 127.0.0.2 test point to prove your resolver works, the A record for your reversed IP, and the TXT record for the reason. If the answer is in 127.255.255.x, the problem is the resolver, not your server. If it is in 127.0.0.x from a resolver that passed the test point, the listing is real, and the specific code tells you whether you are dealing with compromise, reputation, or policy. Keep that order and you avoid both chasing false alarms and missing real listings hidden behind an empty NXDOMAIN.