Skip to main content
Update network settings on devices in the subnetwork
Last update:

Update network settings on devices in the subnetwork

If you changed the network settings (DNS servers, default gateway, static routes) of a private subnet that has devices on it, you must update the network settings on all devices on the subnet to apply the settings.

Update network settings on the 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 automatically assigned.

If you first created the cloud servers and then changed the subnet network settings to apply the settings:

  1. Check DHCP on the private subnet.
  2. Apply the new network settings on the cloud server.
  3. Modify the cloud server network configuration files.

1. Check DHCP on the private subnet

  1. In the Control panel, on the top menu, click Products and select Cloud Servers.
  2. Go to NetworkPrivate Networks tab.
  3. Open the Network page → Subnets tab.
  4. In the subnet card, open the Automatic Network Settings block.
  5. Check whether the DHCP server toggle switch is on or off.

2. 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 without deleting the old ones:

    dhclient <interface_name>

    Specify <interface_name> is the interface name, for example 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> is the interface name, for example 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. Agents are pre-installed in all pre-built cloud platform images. Agents must be installed if you uploaded an image to the Selectel image repository using the Prepare an ISO image to work with the cloud platform instructions.

  1. In the dashboard, on the top menu, click Products and select Cloud Servers.
  2. Open the Cloud Server page → Ports tab.
  3. If the When Restarting Server option is specified in the Port Setup block, perform a programmatic reboot of the server.
  4. If the Port Configuration block specifies Manual in the network configuration file, modify the cloud server network configuration file.

3. 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;
  • The cloud server is created from a cloud-init or cloudbase-init agent image, but the Port Configuration block specifies the Manual option in the network configuration file.

If you later enable DHCP on a private subnet, the network settings specified in the file will no longer work — DHCP applies its own settings to all servers.

For your information

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.

The configuration depends on the utility that is installed on the cloud server: ifupdown or netplan. In cloud servers created from off-the-shelf images running Ubuntu 18.04, 20.04, and 22.04, the default utility for network configuration is ifupdown. You can switch the network configuration from ifupdown to netplan.

  1. Connect to the server.

  2. Open the CLI.

  3. 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
  4. Open the network configuration file:

    nano /etc/network/interfaces.d/50-cloud-init.cfg
  5. 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 of the private subnet;
    • <interface_name> — name of the network interface;
    • <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: destination subnet mask, for example, 29;
    • <next_hop_ip_address> — for static routes: next-hop is the IP address through which devices on the source subnet will forward traffic to the destination subnet. You can enter any address from the source subnet.

Update network settings on the Managed Kubernetes cluster

If you first change 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 subnet network settings, reinstall the nodes sequentially to apply the settings.

Update network settings on the cloud database cluster

If you first change the network settings of a private subnet (DNS servers, default gateway, static routes) and then create a cloud database cluster in it, all settings on the cluster are automatically prescribed.

If you first create a cloud database cluster and then change the network subnet settings. to apply the settings:

  • create a ticket.. Specify:
    • Cloud database cluster ID. You can copy in the control panel: in the top menu, click ProductsCloud Databases → in the cluster row, click ;
    • Project ID. You can copy in the control panel: in the top menu, click ProductsCloud Databases → open the projects menu (the name of the current project) → in the project line, click ;
    • pool in which the subnet is located;
    • new network settings to be applied;
  • or recreate the cloud database cluster, for example, restore it from a backup. See Restore a cluster (example for PostgreSQL) for details.

Update network settings on the 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 on it, all settings on the load balancer will be automatically prescribed.

If you first created the cloud load balancer and then changed the network subnet settings to apply the settings:

Update the network settings on the file store

If you first change the network settings of a private subnet (DNS servers, default gateway, static routes) and then create a file storage in it, all the 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.

  1. In the Control Panel, on the top menu, click Products and select File Storage.
  2. Open the File Storage page → Settings tab.
  3. Click Update network settings.