Subnets
In this article:
Subnets#
General information#
Networking in K2 Cloud features the following properties:
there is L2 + L3 connectivity between instances;
connects to the Internet via the NAT gateway (this cannot be disabled at the moment);
IP addresses are automatically associated with instances according to the selected address block via DHCP protocol;
security groups can be set on network interfaces of instances in VPC;
network ACLs can be set for subnets;
there is IP-connectivity with other subnets in the same VPC;
any network interface, except for the primary one, can be detached from an instance;
external data center networks can be attached.
Instances you create in K2 Cloud can be attached to a subnet and/or to a virtual switch, which is available in one of the availability zones (AZ).
If your project was created after 16.06.2020, you do not need to input specific subnet in web interface or API when creating VM instance in VPC because this instance will be started in default subnet. Default subnets exist in each availability zone. if necessary, you can select default subnet in any availability zone or create subnet yourself.
If you want to start VM instances in default VPC without specifying particular subnet in projects created before 16.06.2020, then create a default subnet. When creating a default subnet, the cloud will assign the first available CIDR block of /20 size to this subnet.
Creating a new subnet#
To create a subnet, go to Virtual machines Networking Subnets and click Create. Alternatively, click the arrow next to the Create button and select Create a new subnet.
In the dialog window for creating a new subnet, select the VPC in which you want to create a subnet, and enter the subnet address.
Important
You must specify an IP-address for a new subnet from the CIDR block of your VPC. Subnet IP-address must be specified in CIDR notation (<subnet address>/<subnet prefix>). Subnet prefix can take values of the same range as VPC CIDR block prefix (from 16 to 28).
Optionally, you can supply AZ, in which the subnet should be created. If you don’t specify an AZ, the cloud will choose one automatically. It is impossible to predict which AZ will be elected by the cloud – consistency of choice is not guaranteed.
You can also right away set the Name tag for the subnet you create. If you need to set additional tags, go to the next step by clicking Add tags. If the Name tag has not been set, you can do this by clicking Add Name tag. To assign an arbitrary tag, click Add tag. Specify the tag key and value.
After setting all the required parameters, click Create subnet.
In the Subnets subsection and on the specific subnet page, you can view which ACL and route table are associated with a subnet, as well as go to the list of instances attached to this subnet.
The first four IP addresses and the last IP address in each subnet CIDR block aren’t available for you to use, and can’t be assigned to an instance. For example, in a 10.0.0.0/24
subnet the first IP address available for you to use is 10.0.0.4
, and 10.0.0.0 — 10.0.0.3
and 10.0.0.255
are reserved by K2 Cloud for technical and future use.
Creating a default subnet#
Since 16.06.2020, default subnets are created automatically along with the default VPC in each availability zone. It may be required to create a default subnet if you deleted it or if your project was created before 16.06.2020
To create a default subnet in a default VPC, go to Virtual machines Networking Subnets, click the arrow next to the Create button, and select Create a new default subnet. In the dialog window, select the availability zone where you want to create the default subnet. Only those availability zones can be selected that do not have a default subnet.
Important
Only one default subnet can be created in a single availability zone.
A default subnet can only be created in default VPC.
You cannot specify CIDR block yourself. When creating a default subnet, the first available CIDR block of /20 size is assigned to this subnet.
Subnet association with a route table#
To associate a subnet with a route table, go to Virtual machines Networking Subnets, select a subnet from the list and click Associate with route table. In the dialog window, select the route table to associate the subnet with and confirm the action. Alternatively, go to the subnet page and edit the Route table field. A subnet can only be associated with one route table at a time.
Important
This operation will change traffic routing in the subnet according to the rules of the specified route table.
Associating with a network ACL#
To assign an ACL to a subnet, go to Virtual machines Networking Subnets, select a subnet from the list and click Assign ACL. In the dialog window, select the ACL to be assigned to the subnet and confirm the action. Alternatively, go to the subnet page and edit the ACL field.
Important
You can associate no more than 200 subnets with a network ACL in a VPC.
Deleting a subnet#
Note
You can delete a subnet if it doesn’t contain any instances, network interfaces or external networks.
Go to Virtual machines Networking Subnets, select the subnet from the list and click Delete. The subnet will be deleted after confirmation.
Also, you can delete a subnet on its page. To do this, go to the Information tab, click Delete and confirm the action.
Subnet information#
For general information about existing subnets, see the Subnets subsection. To view the list of all subnets in the project, select All VPC in the VPC filter. To display subnets of a particular VPC, select the desired VPC in the filter.
To view detailed information about a particular subnet, go to Virtual machines Networking Subnets and select the desired subnet from the list. To facilitate the subnet search, select its relevant VPC in the VPC filter or use the search function.
Once you have selected the desired subnet, click its ID. In addition to information about the subnet itself, the subnet page provides details of its attached instances, created interfaces, and assigned tags.
In the Information tab, you can view:
subnet CIDR and the number of free IP addresses;
VPC and availability zone in which the subnet is located;
the number of attached instances and network interfaces;
assigned ACL and associated route table, as well as other parameters.
Here, you can delete a subnet.
The Subnet tab displays a list of instances attached to the subnet.
The Network Interfaces tab displays a list of network interfaces created in the subnet. For more information on network interface operations, please see Network Interfaces.
In the Tags tab, you can view tags assigned to the subnet. Here, you can also add,change and delete tags of the subnet.