规划适用于 AWS、Azure 或 GCP 的云网络布局。定义子网,获取提供商相关的可用主机数量,并生成可直接运行的 CLI 命令和 Terraform HCL。
| Name | Prefix | AZ | Type | IPv4 CIDR | Total IPs | AWS Usable | Range | |
|---|---|---|---|---|---|---|---|---|
| 10.0.0.0/24 | 256 | 251 | 10.0.0.4 - 10.0.0.254 | |||||
| 10.0.1.0/24 | 256 | 251 | 10.0.1.4 - 10.0.1.254 | |||||
| 10.0.4.0/22 | 1,024 | 1,019 | 10.0.4.4 - 10.0.7.254 | |||||
| 10.0.8.0/22 | 1,024 | 1,019 | 10.0.8.4 - 10.0.11.254 | |||||
| 10.0.12.0/24 | 256 | 251 | 10.0.12.4 - 10.0.12.254 | |||||
| 10.0.13.0/24 | 256 | 251 | 10.0.13.4 - 10.0.13.254 |
AWS reserves 5 IPs per subnet (.0 network, .1 router, .2 DNS, .3 reserved, .255 broadcast)
Free range: 10.0.14.0 – 10.0.255.255
# AWS VPC & Subnet creation -eu-west-1
# Generated by VLANlab (vlanlab.com/cloud/vpc-planner)
aws ec2 create-vpc \
--cidr-block 10.0.0.0/16 \
--region eu-west-1 \
--tag-specifications 'ResourceType=vpc,Tags=[{Key=Name,Value=main-vpc}]'
# Store the VPC ID
VPC_ID=$(aws ec2 describe-vpcs --filters Name=cidr,Values=10.0.0.0/16 --query 'Vpcs[0].VpcId' --output text)
aws ec2 create-subnet \
--vpc-id $VPC_ID \
--cidr-block 10.0.0.0/24 \
--availability-zone eu-west-1a \
--tag-specifications 'ResourceType=subnet,Tags=[{Key=Name,Value=public-a}]'
aws ec2 create-subnet \
--vpc-id $VPC_ID \
--cidr-block 10.0.1.0/24 \
--availability-zone eu-west-1b \
--tag-specifications 'ResourceType=subnet,Tags=[{Key=Name,Value=public-b}]'
aws ec2 create-subnet \
--vpc-id $VPC_ID \
--cidr-block 10.0.4.0/22 \
--availability-zone eu-west-1a \
--tag-specifications 'ResourceType=subnet,Tags=[{Key=Name,Value=private-a}]'
aws ec2 create-subnet \
--vpc-id $VPC_ID \
--cidr-block 10.0.8.0/22 \
--availability-zone eu-west-1b \
--tag-specifications 'ResourceType=subnet,Tags=[{Key=Name,Value=private-b}]'
aws ec2 create-subnet \
--vpc-id $VPC_ID \
--cidr-block 10.0.12.0/24 \
--availability-zone eu-west-1a \
--tag-specifications 'ResourceType=subnet,Tags=[{Key=Name,Value=db-a}]'
aws ec2 create-subnet \
--vpc-id $VPC_ID \
--cidr-block 10.0.13.0/24 \
--availability-zone eu-west-1b \
--tag-specifications 'ResourceType=subnet,Tags=[{Key=Name,Value=db-b}]'
# Internet Gateway (for public subnets)
# aws ec2 create-internet-gateway
# aws ec2 attach-internet-gateway --vpc-id $VPC_ID --internet-gateway-id $IGW_ID
# NAT Gateway (for private subnets outbound traffic)
# aws ec2 create-nat-gateway --subnet-id $PUBLIC_SUBNET_ID --allocation-id $EIP_ID云 VPC 规划器可帮助网络工程师在操作云控制台之前,为 AWS VPC、Azure 虚拟网络和 Google Cloud VPC 设计子网布局。输入您的地址空间,定义跨可用区的子网,即可获得可直接运行的即时 CLI 命令或 Terraform HCL。每个提供商为每个子网预留的 IP 地址数量不同(AWS 和 Azure 预留 5 个,GCP 预留 4 个),因此每个提供商的可用主机数量会自动计算。
为了匹配常见的生产架构,AWS 和 Azure 已预加载标准的三层架构(公有云、私有云和数据库子网,分布在两个可用区)。对于 GCP,子网是区域性的而非区域性的,因此省略了可用区列。输出包含 AWS CLI、Azure CLI、Bicep、gcloud CLI 和 Terraform HCL,因此您可以使用团队已使用的任何 IaC 工具。