Skip to main content

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:

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

1. Check DHCP in the private subnet

  1. In the Control panel, in the top menu, click Products and select Cloud Servers.
  2. Go to the Network section → Private 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 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 $INTERFACE

    Specify <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.

  1. In the Control panel, in the top menu, click Products and select Cloud Servers.
  2. Open the cloud server page → Ports tab.
  3. If the Port configuration block has the On server reboot parameter specified, perform a soft reboot of the server.
  4. 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.

For your information

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.

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.

  1. Connect to the server.

  2. Open the CLI.

  3. 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
  4. View the configuration file name of the netplan utility:

    ls /etc/network/interfaces.d/

    The response will display the configuration file name. For example:

    50-cloud-init.cfg

    Copy the configuration file name.

  5. Open the configuration file of the netplan utility with the vi text editor:

    vi /etc/netplan/<file_name>

    Specify <file_name> — the configuration file name you copied in step 4.

  6. 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> — 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> — default gateway of the private subnet;
    • <destination_subnet_ip_address> — for static routes: destination subnet IP address to which traffic will be routed, 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) — the IP address through which source subnet devices will route traffic to the destination subnet. You can enter any address from the source subnet.
  7. Press ESC.

  8. Exit the vi text editor, saving the changes:

    :wq

Update network settings on a Managed Kubernetes cluster

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

Update network settings on a Managed Databases cluster

If you first changed the network settings of the 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 created a Managed Databases cluster and then changed 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 → 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 project menu (current project name) → in the project row, click ;
    • pool where the subnet is located;
    • new network settings that need to be applied;
  • or recreate the Managed Databases cluster, for example, restore it from a backup. Learn more in the Restore cluster (example for PostgreSQL) section.

Update network settings on a 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 configured automatically.

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

Update network settings on File Storage

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 configured automatically.

If you first created a file storage and then changed the subnet network settings, apply the changes.

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