A comprehensive IP subnet calculator and Infrastructure-as-Code (IaC) generator with both web interface and command-line interface (CLI) support for multiple cloud providers.
- Multi-Cloud Support: Azure, AWS, GCP, Oracle Cloud, Alibaba Cloud, and On-Premises
- Visual IP Calculation: Real-time subnet calculations with detailed network information
- IaC Code Generation: Generate ready-to-use Infrastructure-as-Code templates
- Azure: CLI, Terraform, Bicep, ARM, PowerShell
- AWS: CLI, Terraform, CloudFormation
- GCP: gcloud CLI, Terraform
- Oracle: OCI CLI, Terraform
- Alibaba Cloud: Aliyun CLI, Terraform
- Binary View: Display IP addresses in binary format (collapsible)
- Responsive UI: Modern, clean interface built with Vue.js and Vuetify
- Cloud-Specific Calculations: Respects reserved IPs and subnet size limits for each cloud provider
- Automated Testing: Generate IaC code for CI/CD pipelines
- Batch Processing: Create infrastructure code for multiple environments
- File Output: Save generated code directly to files
- Scriptable: Perfect for automation and testing workflows
- Vue.js 3 - Progressive JavaScript framework
- TypeScript - Type-safe JavaScript
- Vite - Fast build tool and development server
- Vuetify - Material Design component framework
- NGINX - Production web server
- tsx - TypeScript execution engine for CLI
- Node.js 18 or higher
- npm or yarn
- NGINX (for production deployment)
- Clone the repository:
git clone <repository-url>
cd ipcalc- Install dependencies:
npm install- Start the development server:
npm run dev- Open your browser at
http://localhost:5173(or the port shown in terminal)
Build the application for production:
npm run buildThe built files will be in the dist/ directory.
- Select Cloud Provider: Choose from Azure, AWS, GCP, Oracle, Alibaba Cloud, or On-Premises
- Enter Network CIDR: Input your network address (e.g.,
10.0.0.0/16) - Set Number of Subnets: Specify how many subnets to create (1-256)
- View Results: See detailed subnet information including:
- Network addresses
- Subnet masks
- Total and usable IP counts
- Reserved IPs
- Usable IP ranges
- Availability zones/regions
- Generate Code: Click on CLI, Terraform, or other format buttons to generate IaC code
- Copy Code: Use the copy button to copy generated code to clipboard
npm run cli -- --helpDisplay detailed subnet calculations:
# Azure
npm run cli -- --provider azure --cidr 10.0.0.0/16 --subnets 4
# AWS
npm run cli -- --provider aws --cidr 10.0.0.0/16 --subnets 3
# GCP
npm run cli -- --provider gcp --cidr 10.128.0.0/20 --subnets 2# Azure Terraform
npm run cli -- --provider azure --cidr 10.0.0.0/16 --subnets 2 --output terraform
# AWS Terraform
npm run cli -- --provider aws --cidr 10.0.0.0/16 --subnets 3 --output terraform
# GCP Terraform
npm run cli -- --provider gcp --cidr 10.128.0.0/20 --subnets 2 --output terraform# Azure CLI script
npm run cli -- --provider azure --cidr 10.0.0.0/16 --subnets 2 --output cli --file azure-deploy.sh
# AWS CLI script
npm run cli -- --provider aws --cidr 10.0.0.0/16 --subnets 3 --output cli --file aws-deploy.sh
# GCP gcloud script
npm run cli -- --provider gcp --cidr 10.128.0.0/20 --subnets 2 --output gcloud --file gcp-deploy.sh
# Oracle OCI CLI script
npm run cli -- --provider oracle --cidr 10.0.0.0/20 --subnets 4 --output oci --file oracle-deploy.sh
# AliCloud Aliyun CLI script
npm run cli -- --provider alicloud --cidr 172.16.0.0/12 --subnets 3 --output aliyun --file alicloud-deploy.sh# Azure Bicep
npm run cli -- --provider azure --cidr 10.0.0.0/16 --subnets 2 --output bicep --file main.bicep
# Azure ARM Template
npm run cli -- --provider azure --cidr 10.0.0.0/16 --subnets 2 --output arm --file template.json
# Azure PowerShell
npm run cli -- --provider azure --cidr 10.0.0.0/16 --subnets 2 --output powershell --file deploy.ps1
# AWS CloudFormation
npm run cli -- --provider aws --cidr 10.0.0.0/16 --subnets 3 --output cloudformation --file stack.yaml--provider <name>- Cloud provider:azure,aws,gcp,oracle,alicloud,onpremises--cidr <cidr>- Network CIDR notation (e.g.,10.0.0.0/16)--subnets <count>- Number of subnets to create (1-256)
--output <type>- Output format (default:info)--file <path>- Write output to file instead of stdout--help- Show help message
Generate IaC code and validate before deployment:
npm run cli -- --provider aws --cidr 10.0.0.0/16 --subnets 3 --output terraform --file test.tf
terraform validate test.tf#!/bin/bash
# Generate infrastructure for different environments
for env in dev staging prod; do
npm run cli -- \
--provider aws \
--cidr 10.${env}.0.0/16 \
--subnets 3 \
--output terraform \
--file ${env}-infrastructure.tf
done# Generate network documentation for all providers
npm run cli -- --provider azure --cidr 10.0.0.0/16 --subnets 4 > docs/azure-network.txt
npm run cli -- --provider aws --cidr 10.0.0.0/16 --subnets 3 > docs/aws-network.txt# Compare subnet allocations across different cloud providers
for provider in azure aws gcp oracle alicloud; do
echo "=== $provider ===" >> comparison.txt
npm run cli -- --provider $provider --cidr 10.0.0.0/16 --subnets 4 >> comparison.txt
doneFor more detailed CLI documentation, see CLI.md.
- Reserved IPs: 5 per subnet (first 4 + last 1)
- Minimum Subnet: /29 (8 IPs, 3 usable)
- VNet CIDR Range: /8 to /29
- Outputs: CLI, Terraform, Bicep, ARM, PowerShell
- Reserved IPs: 5 per subnet (first 4 + last 1)
- Minimum Subnet: /28 (16 IPs, 11 usable)
- VPC CIDR Range: /16 to /28
- Availability Zones: Subnets distributed across AZs
- Outputs: CLI, Terraform, CloudFormation
- Reserved IPs: 4 per subnet (first 2 + last 2)
- Minimum Subnet: /29 (8 IPs, 4 usable)
- VPC: Global (subnets are regional)
- Outputs: gcloud CLI, Terraform
- Reserved IPs: 3 per subnet (first 2 + last 1)
- Minimum Subnet: /30 (4 IPs, 1 usable)
- VCN CIDR Range: /16 to /30
- Outputs: OCI CLI, Terraform
- Reserved IPs: 6 per subnet (first 3 + last 3)
- Minimum Subnet: /29 (8 IPs, 2 usable)
- VPC CIDR Range: /8 to /29
- Outputs: Aliyun CLI, Terraform
- Reserved IPs: 2 (network address + broadcast)
- Standard IP Calculations: Classic subnet calculations
- Outputs: Network information only
- Build the application:
npm run build- Copy the built files to your NGINX web root:
sudo cp -r dist/* /usr/share/nginx/html/- Copy the NGINX configuration:
sudo cp nginx.conf /etc/nginx/conf.d/ipcalc.conf- Restart NGINX:
sudo systemctl restart nginx- Access the application at
http://localhost
Create a Dockerfile:
FROM node:18 AS build
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
FROM nginx:alpine
COPY --from=build /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]Build and run:
docker build -t ipcalc .
docker run -p 80:80 ipcalcipcalc/
├── src/
│ ├── cli/
│ │ ├── index.ts # CLI entry point
│ │ ├── ipCalculator.ts # Core IP calculation logic
│ │ └── templateLoaderNode.ts # Node.js template loader
│ ├── components/
│ │ ├── AzureCalculator.vue # Azure calculator component
│ │ ├── AwsCalculator.vue # AWS calculator component
│ │ ├── GcpCalculator.vue # GCP calculator component
│ │ ├── OracleCalculator.vue # Oracle calculator component
│ │ ├── AliCloudCalculator.vue # AliCloud calculator component
│ │ └── OnPremisesCalculator.vue # On-Premises calculator
│ ├── config/
│ │ ├── cloudProviderConfig.ts # Cloud provider configurations
│ │ └── cloudThemes.ts # UI themes for each provider
│ ├── templates/
│ │ ├── azure/ # Azure IaC templates
│ │ ├── aws/ # AWS IaC templates
│ │ ├── gcp/ # GCP IaC templates
│ │ ├── oracle/ # Oracle IaC templates
│ │ └── alicloud/ # AliCloud IaC templates
│ ├── utils/
│ │ └── templateLoader.ts # Template loader for web UI
│ ├── App.vue # Main application component
│ └── main.ts # Application entry point
├── bin/
│ └── ipcalc.js # CLI executable wrapper
├── dist/ # Production build output
├── index.html # HTML entry point
├── nginx.conf # NGINX configuration
├── package.json # Project dependencies
├── tsconfig.json # TypeScript configuration
├── vite.config.ts # Vite build configuration
├── README.md # This file
└── CLI.md # Detailed CLI documentation
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production build locallynpm run typecheck- Run TypeScript type checkingnpm run cli- Run CLI tool (add-- --helpfor CLI help)
- Add configuration to
src/config/cloudProviderConfig.ts - Add theme to
src/config/cloudThemes.ts - Create Vue component in
src/components/ - Create template directory in
src/templates/ - Add template loader functions to
src/utils/templateLoader.ts(for web UI) - Add template loader functions to
src/cli/templateLoaderNode.ts(for CLI) - Update CLI in
src/cli/index.tsto support the new provider
# Test CLI with all providers
for provider in azure aws gcp oracle alicloud; do
npm run cli -- --provider $provider --cidr 10.0.0.0/16 --subnets 2
doneContributions are welcome! Please feel free to submit a Pull Request.
MIT
For detailed CLI documentation, see CLI.md.
For issues and feature requests, please open an issue on GitHub.