Configure subnets
A subnet is a range of IP addresses within a Virtual Private Cloud (VPC). This guide shows you how to create, view, and delete subnets using the evroc CLI.
Prerequisites
Section titled “Prerequisites”- Access to an evroc organization and project.
- evroc CLI installed and configured.
- A VPC in your project (see Configure VPCs).
View subnets
Section titled “View subnets”List all subnets in your project:
evroc networking subnet listView details of a specific subnet:
evroc networking subnet get my-subnetThe output shows the subnet’s stack type, IPv4 and IPv6 CIDR blocks, and parent VPC.
Create a subnet
Section titled “Create a subnet”When you create a subnet, you must specify its stack type, zone, and (for dual-stack subnets) its IPv4 CIDR block.
Create a dual-stack subnet
Section titled “Create a dual-stack subnet”A dual-stack subnet supports both IPv4 and IPv6 addresses. You must specify the IPv4 CIDR block.
evroc networking subnet create my-subnet \ --vpc=my-vpc \ --zone=se-sto-a \ --stack-type=dual-stack \ --ipv4-cidr-block=10.0.99.0/24The subnet is created with:
- The specified IPv4 CIDR block.
- A
/64IPv6 CIDR block allocated automatically from the parent VPC’s IPv6 range.
Create an IPv6-only subnet
Section titled “Create an IPv6-only subnet”An IPv6-only subnet has no IPv4 CIDR block. All VMs in this subnet must also be IPv6-only.
evroc networking subnet create my-subnet \ --vpc=my-vpc \ --zone=se-sto-a \ --stack-type=ipv6-onlyThe subnet receives a /64 IPv6 CIDR block allocated automatically from the parent VPC’s IPv6 range.
Subnet CIDR constraints
Section titled “Subnet CIDR constraints”IPv4 CIDR blocks for subnets must follow these rules:
- The subnet CIDR must be within the parent VPC’s IPv4 CIDR block
- The subnet size can be between
/16and/29 - Subnet CIDRs within the same VPC must not overlap
For example, if your VPC has 10.0.0.0/16, valid subnet CIDRs include 10.0.1.0/24, 10.0.2.0/24, and 10.0.3.0/29.
Delete a subnet
Section titled “Delete a subnet”Delete a subnet that has no VMs:
evroc networking subnet delete my-subnetImportant: You can’t delete a subnet that contains VMs. Delete or move all VMs from the subnet first.
Understanding VM IP addresses
Section titled “Understanding VM IP addresses”When you create a VM, it’s automatically assigned an IP address from the subnet in its zone. For example, a VM using the subnet default-se-sto-a gets an IP from 10.0.1.0/24. You can view a VM’s IP addresses using the VM get command:
evroc compute virtualmachine get myvmLook for the privateIPv4Address and ipv6Address fields in the output.
Next steps
Section titled “Next steps”- Understand IPv6 networking
- Configure Public IPs to enable inbound internet access
- Configure Security Groups to control network traffic