Private subnets and networks
Private networks are L2 segments of the network. At least one private subnet must be created in each private network. Private subnets are ranges of private IP addresses at the L3 level, limited by the CIDR size. If devices are in different private subnets of the same private network, they can communicate directly.
Within different private networks, there can be subnets with the same prefixes (masks), but within the same network, the subnet prefixes must be different. By default, private networks and subnets do not have access to and from the Internet and cannot use public addressing.
To enable private subnets from different networks to communicate, you must connect them to the same cloud router. To organize L3 network connectivity between devices in different pools (including different projects and accounts) or between different services, you must connect private subnets to a global router. The addresses of subnets connected to the same router (cloud or global) must not overlap.
By default, private networks and the subnets belonging to them can only be used within one project and one pool. You can configure private network sharing in different projects within the same account.
Within private subnets there are limits on the amount of traffic — bandwidth. You can see it in the Bandwidth table. The default MTU is 1,500 B, you can change the MTU in the private network.
You can work with private subnets and networks in the control panel, using the OpenStack CLI or Terraform.
Automatic private subnet settings
Private subnets specify default settings: default gateway and DNS servers. If you add a device to an existing subnet, the settings are automatically applied to the device. If you change the settings of a subnet that already has devices, you must update the network settings on all devices in the subnet to apply the settings.
Default gateway
When creating a private subnet, the first available IP address is reserved for the default gateway. For example, for a subnet with CIDR 192.168.0.0/24
, 192.168.0.1
will be reserved as the gateway . The default gateway can be changed when creating a subnet or changed after creation.
DNS servers
When you create a private subnet, Selectel DNS servers are automatically assigned to the devices in the subnet. DNS servers can be changed when creating a subnet or can be changed after the subnet is created.
Static routes
By default, subnets do not have static routes specified. Static routes can be configured for private subnets.
Create a private network
Control panel
OpenStack CLI
- In the Dashboard, on the top menu, click Products and select Cloud Servers.
- Go to Network → Private Networks tab.
- Click Create Network.
- Select the pool where the private network will be created.
- Enter the name of the network.
- Optional: enter a comment for the network.
- Enter the subnet's CIDR, which is the range of IP addresses available on the subnet.
- Optional: To change the IP address of the default gateway, click . Enter a value. Click .
- Optional: To change the DNS servers, click . Enter one to three values. Click .
- Optional: To enable DHCP, check the Enable DHCP checkbox.
- Optional: To add another subnet, click Add Subnet and repeat steps 7-10.
- Click Create.
-
Create a private network:
openstack network create <network_name>
Specify
<network_name>
is the name of the private network.
Add a subnet to a private network
Control panel
OpenStack CLI
- In the Dashboard, on the top menu, click Products and select Cloud Servers.
- Go to Network → Private Networks tab.
- Open the Network page → Subnets tab.
- Click Create Subnet.
- Enter the subnet's CIDR, which is the range of IP addresses available on the subnet.
- Optional: Change the IP address of the default gateway.
- Optional: Change the DNS servers. Enter one to three values.
- Optional: To enable DHCP, check the Enable DHCP checkbox.
- Click .
-
Create a subnet on the private network:
openstack subnet create \
--subnet-range <cidr> \
[--dhcp | --no-dhcp] \
--gateway <gateway> \
--network <network> \
<subnet_name>Specify:
<cidr>
— CIDR of a private subnet, e.g.192.168.0.0/24
;- DHCP option:
--dhcp
— enable DHCP;--no-dhcp
— disable DHCP;
<gateway>
— IP address default gateway for example192.168.0.2
;<network>
— The ID or name of the private network can be viewed with the commandopenstack network list
;<subnet_name>
— name of the private subnet.
Configure private network access in different projects
By default, a private network can only be shared within one project and one pool. You can configure the private network to be shared between different projects within the same account. The network will also be available only within one pool.
A private network will have the CrossProject tag. The network can only be managed in the project in which the subnet is located.
If you need to combine private networks from different pools (including those in different projects and accounts), connect the private network to a global router.
Control panel
- In the dashboard, on the top menu, click Products and select Cloud Servers.
- Go to Network → Private Networks