cidr
Manipulate and validate CIDR notation IP addresses
TLDR
Explain a CIDR range
Check whether an address belongs to a CIDR range
Get a count of all addresses in a CIDR range
Check whether two CIDR ranges overlap
Divide a CIDR range into a specific number of networks
SYNOPSIS
cidr [options]
PARAMETERS
-h, --help
Display help message and exit.
-v, --version
Display version information and exit.
-i, --info
Display information about the specified CIDR address(es).
-n, --network
Output the network address of the specified CIDR address(es).
-b, --broadcast
Output the broadcast address of the specified CIDR address(es).
-r, --range
Output the host address range of the specified CIDR address(es).
-s, --size
Output the number of hosts in the specified CIDR address(es).
-a, --aggregate
Aggregate a list of CIDR address(es) into a minimal set of CIDR addresses.
-e, --exclude
Exclude the provided CIDR from the initial CIDR or list of CIDRs.
--split
Split the CIDR into smaller CIDRs of the given prefix length.
DESCRIPTION
The `cidr` command is a utility for manipulating and calculating Classless Inter-Domain Routing (CIDR) addresses. It allows users to perform operations such as calculating network addresses, finding the broadcast address, determining the host address range, performing CIDR aggregation, and validating CIDR notation. It's a useful tool for network administrators and developers who need to work with IP address ranges and subnetting.
The `cidr` tool simplifies IP address management and eliminates the need for manual calculations. It supports IPv4 and IPv6 addresses. You can query/generate multiple networks with the tool. You can do calculation of IP addresses and netmasks. NOTE: The tool is not included in coreutils and might need to be installed from a separate package depending on the distribution.
CAVEATS
Error handling is minimal. Invalid CIDR notations or input may produce unexpected results or program termination. It's crucial to validate your input data for accuracy before using this tool.
EXAMPLES
Calculating the network address: `cidr -n 192.168.1.0/24`
Finding the broadcast address: `cidr -b 192.168.1.0/24`
Getting the host range: `cidr -r 192.168.1.0/24`
Aggregating CIDR addresses: `cidr -a 192.168.0.0/24 192.168.1.0/24`
These examples demonstrate the core functionalities of the `cidr` command, enabling users to quickly perform various IP address calculations.
HISTORY
The `cidr` command has been developed as a standalone tool to simplify CIDR address calculations and manipulations, a task frequently needed in network administration and programming, since base tools don't provide all the utilities. It's evolved to include aggregation and more complex operations as network address management became more intricate.