Update network settings on devices in the subnetwork
If you have changed the network settings (DNS servers, default gateway, static routes) private subnet that has devices on it, you must update the network settings on all devices in the subnet to apply the settings.
Update network settings on the cloud server
If you first changed the network settings of the private subnet (DNS servers, default gateway, static routes), and then created cloud servers in it, all settings on the servers will be automatically prescribed.
If you first created the cloud servers and then changed the subnet network settings to apply the settings:
- Check DHCP on the private subnet.
- Apply the new network settings on the cloud server.
- Modify the cloud server network configuration files.
Check DHCP on the private subnet
- В control panels go to Cloud platform → Network.
- Open the tab Private networks.
- Open the network page → tab Subnetworks.
- Open the block Automatic network settings.
- Check whether the toggle switch is on or off DHCP server.
Apply the new network settings to the cloud server
If DHCP is enabled
Apply the new network settings depending on the DHCP client:
-
re-request information from the DHCP server on the cloud server — the new network settings will be added, but the old ones will not be deleted:
dhclient <interface_name>
Specify
<interface_name>
— interface name, e.g.eth0
; -
or turn off, then turn on the port and re-request information from the DHCP server on the cloud server — the new network settings will be added, while the old ones will be deleted:
INTERFACE=<interface_name>; ip link set $INTERFACE down && ip link set $INTERFACE up && dhclient $INTERFACE
Specify
<interface_name>
— interface name, e.g.eth0
.
If DHCP is turned off
If DHCP is disabled on the private subnet, the algorithm for applying new network settings depends on the presence of a cloud-init or cloudbase-init agent in the images from which the cloud server is created. The agents are pre-installed in all ready-made images cloud platform. Agents must be installed if you uploaded an image to the Selectel image repository on your own following the instructions below Prepare ISO image to work with the cloud platform.
Cloud-init is installed
Cloud-init is not installed
- В control panels go to Cloud platform → Servers.
- Open the cloud server page → tab Ports.
- If in the block Configuring ports parameter When the server reboots, perform a hardware reboot of the server.
- If in the block Configuring ports parameter Manually in the network configuration file, modify the network configuration file of the cloud server.
Modify the network configuration file of the cloud server.
modify the cloud server network configuration file
You must modify the cloud server network configuration file if DHCP is disabled on the private subnet and:
- cloud server is created from an image without cloud-init or cloudbase-init agent;
- cloud server is created from an image with cloud-init or cloudbase-init agent, but in block Configuring ports parameter Manually in the network configuration file.
If, in the future. enable DHCP on a private subnet, then the network settings specified in the file will not work — DHCP applies its own settings to all servers.
These are instructions with examples of changing network settings in the network configuration file: DNS servers, default gateway, static routes. Configuration files and network settings may vary from distribution to distribution.
Linux
Windows
The configuration depends on the utility that is installed on the cloud server: ifupdown or netplan. In cloud servers created from ready-made images with the Ubuntu 18.04, 20.04, and 22.04 operating systems, by default the ifupdown utility is used to configure the network. You can switch the network configuration from ifupdown to netplan.
ifupdown
netplan
-
Open the CLI.
-
If the cloud server is created from a cloud-init image, the network settings will be synchronized with it and the previous network settings will be specified after the server restarts. To disable synchronization, disable 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 the network settings:
auto lo
iface lo inet loopback
dns-nameservers <dns_server_1> <dns_server_2>
auto <interface_name>
iface <interface_name> inet static
address <ip_address>
mtu 1500
post-up route add default gw <gateway> || true
pre-down route del default gw <gateway> || true
up route add -net <destination_subnet_ip_address> netmask <destination_subnet_netmask> gw <next_hop_ip_address>Specify:
<dns_server_1>
,<dns_server_2>
— DNS servers on the private subnet;<interface_name>
— network interface name;<ip_address>
— The IP address of the cloud server with the private subnet mask in which it resides. For example,192.168.0.5/29
;<gateway>
— default gateway of the private subnet;<destination_subnet_ip_address>
— for static routes: the IP address of the destination subnet to which traffic will be routed, e.g.172.16.0.8
;<destination_subnet_netmask>
— for static routes: the destination subnet mask, for example,29
;<next_hop_ip_address>
— for static routes: next-hop — the IP address through which devices on the source subnet will route traffic to the destination subnet. You can enter any address from the source subnet.
-
Open the CLI.
-
Open the network configuration file:
nano /etc/netplan/config.yaml
-
Change the network settings:
network:
version: 2
renderer: networkd
ethernets:
<interface_name>:
addresses:
- <ip_address>
nameservers:
addresses: [<dns_server_1>, <dns_server_2>]
routes:
- to: default
via: <gateway>
- to: <destination_subnet>
via: <next_hop_ip_address>Specify:
<interface_name>
— network interface name;<ip_address>
— The IP address of the cloud server with the private subnet mask in which it resides. For example,192.168.0.5/29
;<dns_server_1>
,<dns_server_2>
— DNS servers on the private subnet;<gateway>
— default gateway of the private subnet;<destination_subnet>
— for static routes: the CIDR of the destination subnet to which the traffic will be routed, e.g.172.16.0.8/29
;<next_hop_ip_address>
— for static routes: next-hop — the IP address through which devices on the source subnet will route traffic to the destination subnet. You can enter any address from the source subnet.
-
Check the syntax of the file:
sudo netplan try
-
Apply the settings:
sudo netplan apply
-
Configure a static route:
route -p ADD <destination_subnet_ip_address> \
MASK <destination_subnet_netmask> <next_hop_ip_address> \
METRIC <priority>Specify:
<destination_subnet_ip_address>
— The IP address of the destination subnet to which the traffic will be routed, e.g.172.16.0.8
;<destination_subnet_netmask>
— destination subnet mask, for example,29
;<next_hop_ip_address>
— gateway (next-hop) — The IP address through which devices on the source subnet will route traffic to the destination subnet. You can enter any address from the source subnet;<priority>
— an integer that specifies the priority of the specified gateway. For example,1
— highest priority.
Update network settings on the Managed Kubernetes cluster
If you first changed the network settings of the private subnet (DNS servers, default gateway, static routes) and then create Managed Kubernetes cluster nodes in it, all the settings on the cluster nodes will be written automatically.
If you first created the Managed Kubernetes cluster nodes and then changed the network subnet settings, to apply the settings sequentially shut down all nodes in the cluster и turn them on.
Update network settings on the cloud database cluster
If you first changed the network settings of the private subnet (DNS servers, default gateway, static routes), and then created a cloud database cluster in it, all settings on the cluster will be prescribed automatically.
If you first create a cloud database cluster and then change the network subnet settings. to apply the settings:
- file a ticket. Specify:
- Cloud database cluster ID. You can copy it to control panels: under Cloud platform → Databases → in the row of the desired cluster, click ;
- Project ID. Can be copied to control panels: go to the section Cloud platform → open the project menu (name of the current project) → in the line of the desired project, click ;
- pool where the subnet is located;
- new network settings to be applied;
- or recreate the cloud database cluster, such as restoring it from a backup. For more information, see the subsection Restore a cluster (example for PostgreSQL).
Update network settings on the cloud load balancer
If you first changed the network settings of the 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 automatically prescribed.
If you first created a cloud load balancer and then change the network subnet settings, perform a failover of the load balancer instance to apply the settings. To do this:
- file a ticket. Specify:
- Load balancer ID. You can copy it to control panels: under Cloud platform → Balancers → tab Balancers → in the card of the desired load balancer, click ;
- Project ID. Can be copied to control panels: go to the section Cloud platform → open the project menu (name of the current project) → in the line of the desired project, click ;
- pool where the subnet is located;
- new network settings to be applied;
- the desired time to apply the changes;
- or create a load balancer all over again.
Update the network settings on the file store
If you first changed the network settings of the private subnet (DNS servers, default gateway, static routes), and then created a file storage in it, all settings on the storage will be written automatically.
If you created the file storage first and then changed the network subnet settings, apply the changes.
- В control panels go to Cloud platform → File storage.
- Open the file storage page → tab Settings.
- Click Update network settings.