man > cidr_table(5)

📛 NAME

cidr_table - format of Postfix CIDR tables

🚀 Quick Reference

Use CaseCommandDescription
🔍 Test a CIDR lookuppostmap -q "string" cidr:/etc/postfix/filenameQuery a CIDR table for a specific key
📥 Batch test lookupspostmap -q - cidr:/etc/postfix/filename <inputfileRead keys from stdin and output results
🛡️ Use in SMTP access controlsmtpd_client_restrictions = ... cidr:/etc/postfix/client.cidrReference a CIDR table in main.cf
📋 List supported table typespostconf -mVerify CIDR is compiled into Postfix
🔀 Negated match (Postfix ≥3.2)!pattern resultReturn result when search string does NOT match pattern
🧩 Conditional block (Postfix ≥3.2)if patternendifNest patterns under a condition; only active if outer pattern matches

📋 SYNOPSIS

postmap -q "string" cidr:/etc/postfix/filename
postmap -q - cidr:/etc/postfix/filename <inputfile

📖 DESCRIPTION

The Postfix mail system uses optional lookup tables. These tables are usually in dbm or db format. Alternatively, lookup tables can be specified in CIDR (Classless Inter-Domain Routing) form. In this case, each input is compared against a list of patterns. When a match is found, the corresponding result is returned and the search is terminated.

To find out what types of lookup tables your Postfix system supports use the postconf -m command.

To test lookup tables, use the postmap -q command as described in the SYNOPSIS above.

📄 TABLE FORMAT

The general form of a Postfix CIDR table is:

🔍 TABLE SEARCH ORDER

Patterns are applied in the order as specified in the table, until a pattern is found that matches the search string.

🌐 ADDRESS PATTERN SYNTAX

Postfix CIDR tables are pattern-based. A pattern is either a network_address which requires an exact match, or a network_address/prefix_length where the prefix_length part specifies the length of the network_address prefix that must be matched (the other bits in the network_address part must be zero).

An IPv4 network address is a sequence of four decimal octets separated by ., and an IPv6 network address is a sequence of three to eight hexadecimal octet pairs separated by : or ::, where the latter is short-hand for a sequence of one or more all-zero octet pairs. The pattern 0.0.0.0/0 matches every IPv4 address, and ::/0 matches every IPv6 address. IPv6 support is available in Postfix 2.2 and later.

Before comparisons are made, lookup keys and table entries are converted from string to binary. Therefore, IPv6 patterns will be matched regardless of leading zeros (a leading zero in an IPv4 address octet indicates octal notation).

Note: address information may be enclosed inside [] but this form is not required.

📝 EXAMPLE SMTPD ACCESS MAP

/etc/postfix/main.cf:

smtpd_client_restrictions = ... cidr:/etc/postfix/client.cidr ...

/etc/postfix/client.cidr:

# Rule order matters. Put more specific allowlist entries
# before more general denylist entries.
192.168.1.1             OK
192.168.0.0/16          REJECT
2001:db8::1             OK
2001:db8::/32           REJECT

📚 SEE ALSO

📘 README FILES

Use postconf readme_directory or postconf html_directory to locate this information.

DATABASE_README, Postfix lookup table overview

⏳ HISTORY

CIDR table support was introduced with Postfix version 2.1.

👤 AUTHOR(S)

The CIDR table lookup code was originally written by:

Jozsef Kadlecsik
KFKI Research Institute for Particle and Nuclear Physics
POB. 49
1525 Budapest, Hungary

Adopted and adapted by:

Wietse Venema
IBM T.J. Watson Research
P.O. Box 704
Yorktown Heights, NY 10598, USA

Wietse Venema
Google, Inc.
111 8th Avenue
New York, NY 10011, USA

cidr_table(5)
📛 NAME 🚀 Quick Reference 📋 SYNOPSIS 📖 DESCRIPTION 📄 TABLE FORMAT 🔍 TABLE SEARCH ORDER 🌐 ADDRESS PATTERN SYNTAX 📝 EXAMPLE SMTPD ACCESS MAP 📚 SEE ALSO 📘 README FILES ⏳ HISTORY 👤 AUTHOR(S)

Generated by phpman v4.9.26-5-g7740029 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-08-14 16:10 @216.73.216.233
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!

^_top_^