# man > cidr_table(5)

<think>
The user wants me to transform a Postfix man page about CIDR tables into Open Knowledge Format (OKF). Let me carefully follow all the rules:

1. Start with YAML frontmatter
2. Output valid Markdown only
3. Preserve all technical information
4. No invented content
5. Use only Markdown formatting, no HTML
6. No emoji
7. Code blocks with language tags
8. Wrap function/method names in backticks
9. Cross-references as standard Markdown links

Let me structure this properly:

- YAML frontmatter with type: CommandReference, command: cidr_table, mode: man, section: 5, source: man-pages
- Quick Reference section first
- Name section
- Synopsis section
- Options/TABLE FORMAT section
- Examples
- See Also
- Other relevant sections

Let me condense this well. The original has:
- NAME
- SYNOPSIS
- DESCRIPTION
- TABLE FORMAT
- TABLE SEARCH ORDER
- ADDRESS PATTERN SYNTAX
- EXAMPLE SMTPD ACCESS MAP
- SEE ALSO
- README FILES
- HISTORY
- AUTHOR(S)

For the Quick Reference, I need to extract the most useful examples. Since this is a table format reference (not a command), I'll create examples that show common patterns.

Let me write this out carefully, ensuring no emoji, all proper formatting.

For the table format, I need to preserve the pattern types:
- `pattern result` - basic match
- `!pattern result` - negation (Postfix 3.2+)
- `if pattern` / `endif` - conditional match (Postfix 3.2+)
- `if !pattern` / `endif` - negative conditional (Postfix 3.2+)
- comments and blank lines
- multi-line text

For the example, I should preserve the example code block with proper formatting. The original has the URL in an IPv6 address which got broken by the markdown conversion: "2001:[db8::1]" - I should fix this to be the proper IPv6 address "2001:db8::1" in a code block.

Let me also make sure the links are proper Markdown links. The original has links like `[postmap(1)](http://localhost/...)` which I'll keep.

Let me draft this:
</think>
---
type: CommandReference
command: cidr_table
mode: man
section: "5"
source: man-pages
---

## Quick Reference

- `postmap -q "string" cidr:/etc/postfix/filename` — look up a single string in a CIDR table
- `postmap -q - cidr:/etc/postfix/filename < inputfile` — look up strings read from a file
- `192.168.0.0/16          REJECT` — deny an entire IPv4 subnet
- `192.168.1.1             OK` — allow a single IPv4 host
- `2001:db8::/32           REJECT` — deny an entire IPv6 subnet
- `0.0.0.0/0               REJECT` — match every IPv4 address
- `::/0                    REJECT` — match every IPv6 address
- `!192.168.0.0/16         OK` — match every IPv4 address NOT in the subnet (Postfix 3.2+)

## Name

`cidr_table` — format of Postfix CIDR tables

## Synopsis

shell
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:

- `pattern result` — When a search string matches the specified `pattern`, use the corresponding `result` value. The `pattern` must be in `network/prefix` or `network_address` form.
- `!pattern result` — When a search string does not match the specified `pattern`, use the specified `result` value. The `pattern` must be in `network/prefix` or `network_address` form. Available in Postfix 3.2 and later.
- `if pattern` / `endif` — When a search string matches the specified `pattern`, match that search string against the patterns between `if` and `endif`. The `pattern` must be in `network/prefix` or `network_address` form. The `if`..`endif` can nest. Do not prepend whitespace to text between `if`..`endif`. Available in Postfix 3.2 and later.
- `if !pattern` / `endif` — When a search string does not match the specified `pattern`, match that search string against the patterns between `if` and `endif`. The `pattern` must be in `network/prefix` or `network_address` form. The `if`..`endif` can nest. Do not prepend whitespace to text between `if`..`endif`. Available in Postfix 3.2 and later.
- blank lines and comments — Empty lines and whitespace-only lines are ignored, as are lines whose first non-whitespace character is a `#`.
- multi-line text — A logical line starts with non-whitespace text. A line that starts with whitespace continues a logical line.

## 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.

## Examples

Example `smtpd` access map. `/etc/postfix/main.cf`:

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

text
# 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

- [postmap(1)](http://localhost/phpMan.php/man/postmap/1/markdown) — Postfix lookup table manager
- [regexp_table(5)](http://localhost/phpMan.php/man/regexptable/5/markdown) — format of regular expression tables
- [pcre_table(5)](http://localhost/phpMan.php/man/pcretable/5/markdown) — format of PCRE tables

## 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.