IPAM Hierarchy
Infrahub IPAM uses a parent-child hierarchy:IP Namespaces
Namespaces provide isolation for overlapping IP space (e.g., multi-tenant, VRFs, environments).Creating a Namespace
- UI
- GraphQL
- Python SDK
- Navigate to IPAM → Namespaces
- Click Add Namespace
- Set Name and Description
- Click Save
default namespace is created automatically during Infrahub initialization.
IP Prefixes
Prefixes represent network subnets (e.g., 10.0.1.0/24, 2001:db8::/32).Creating a Prefix
- UI
- GraphQL
- Python SDK
- Navigate to IPAM → Prefixes
- Click Add Prefix
- Set:
- Prefix: CIDR notation (e.g.,
10.0.1.0/24) - IP Namespace: Select namespace
- Status: Active, reserved, deprecated, etc.
- Member Type: Prefix or pool
- Description: Purpose of the prefix
- Prefix: CIDR notation (e.g.,
- Click Save
IPAM Reconciliation
TheIpamReconciler automatically maintains the parent-child hierarchy:
- Finds the closest parent prefix (longest prefix match)
- Sets the
parentrelationship - Updates
is_top_levelflag - Moves orphaned children to the new parent
- Updates
childrenandip_addressesrelationships
Prefix Queries
Find prefixes by various criteria:IP Addresses
IP addresses are specific IPs within prefixes (e.g., 10.0.1.5/32).Creating an IP Address
- UI
- GraphQL
- Python SDK
- Navigate to IPAM → IP Addresses
- Click Add IP Address
- Set:
- Address: IP with prefix length (e.g.,
10.0.1.5/32) - IP Namespace: Select namespace
- Status: Active, reserved, etc.
- Description: What uses this IP
- Address: IP with prefix length (e.g.,
- Click Save
Assigning IPs to Interfaces
Link IP addresses to device interfaces:Resource Allocator
TheIPAMResourceAllocator finds the next available prefix or IP address.
Allocating Prefixes
- Queries all child prefixes using
IPPrefixSubnetFetchFree - Calculates gaps in the address space
- Returns the first available prefix of the requested length
Allocating IP Addresses
- Network address (first IP)
- Broadcast address (last IP)
IPv6 Support
The allocator handles IPv6’s 128-bit address space using binary string operations:Prefix Utilization
Query prefix utilization to monitor capacity:IPAM with Resource Manager
Combine IPAM with Resource Manager for automatic allocation (see Resource Manager guide):Best Practices
- Use namespaces: Isolate IP space by tenant, environment, or VRF
- Let reconciliation work: Don’t manually set
parentrelationships - Allocate top-down: Create large prefixes first, then subdivide
- Track assignments: Link IPs to interfaces for visibility
- Monitor utilization: Set alerts at 80% capacity
- Use pools: Automate allocation with Resource Manager pools
- Reserve network IPs: Mark .0 and .255 as reserved
- Document prefixes: Use
descriptionto explain purpose
Common Patterns
Hierarchical Allocation
Multi-Tenant IPAM
Next Steps
- Use Resource Manager for automatic IP allocation
- Organize prefixes with Groups
- Apply IPAM settings with Profiles