← RFC Reference

RFC 5782: DNS-Based Blacklists and Whitelists

Informational DNS & Mail Routing DNSBLDNSWLIP ReputationSpam Filtering
ELI5: Imagine a shared phone book that marks which phone numbers are known telemarketers. When you get a call, you look up the number. DNSBLs work the same way — mail servers look up a sender’s IP address in a DNS-based list to decide whether the message is likely spam or legitimate, all in milliseconds using normal DNS queries.

Why This Exists

Spam filtering requires real-time reputation data about sending IP addresses and domains. Before DNSBLs, each organization had to maintain its own blocklist. This does not scale — there are billions of IP addresses and thousands of mail servers that need the same information.

DNS-based lists solve this by publishing reputation data as DNS records. Any mail server can query them during an SMTP transaction with near-zero latency, using the same DNS infrastructure it already relies on. RFC 5782 documents how these lists work, covering:

How It Works

To query a DNSBL, the receiving mail server reverses the octets of the sender's IP address and appends the list's zone name, then performs a DNS A record lookup.

IP Address Lookup

To check whether 203.0.113.42 is listed on zen.spamhaus.org:

Query:   42.113.0.203.zen.spamhaus.org  A
Answer:  127.0.0.2

The octets are reversed (just like in-addr.arpa PTR records). A response in the 127.0.0.0/8 range means the IP is listed. The specific return value encodes the listing reason. An NXDOMAIN response means the IP is not listed.

Return Code Meanings (Spamhaus Example)

Return Code Spamhaus List Meaning
127.0.0.2 SBL Direct spam source, verified
127.0.0.3 SBL CSS Spam source identified by automated systems
127.0.0.4 XBL (CBL) Exploited host (malware, botnet, open proxy)
127.0.0.10 PBL End-user IP range, should not send mail directly

TXT Record for Details

A corresponding TXT lookup returns a human-readable explanation and often a URL for delisting:

Query:   42.113.0.203.zen.spamhaus.org  TXT
Answer:  "Listed at https://www.spamhaus.org/query/ip/203.0.113.42"

Domain-Based Lookups

Some lists (like Spamhaus DBL or SURBL) list domain names rather than IPs. The domain is prepended directly to the list zone:

Query:   baddomain.example.dbl.spamhaus.org  A
Answer:  127.0.1.2  (spam domain)

Key Technical Details

Major DNSBLs Used in Email

List Type What It Lists
Spamhaus ZEN IP blocklist Combined SBL + XBL + PBL (most widely used)
Spamhaus DBL Domain blocklist Domains found in spam content and headers
Barracuda BRBL IP blocklist IPs sending spam to Barracuda honeypots
SpamCop IP blocklist IPs reported by SpamCop users (auto-expires)
SURBL URI blocklist Domains found in spam message bodies
dnswl.org IP whitelist Verified legitimate mail senders (DNSWL)

Query Mechanics

IPv6 Support

IPv6 addresses are expanded to full 32-nibble form, reversed nibble-by-nibble, and appended to the zone. For example, 2001:db8::1 becomes:

Query:   1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.zen.spamhaus.org  A

Common Mistakes

Deliverability Impact

Related RFCs