arrow Open Source Projects

CIDR-Man

CIDR-Man is a high-performance ipaddress subnetting library. Designed to replace the built-in ipaddress library, it provides features for representing and manipulating both IPv4 and IPv6 network addresses.

gitlab Source

PyPi PyPi

Docs Docs

License MIT license

CIDR-Man

SHARE

linkedin share twitter share reddit share

Supercharge Your Network Automation with High-Performance Subnetting

An attractive screenshot of the example code from the repo

Are you tired of Python’s sluggish built-in ipaddress library slowing down your network automation scripts?

Meet CIDR-Man!

The mature, fast, and pythonic library that’s up to 8.52x faster than both Python’s built-in ipaddress library and netaddr while fixing critical accuracy issues that have been plaguing network engineers for years.

Why CIDR-Man is a Game-Changer

CIDR-Man is a high-performance ipaddress subnetting library designed to replace the built-in ipaddress library. First released in 2022, CIDR-Man is a mature, fast, pythonic, and flexible library written in pure Python, ensuring it’s portable across all platforms. Built by network engineers for network engineers out of frustrations with the performance, code complexity, and accuracy of both Python’s built-in ipaddress library and netaddr.

Key Benefits for Network Professionals

  • Lightning Fast Performance: Up to 8.52x faster than both Python’s built-in ipaddress library and netaddr
  • RFC-Compliant Accuracy: Fixes incorrect results from Python’s built-in library’s is_
    flags, providing accurate results as per RFCs
  • Pythonic Interface: Clean, intuitive API that feels genuinely pythonic and natural to Python developers
  • Single Class Design: One unified CIDR class handles both networks and individual addresses
  • IPv4 & IPv6 Support: Full dual-stack networking support for modern infrastructure
  • Zero Dependencies: Pure Python implementation with no external dependencies
  • Mature & Stable: First released in 2022, battle-tested in production environments

Perfect for Your Network Operations Stack

DevOps Engineers

Transform your infrastructure-as-code with blazing-fast IP address calculations for:

  • Terraform network resource provisioning
  • Ansible inventory management
  • Container orchestration networking
  • Cloud infrastructure automation

NetOps Teams

Streamline your network operations with reliable, high-performance tools for:

  • Network discovery and scanning
  • Subnet planning and allocation
  • Route table analysis and validation
  • Network monitoring automation

Network Engineers

Build robust network automation solutions with:

  • CIDR block calculations and subnet analysis
  • IP address validation and classification
  • Network overlap detection
  • Routing table reconciliation

Installation & Quick Start

# Install via pip
pip install CIDR-Man

# Or clone from source
git clone https://gitlab.com/geoip.network/cidr_man
cd cidr_man && poetry install
from cidr_man import CIDR

# Create network objects effortlessly
network = CIDR("192.168.1.0/24")
host = CIDR("192.168.1.42")

# Lightning-fast containment checks
if host in network:
    print("Host is in network!")

# Access network properties instantly
print(f"Network: {network.network_address}")    # 192.168.1.0
print(f"Broadcast: {network.broadcast_address}") # 192.168.1.255  
print(f"Gateway: {network.first_address}")       # 192.168.1.1
print(f"Netmask: {network.netmask}")            # 255.255.255.0

Real-World Use Cases

Network Automation Scripts

Replace slow subnet calculations in your automation pipelines with CIDR-Man’s optimized algorithms.

Infrastructure Monitoring

Build faster network discovery tools that can process thousands of IP addresses per second.

Security Analysis

Rapidly analyze network traffic patterns and identify IP address classifications with RFC-compliant accuracy.

Cloud Network Planning

Efficiently plan and validate cloud network architectures with reliable subnet calculations.

Advanced Features That Set CIDR-Man Apart

Comprehensive Address Classification

network = CIDR("10.0.1.0/24")

# RFC-accurate classification flags
network.is_private         # True - Private network detection
network.is_multicast       # False - Multicast address detection  
network.is_global          # False - Global address detection
network.is_loopback        # False - Loopback detection
network.is_link_local      # False - Link-local detection
network.is_carrier_grade_nat # False - Carrier-Grade NAT detection
network.is_reserved        # False - IANA reserved detection
network.is_documentation   # False - Documentation purposes

Complete Feature Set

CIDR-Man supports all essential networking operations:

  • Calculating subnets and supernets
  • Comparisons (contains, equals, greater-than, etc.)
  • (Un)packing to/from network byte format
  • Converting to/from presentation formats
  • Calculating netmasks and inverse netmasks
  • Generating DNS PTR (reverse pointer) addresses for reverse DNS lookups
  • Key addresses: network, broadcast, first, and last addresses
  • Set-based operations for advanced network analysis

Flexible Input Formats

Supports all common input types: presentation format, integer format, network/big-endian byte format, and built-in IP & Network types

Network Comparison Operations

subnet = CIDR("192.168.1.0/26") 
supernet = CIDR("192.168.1.0/24")

# Intuitive network relationships
result = subnet in supernet  # True
# Or use explicit methods
result = supernet.contains(subnet)  # True

Performance That Matters

When you’re processing millions of IP addresses in production environments, performance isn’t just nice-to-have – it’s essential. CIDR-Man delivers exceptional performance improvements across all operations:

Key Performance Metrics vs Built-in ipaddress library:

  • Initialization (__init__): 7.822x faster
  • Supernet operations: 2.186x faster
  • Subnet containment (subnet_of): 8.516x faster
  • Subnet generation (subnets): 3.966x faster
  • Address compression: 1.303x faster

Even basic operations like initializing a new CIDR instance are significantly faster than the built-in library’s IPv4Network/IPv6Network equivalents, making CIDR-Man ideal for high-throughput network processing applications.

Production-Ready

  • Actively Maintained: Regular updates and community support via GitLab
  • Comprehensive Testing: Thoroughly tested against RFC specifications
  • Mature Codebase: First released in 2022, proven in production environments
  • Professional Support: Priority support and feature development available on request

Get Started Today

Transform your network automation workflows with CIDR-Man’s superior performance and accuracy. Whether you’re managing enterprise networks, building cloud infrastructure, or developing network security tools, CIDR-Man provides the reliable foundation your projects deserve.


Tags

python networking cidr ipaddress network-automation devops netops network-engineering subnet-calculation ipv4 ipv6 network-tools infrastructure-automation performance rfc-compliant

Ready to supercharge your network automation? Install CIDR-Man today and experience the difference that performance and accuracy make in production environments.

arrow Open Source overview