Update network settings on devices in a subnet
If you changed network settings (DNS servers, default gateway, static routes) of a private subnet that contains devices, you need to update network settings on all devices in the subnet to apply the changes.
Update network settings on a cloud server
If you first changed the network settings of a private subnet (DNS servers, default gateway, static routes) and then created cloud servers in it, all settings on the servers will be configured automatically.
If you first create cloud servers and then change the subnet network settings, to apply the settings:
- Check DHCP in the private subnet.
- Apply new network settings on the cloud server.
- Edit the cloud server network configuration files.
1. Check DHCP in the private subnet
- In the Control panel, in the top menu, click Products and select Cloud Servers.
- Go to the Network section → Private networks tab.
- Open the network page → Subnets tab.
- In the subnet card, open the Automatic network settings block.
- Check whether the DHCP server toggle is enabled or disabled.
2. Apply new network settings on the cloud server
If DHCP is enabled
Apply the new network settings depending on the DHCP client:
-
request information from the DHCP server again on the cloud server — new network settings will be added, and the old ones will not be deleted:
dhclient <interface_name>Specify
<interface_name>— interface name, for example,eth0; -
or disable and then enable the port and request information from the DHCP server on the cloud server — new network settings will be added, and the old ones will be deleted:
INTERFACE=<interface_name>; ip link set $INTERFACE down && ip link set $INTERFACE up && dhclient $INTERFACESpecify
<interface_name>— interface name, for example,eth0.
If DHCP is disabled
If DHCP is disabled in the private subnet, the procedure for applying new network settings depends on the presence of the cloud-init or cloudbase-init agent in the images from which the cloud server was created. The agents are pre-installed in all pre-built images of the cloud platform. The agents must be installed if you uploaded an image to the Selectel image storage yourself following the instructions in Prepare an ISO image for working with the cloud platform.
Cloud-init is installed
Cloud-init is not installed
- In the Control panel, in the top menu, click Products and select Cloud Servers.
- Open the cloud server page → Ports tab.
- If the Port configuration block has the On server reboot parameter specified, perform a soft reboot of the server.
- If the Port configuration block has the Manually in the network configuration file parameter specified, edit the network configuration file of the cloud server.
3. Edit the cloud server network configuration file
You need to edit the cloud server network configuration file if DHCP is disabled in the private subnet and:
- the cloud server was created from an image without the cloud-init or cloudbase-init agent;
- the cloud server is created from an image with a cloud-init or cloudbase-init agent, but the Port configuration block has the Manually in the network configuration file parameter specified.
If you subsequently enable DHCP in the private subnet, the network settings specified in the file will stop working — DHCP applies its own settings to all servers.
This is a guide with examples of changing network settings in the network configuration file: DNS servers, default gateway, static routes. Configuration files and network settings may vary depending on the distribution.
Linux
Windows
Configuration depends on the utility installed on the cloud server: ifupdown or netplan. In cloud servers created from pre-built images with Ubuntu 18.04, 20.04, and 22.04 operating systems, the ifupdown utility is used by default for network configuration. You can switch network configuration from ifupdown to netplan.
ifupdown
netplan
-
Open the CLI.
-
If the cloud server was created from an image with cloud-init, network settings will be synchronized, and the previous network settings will be specified after the server reboots. To disable synchronization, turn off network configuration:
echo "network: {config: disabled}" >> /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg -
Open the network configuration file:
nano /etc/network/interfaces.d/50-cloud-init.cfg -
Change network settings:
auto loiface lo inet loopbackdns-nameservers <dns_server_1> <dns_server_2>auto <interface_name>iface <interface_name> inet staticaddress <ip_address>mtu 1500post-up route add default gw <gateway> || truepre-down route del default gw <gateway> || trueup route add -net <destination_subnet_ip_address> netmask <destination_subnet_netmask> gw <next_hop_ip_address>Specify:
<dns_server_1>,<dns_server_2>— private subnet DNS servers;<interface_name>— network interface name;<ip_address>— IP address of the cloud server with the mask of the private subnet where it is located. For example,192.168.0.5/29;<gateway>— default gateway of the private subnet;<destination_subnet_ip_address>— for static routes: IP address of the destination subnet to which traffic will be routed, for example172.16.0.8;<destination_subnet_netmask>— for static routes: mask of the destination subnet, for example29;<next_hop_ip_address>— for static routes: gateway (next-hop) — the IP address through which devices in the source subnet will route traffic to the destination subnet. You can enter any address from the source subnet.
Update network settings on a Managed Kubernetes cluster
If you first changed the network settings of a private subnet (DNS servers, default gateway, static routes) and then created Managed Kubernetes cluster nodes in it, all settings on the cluster nodes will be configured automatically.
If you first created Managed Kubernetes cluster nodes and then changed the network settings of the subnet, reinstall the nodes sequentially to apply the settings.
Update network settings on a Managed Database cluster
If you first changed the network settings of a private subnet (DNS servers, default gateway, static routes) and then created a Managed Databases cluster in it, all settings on the cluster will be configured automatically.
If you first create a Managed Database cluster and then change the subnet network settings, to apply the settings:
- submit a ticket. Specify:
- Managed Databases cluster ID. You can copy it in the Control panel: in the top menu, click Products → Managed Databases → on the cluster line, click ;
- Project ID. You can copy it in the Control panel: in the top menu, click Products → Managed Databases → open the project menu (name of the current project) → on the project line, click ;
- pool where the subnet is located;
- the new network settings that need to be applied;
- or recreate the Managed Databases cluster, for example, restore it from a backup. For more information, see the Restore a cluster (example for PostgreSQL) subsection.
Update network settings on a cloud load balancer
If you first changed the network settings of a private subnet (DNS servers, default gateway, static routes) and then created a cloud load balancer in it, all settings on the load balancer will be configured automatically.
If you first create a cloud load balancer and then change the subnet network settings, to apply the settings:
- recreate the load balancer instance. All load balancer settings, target groups, and rules will be preserved;
- or create the load balancer again.
Update network settings on File Storage
If you first changed the network settings of a private subnet (DNS servers, default gateway, static routes) and then created a file storage in it, all settings on the storage will be configured automatically.
If you first create File Storage and then change the subnet network settings, apply the changes.
- In the Control panel, in the top menu, click Products and select File Storage.
- Open the file storage page → Settings tab.
- Click Update network settings.