IPv4 CIDR contains
ipv4-cidr-contains · version 1.0.0 · URLs & IP addresses · free, no key needed
Test whether one IPv4 CIDR block fully contains another IPv4 CIDR block.
Use when you need to: ipv4 cidr contains · ipv4 subnet contains subnet · check ipv4 cidr containment.
Supported
- ipv4 cidr contains
- ipv4 subnet contains subnet
- check ipv4 cidr containment
Not supported
- IPv6
- partial/overlap-only containment
Behavior
- outer and inner are each dotted-decimal/prefix with host bits zero; otherwise the tool throws.
- contains is true iff every address in inner also lies in outer, i.e. inner.prefix >= outer.prefix and inner's range is a subset of outer's range.
- A CIDR always contains itself (equal blocks yield contains: true).
Input
outer(string, required): max length 18inner(string, required): max length 18
Output
contains(boolean, required)outer_network(string, required): max length 18inner_network(string, required): max length 18
Limits
- max cidr length: 18
Example
Request input:
{
"outer": "10.0.0.0/8",
"inner": "10.1.0.0/16"
}
Response:
{
"result": {
"contains": true,
"outer_network": "10.0.0.0/8",
"inner_network": "10.1.0.0/16"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "ipv4-cidr-contains",
"version": "1.0.0",
"input": {
"outer": "10.0.0.0/8",
"inner": "10.1.0.0/16"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/ipv4-cidr-contains/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"outer":"10.0.0.0/8","inner":"10.1.0.0/16"}'
The machine-readable contract is at /v1/tools/ipv4-cidr-contains/versions/1.0.0.
CLI
node cli.mjs run ipv4-cidr-contains 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- IPv6 CIDR contains: Test whether one IPv6 CIDR block fully contains another IPv6 CIDR block.
- IPv4 CIDR overlap: Test whether two IPv4 CIDR blocks overlap (share at least one address).
- IPv4 CIDR parse: Parse an IPv4 CIDR block into its network, broadcast, netmask, wildcard mask, usable host range and address counts.
- IPv4 in CIDR: Test whether a canonical IPv4 address lies in a CIDR prefix whose host bits are zero.
- IPv6 CIDR overlap: Test whether two IPv6 CIDR blocks overlap (share at least one address).
- IPv4 CIDR aggregate: Merge a list of IPv4 CIDR blocks into the minimal equivalent list of non-overlapping CIDR blocks.