DNSBLDNS-based Blackhole List

Definition

A DNSBL (DNS-based Blackhole List, also called a DNS blocklist or RBL) is a blacklist published through the Domain Name System so that any mail server can check a sending IP or domain with an ordinary DNS query. Standardised in RFC 5782, it returns an answer in the 127.0.0.0/8 range to say “listed” and a normal NXDOMAIN to say “not listed.”

  • A blacklist delivered over DNS, so a check costs one fast DNS lookup
  • The sending IP is reversed and prepended to the list’s zone to form the query
  • A reply in the 127.0.0.0/8 range means listed; NXDOMAIN means not listed
  • An optional TXT record carries the listing reason, often shown in the SMTP rejection
At a glance
Stands for DNS-based Blackhole List
Also called DNS blocklist · RBL
Standard RFC 5782 (informational)
Query type DNS A record (and optional TXT)
Listed answer 127.0.0.0/8 (e.g. 127.0.0.2)
Test entry 127.0.0.2 must always list

How a DNSBL query works

The clever part of a DNSBL is that it reuses ordinary DNS infrastructure to answer a yes-or-no question fast. To check an IPv4 address, the receiver reverses the four octets, appends the list’s zone name, and issues a standard A record lookup. If the IP 192.0.2.135 is being checked against zen.spamhaus.org, the query becomes 135.2.0.192.zen.spamhaus.org.

The answer is the verdict. If the list returns an A record in the loopback range 127.0.0.0/8, the IP is listed; if DNS returns NXDOMAIN (no such name), it is not listed. The returned address is a status code, never a real IP to connect to: per RFC 5782 every IPv4 DNSBL must list 127.0.0.2 as a permanent test entry and must not list 127.0.0.1, so operators can confirm their queries are wired up correctly.

Checking 192.0.2.135 against a DNSBL: reverse the octets, append the zone, look up the A record
; query
135.2.0.192.zen.spamhaus.org.   IN  A

; listed: an answer in 127.0.0.0/8
135.2.0.192.zen.spamhaus.org.   IN  A     127.0.0.2
135.2.0.192.zen.spamhaus.org.   IN  TXT   "https://check.spamhaus.org/sbl/..."

; not listed: NXDOMAIN

Reading the 127.0.0.x return codes

Many DNSBLs pack several sub-lists into one zone and tell them apart by the last octet of the returned address. Querying Spamhaus ZEN, for example, can return different codes depending on which underlying list matched:

  • 127.0.0.2: a generic spam-source listing (the SBL).
  • 127.0.0.3: a CSS listing (low-reputation, often snowshoe, senders).
  • 127.0.0.4: an XBL listing (an exploited or hijacked machine); 127.0.0.5 to 127.0.0.7 are currently unused.
  • 127.0.0.10 / 127.0.0.11: a PBL listing (an IP range that should not send mail directly).

A receiver can therefore apply different policies to different codes: reject outright on a high-confidence spam-source hit, but perhaps only defer or score a policy listing. The matching TXT record holds a human-readable reason and a link, which receivers often echo back as the SMTP error so the sender knows why they were blocked.

IP lists, domain lists, and whitelists

Most DNSBLs list IP addresses and are checked at the moment of connection, before any content is seen. A second family, domain-based lists (DNS-based blocklists of domains, sometimes called URIBLs or DBLs), are queried against the domains and links inside a message during content filtering, so they catch a bad sender even after an IP change.

The same DNS mechanism also runs in reverse as a whitelist, or DNSWL, where a listing signals a trusted sender rather than a blocked one. RFC 5782 covers both, which is why the modern, neutral term is DNSxL. In practice, “DNSBL” almost always means the blocking kind.

A DNSBL lookup, step by step

A sending server connects with IP 192.0.2.135
The receiver reverses the octets to 135.2.0.192
It appends the list zone and queries the A record
135.2.0.192.zen.spamhaus.org
What did DNS return?
127.0.0.x: listed NXDOMAIN: not listed
Receiver applies its policy for that return code
Reject Defer Score

DNSBL vs DNSWL

DNSBL DNSWL
Lists Bad senders Trusted senders
A listing means Block or penalise Trust or whitelist
Listed answer 127.0.0.x 127.0.x.x
Required test entry 127.0.0.2 listed 127.0.0.2 listed
Typical use Reject spam at connection Skip or relax filtering

By the numbers

127.0.0.2
The mandatory test entry every IPv4 DNSBL must list, per RFC 5782, so receivers can verify their lookups.
127.0.0.1
The address a conformant DNSBL must never list, since it would falsely flag the local loopback.
4
Reversed octets of an IPv4 address prepended to the zone to build a DNSBL query.

Common mistakes

Treating the return code as a real IP
The 127.0.0.x answer is a status flag, not an address to connect to. Reading it as an IP, or ignoring which sub-list each code maps to, leads to the wrong filtering decision.
Forgetting IPv6 byte order
IPv6 DNSBL queries reverse the address one nibble at a time in full, expanded form, not the four octets you reverse for IPv4. Building the query the IPv4 way silently never matches.
Querying a list that requires a data feed
High-volume operators such as Spamhaus block free public-DNS resolver traffic. Production mail servers must use their own local resolver or a licensed feed, or every lookup quietly fails.
Hard-rejecting on a policy or whitelist code
Not every 127.0.0.x answer warrants a block. A PBL or DNSWL code calls for a different action than a spam-source hit; treating them all the same blocks legitimate mail.

Frequently asked questions

What does a DNSBL return when an IP is listed?
An A record in the 127.0.0.0/8 loopback range, most commonly 127.0.0.2. The exact last octet often encodes which sub-list matched. If the IP is not listed, the DNS query simply returns NXDOMAIN. An accompanying TXT record usually carries the human-readable reason for the listing.
What is the difference between a DNSBL and a blacklist?
A blacklist is the database of senders considered abusive; a DNSBL is the specific method of publishing that database over DNS so it can be queried during the SMTP handshake. Because DNS is how nearly all blacklists are distributed, the two terms are often used interchangeably, but strictly the DNSBL is the delivery mechanism.
How does a mail server query a DNSBL?
It reverses the octets of the sending IPv4 address, appends the blocklist’s zone name, and issues a standard DNS A record lookup. For example, checking 192.0.2.135 against zen.spamhaus.org queries 135.2.0.192.zen.spamhaus.org. An answer in 127.0.0.0/8 means listed.
Why is 127.0.0.2 special in a DNSBL?
RFC 5782 requires every IPv4 DNSBL to keep 127.0.0.2 permanently listed and to never list 127.0.0.1. This gives operators a reliable way to test that their DNSBL lookups work: a query for 127.0.0.2 should always return a hit, and a query for 127.0.0.1 should never.
Reviewed by Jennifer Jackson, Email Deliverability Analyst · June 2026 ← Back to glossary