Update network settings on devices in a subnet
If you have changed the network settings (DNS servers, default gateway, static routes) of a private subnet that contains devices, you must update the network settings on all devices in the subnet to apply the changes.
Update network settings on a cloud server
If you first change the network settings of a private subnet (DNS servers, default gateway, static routes) and then create 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, on 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 a private subnet, the algorithm for applying new network settings depends on whether the cloud-init or cloudbase-init agent is present in the images the cloud server was created from. Agents are preinstalled in all pre-built images of the cloud platform.
Cloud-init is installed
Cloud-init is not installed
- In the control panel, on the top menu, click Products and select Cloud Servers.
- Open the cloud server page → Ports tab.
- If the Port settings block shows the On server reboot parameter, perform a soft reboot of the server.
- If the Port settings block shows the Manually in the network configuration file parameter, 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 was created from an image with the cloud-init or cloudbase-init agent, but the Port settings block shows the Manually in the network configuration file parameter.
If you later 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
The 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, or 22.04, the ifupdown utility is used for network configuration by default. 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>— cloud server IP address with the mask of the private subnet it is located in. For example,192.168.0.5/29;<gateway>— private subnet default gateway;<destination_subnet_ip_address>— for static routes: IP address of the destination subnet that traffic will be routed to. For example,172.16.0.8;<destination_subnet_netmask>— for static routes: destination subnet mask, for example,29;<next_hop_ip_address>— for static routes: gateway (next-hop) — IP address through which devices in the source subnet will direct 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 change the network settings of a private subnet (DNS servers, default gateway, static routes) and then create Managed Kubernetes cluster nodes in it, all settings on the cluster nodes will be configured automatically.
If you first create Managed Kubernetes cluster nodes and then change the subnet network settings, to apply the settings, sequentially reinstall the nodes.
Update network settings on a Managed Database cluster
If you first change the network settings of a private subnet (DNS servers, default gateway, static routes) and then create a Managed Database 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:
- create a ticket. Specify:
- Managed Database cluster ID. You can copy it in the control panel: in the top menu, click Products → Managed Databases → in the cluster row, click ;
- Project ID. You can copy it in the control panel: in the top menu, click Products → Managed Databases → open the projects menu (the name of the current project) → in the project row, click ;
- pool that contains the subnet;
- the new network settings that need to be applied;
- or recreate the Managed Database cluster; for example, restore it from a backup. See the Restore a cluster (PostgreSQL example) subsection for more details.
Update network settings on a cloud load balancer
If you first change the network settings of a private subnet (DNS servers, default gateway, static routes) and then create 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 balancer instance. All load balancer settings, target groups, and rules will be preserved;
- or create a load balancer from scratch.
Update network settings on File Storage
If you first change the network settings of a private subnet (DNS servers, default gateway, static routes) and then create 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, on the top menu, click Products and select File Storage.
- Open the File Storage page → Settings tab.
- Click Update network settings.