Public subnets
A public subnet is a range of public static IP addresses limited by a prefix (mask) size. All devices in a public subnet have a public IP address and access to and from the Internet. You can configure access through a public subnet for a cloud server, cloud load balancer, and Managed Database cluster — more information is available in the instruction Configuring access to and from the Internet.
IP addresses from a public subnet are not processed by a cloud router via 1:1 NAT, but are connected directly to the devices: cloud server, cloud load balancer, Managed Database cluster. Because there is no NAT, this type of device connection to the Internet is more fault-tolerant and faster, but less secure than connecting via a public IP address.
Devices in a public subnet communicate with each other through public interfaces.
A public subnet can only be used within a single project and a single pool.
There are traffic volume limitations within public subnets — throughput. You can view these in the Throughput table.
You can work with public subnets in the control panel or via Terraform.
Public subnet sizes
Public subnets are available in sizes from /29 (five free IPv4 addresses) to /24 (253 free IPv4 addresses). Each public subnet reserves three service IP addresses:
- first IP address — network address;
- second IP address — gateway address;
- last IP address — broadcast address.
The remaining IP addresses can be assigned to devices.
Example for subnet 192.0.2.0/29 — five addresses are available:
- 192.0.2.0 — network address;
- 192.0.2.1 — gateway address;
- 192.0.2.2 — available for use;
- 192.0.2.3 — available for use;
- 192.0.2.4 — available for use;
- 192.0.2.5 — available for use;
- 192.0.2.6 — available for use;
- 192.0.2.7 — broadcast address.
If a public subnet has run out of free IP addresses, you can create a new public subnet.
Automatic public subnet settings
Default settings are specified for public subnets: default gateway and DNS servers. The settings are applied to devices in the subnet automatically.
Default gateway
When creating a public subnet, the second IP address is reserved for the default gateway. The default gateway in a public subnet cannot be changed.
DNS servers
When a public subnet is created, Selectel DNS servers are automatically assigned to the devices in the subnet. You can change the DNS servers when creating a subnet or change them after creation.
Static routes
By default, no static routes are specified for subnets. For public subnets, you can configure static routes.
Create a public subnet
Control panel
- In the Control panel, on the top menu click Products and select Cloud Servers.
- Go to the Network section → Public Networks tab.
- Click Create subnet.
- Select the location where the public subnet will be created.
- Select the subnet size — the range of IP addresses available in the subnet.
- Optional: to change DNS servers, click . Enter one to three values. Click .
- Click Create.
Configure access to a public subnet in different projects
By default, a public subnet can only be used within one project and one pool. You can configure shared access to a public subnet across different projects within the same account. The subnet will still only be available within one pool.
The public subnet will have a Cross-project tag. You will only be able to manage the subnet in the project where it is located.
Control panel
- In the Control panel, on the top menu, click Products and select Cloud Servers.
- Go to the Network section → Public networks tab.
- Copy the ID of the recipient project with which you want to share the subnet. Open the projects menu (the name of the current project) and click in the row of the required project.
- Make sure you are in the project where the subnet is located.
- Open the network card → Projects tab.
- Click Add project.
- Paste the ID of the destination project that you copied in step 3.
- Click .
Change DNS servers in a public subnet
When a public subnet is created, Selectel recursive DNS servers are automatically assigned to the devices in the subnet. You can change the DNS servers when creating a public subnet or for an existing public subnet.
Control panel
OpenStack CLI
- In the Control panel, on the top menu, click Products and select Cloud Servers.
- Go to the Network section → Public networks tab.
- Open the public subnet card → Subnets tab.
- In the subnet row, in the DNS servers column, click .
- Enter from one to three values.
- Click .
Delete a public subnet
Control panel
- In the Control panel, on the top menu, click Products and select Cloud Servers.
- Go to the Network section → Public networks tab.
- In the menu for the public subnet, select Delete subnet.
- Enter the subnet address to confirm deletion.
- Click Delete.