mcpField
D
devops-network-calculator-for-azure

devops-network-calculator-for-azure

github.com/julianobarbosaCloud & DevOps1466 installsUpdated 2d ago
Repository

About devops-network-calculator-for-azure

An offline Python tool for planning Azure networks, including CIDR sizing, overlap checks, VNet analysis, and AKS networking. It uses only the Python standard library and can produce Terraform-ready output.

Key features

  1. 01Calculate CIDRs and split subnets
  2. 02Analyze VNet utilization and gaps
  3. 03Detect overlaps and Azure constraint violations
  4. 04Find subnet placement with first-fit
  5. 05Plan address allocation across environments
  6. 06Generate Terraform-ready output

Use cases

  1. 01Size a subnet for a host count
  2. 02Check VNet configuration before deployment
  3. 03Plan address space across environments

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/julianobarbosa/claude-code-skills --skill devops-network-calculator-for-azure

After installing, type/devops-network-calculator-for-azurein Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

workflow.md
references/
aks-networking-guide.md
azure-constraints.md
cidr-calculation-guide.md
segmentation-patterns.md
scripts/
network-calc.py
templates/
multi-env-plan.md.tpl
nsg-rules-aks.tfvars.tpl
vnet-layout.tfvars.tpl

Details

From the project README

Azure Network Calculator

Offline Azure network planning tool. Calculates CIDRs, detects overlaps, analyzes VNet utilization, plans AKS networking, and generates Terraform-ready output. Zero external dependencies — uses Python stdlib only.

Quick Start

# What CIDR do I need for 500 hosts?
python3 scripts/network-calc.py calculate --from-hosts 500

# Analyze current VNet
python3 scripts/network-calc.py analyze --from-tfvars terraform/terraform.tfvars

# Validate for overlaps (pre-commit compatible)
python3 scripts/network-calc.py validate --from-tfvars terraform/terraform.tfvars

# Find where to place a new subnet
python3 scripts/network-calc.py first-fit --vnet 10.50.0.0/20 \
  --subnets "10.50.0.0/22,10.50.4.0/22,10.50.8.0/26,10.50.9.0/24" --hosts 500

Commands

CommandPurposeReference
calculateCIDR info, host sizing, subnet splittingCIDR Guide
analyzeVNet utilization, gap analysisCIDR Guide
validateOverlap detection, Azure constraint checksAzure Constraints
first-fitFind optimal placement for new subnetCIDR Guide
plan-multiMulti-environment VNet allocationSegmentation

Project Context

The reference VNet: 10.50.0.0/20 (4,096 IPs, 57.8% utilized)

SubnetCIDRUsable
GatewaySubnet10.50.0.0/221,019
PublicSubnet10.50.4.0/221,019
AzureBastionSubnet10.50.8.0/2659
PrivateSubnet10.50.9.0/24251
Available gaps1,708

Key files: terraform/terraform.tfvars, terraform/networking.tf, terraform/nsg.tf

Azure Quick Reference

  • 5 reserved IPs per subnet (.0, .1, .2, .3, broadcast)
  • Bastion: min /26 | Gateway: min /27 | Firewall: min /26
  • Max subnets/VNet: 3,000 | Max NSG rules: 1,000
  • Full reference: Azure Constraints

Reference Guides

GuideWhen to Read
CIDR Calculation GuideSubnet sizing, gap analysis, overlap detection
AKS Networking GuideCNI comparison, pod/service CIDR, node sizing
Segmentation PatternsDesign patterns, anti-patterns, decision matrices
Azure ConstraintsHard limits, naming rules, reserved addresses

Templates

TemplatePurpose
VNet LayoutTerraform variable blocks for VNet config
AKS NSG RulesNSG rules for AKS workloads
Multi-Env PlanMulti-environment planning output

Execution

Follow the instructions in ./workflow.md.


Gotchas

  • Azure reserves 5 IPs per subnet, not 2: A standard /29 gives you 3 usable IPs, not 6. Sizing AKS node pools with /29 starves scaling and surfaces as InsufficientFreeAddressesInSubnet mid-scale.
  • GatewaySubnet name is literal: Azure refuses VPN Gateway attach unless the subnet is named exactly GatewaySubnet. Same for AzureBastionSubnet and AzureFirewallSubnet. Typo breaks at apply, not plan.
  • AKS Azure CNI eats one subnet IP per pod: A 30-node cluster at 30 pods/node needs 900+ subnet IPs, not 30. Plan --max-pods first; switching CNI later requires cluster rebuild.
  • first-fit picks lowest gap, not smartest: Places a /24 in a /22 gap and leaves fragmented unusable /25 leftovers. For long-lived VNets, use plan-multi and reserve growth gaps explicitly.
  • CIDR overlap with on-prem fails silently until peering: A 10.0.0.0/16 VNet looks fine alone, but ExpressRoute peering black-holes routes overlapping corporate ranges. Validate against full corporate IPAM.
  • NSG rule limit is 1,000 total, not per-direction: Inbound + outbound + default + Azure-auto rules share the budget. Leave headroom or hit a hard wall during scale.

Comments

Markdown supported