> For the complete documentation index, see [llms.txt](https://docs.postgresql.tw/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.postgresql.tw/19/the-sql-language/datatype/datatype-net-types/datatype-cidr.md). Agents can also search and read this documentation through its [MCP server](https://docs.postgresql.tw/~gitbook/mcp).

# 8.9.2. cidr

## 8.9.2. `cidr` [#](#datatype-cidr) <a href="#datatype-cidr" id="datatype-cidr"></a>

`cidr` 型別存放的是 IPv4 或 IPv6 的網路指定。其輸入與輸出格式遵循無類別網際網域路由（Classless Internet Domain Routing）的慣例。指定網路的格式是 *`address/y`*，其中 *`address`* 是該網路中以 IPv4 或 IPv6 位址表示的最小位址，而 *`y`* 則是網路遮罩的位元數。如果省略 *`y`*，它會依據較舊的分類式網路編號系統的假設來計算，但至少會大到足以涵蓋輸入中所寫出的所有位元組。如果所指定的網路位址在指定的網路遮罩右側還有位元被設定，就會發生錯誤。

[表 8.22](#datatype-net-cidr-table) 列出一些範例。

### 表 8.22. `cidr` 型別的輸入範例 [#](#datatype-net-cidr-table) <a href="#datatype-net-cidr-table" id="datatype-net-cidr-table"></a>

| `cidr` 輸入                             | `cidr` 輸出                             | `abbrev(cidr)`                        |
| ------------------------------------- | ------------------------------------- | ------------------------------------- |
| 192.168.100.128/25                    | 192.168.100.128/25                    | 192.168.100.128/25                    |
| 192.168/24                            | 192.168.0.0/24                        | 192.168.0/24                          |
| 192.168/25                            | 192.168.0.0/25                        | 192.168.0.0/25                        |
| 192.168.1                             | 192.168.1.0/24                        | 192.168.1/24                          |
| 192.168                               | 192.168.0.0/24                        | 192.168.0/24                          |
| 128.1                                 | 128.1.0.0/16                          | 128.1/16                              |
| 128                                   | 128.0.0.0/16                          | 128.0/16                              |
| 128.1.2                               | 128.1.2.0/24                          | 128.1.2/24                            |
| 10.1.2                                | 10.1.2.0/24                           | 10.1.2/24                             |
| 10.1                                  | 10.1.0.0/16                           | 10.1/16                               |
| 10                                    | 10.0.0.0/8                            | 10/8                                  |
| 10.1.2.3/32                           | 10.1.2.3/32                           | 10.1.2.3/32                           |
| 2001:4f8:3:ba::/64                    | 2001:4f8:3:ba::/64                    | 2001:4f8:3:ba/64                      |
| 2001:4f8:3:ba:​2e0:81ff:fe22:d1f1/128 | 2001:4f8:3:ba:​2e0:81ff:fe22:d1f1/128 | 2001:4f8:3:ba:​2e0:81ff:fe22:d1f1/128 |
| ::ffff:1.2.3.0/120                    | ::ffff:1.2.3.0/120                    | ::ffff:1.2.3/120                      |
| ::ffff:1.2.3.0/128                    | ::ffff:1.2.3.0/128                    | ::ffff:1.2.3.0/128                    |

<br>

[返回 8.9. 網路位址型別](https://docs.postgresql.tw/19/the-sql-language/datatype/datatype-net-types.md#datatype-net-types)

***

原文：[PostgreSQL 18.6 Documentation](https://www.postgresql.org/docs/18/datatype-net-types.html)（原文版本：18.6；核對日期：2026-09-13）


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.postgresql.tw/19/the-sql-language/datatype/datatype-net-types/datatype-cidr.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
