Skip to main content

Update network settings on devices in a subnet

Last update:

Если вы изменили сетевые настройки (DNS-серверы, шлюз по умолчанию, статические маршруты) приватной подсети, in которой есть устройства, для применения настроек нужно обновить сетевые настройки on всех устройствах in подсети.

Update network settings on a cloud server

Если сначала вы изменили сетевые настройки приватной подсети (DNS-серверы, шлюз по умолчанию, статические маршруты), а затем создали in ней облачные серверы, все настройки on серверах пропишутся автоматически.

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. Перейдите in раздел Сеть → вкладка Приватные сети.
  3. Откройте страницу сети → вкладка Подсети.
  4. В карточке подсети откройте блок Автоматические сетевые настройки.
  5. Проверьте, включен or выключен тумблер DHCP-сервер.

2. Apply new network settings on the cloud server

If DHCP is enabled

Apply new network settings depending on your DHCP client:

  • re-request information from the DHCP server on the cloud server — new network settings will be added, and the old ones will not be deleted:

    dhclient <interface_name>

    Specify <interface_name> — the interface name, for example eth0;

  • or disable and then enable the port and re-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> — the interface name, for example eth0.

If DHCP is disabled

If DHCP is disabled in a private subnet, the procedure for applying new network settings depends on whether the cloud-init or cloudbase-init agent is present in the images from which the cloud server was created. Agents are preinstalled in all ready-to-use images of the cloud platform. Agents must be installed if you manually uploaded an image to the Selectel image storage following the instructions in Prepare an ISO image for use with the cloud platform.

  1. In the control panel, in the top menu, click Products and select Cloud Servers.
  2. Откройте страницу облачного сервера → вкладка Порты.
  3. If the Port configuration block specifies the On server reboot parameter, perform a soft reboot of the server.
  4. If the Port configuration block specifies the Manually in the network configuration file parameter, edit the cloud server network configuration file.

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;
  • облачный сервер создан из образа with агентом cloud-init or cloudbase-init, но in блоке Настройка портов указан параметр Вручную in файле конфигурации сети.

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 guide provides examples of how to change network settings in the network configuration file: DNS servers, default gateway, and static routes. Configuration files and network settings may vary depending on the distribution.

The configuration depends on the utility installed on the cloud server: ifupdown or netplan. In cloud servers created from ready-to-use images with Ubuntu 18.04, 20.04, and 22.04, 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 is created from an image with cloud-init, network settings will be synchronized using it, and 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 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-серверы приватной подсети;
    • <interface_name> — имя сетевого интерфейса;
    • <ip_address> — IP-адрес облачного сервера with маской приватной подсети, in которой он находится. Например, 192.168.0.5/29;
    • <gateway> — шлюз по умолчанию приватной подсети;
    • <destination_subnet_ip_address> — для статических маршрутов: IP-адрес подсети назначения, in которую будет направляться трафик, например 172.16.0.8;
    • <destination_subnet_netmask> — for static routes: destination subnet mask, for example, 29;
    • <next_hop_ip_address> — для статических маршрутов: шлюз (next-hop) — IP-адрес, через который устройства исходной подсети будут направлять трафик in подсеть назначения. Можно ввести любой адрес из исходной подсети.

Update network settings on a Managed Kubernetes cluster

Если сначала вы изменили сетевые настройки приватной подсети (DNS-серверы, шлюз по умолчанию, статические маршруты), а затем создали in ней ноды кластера Managed Kubernetes, все настройки on нодах кластера пропишутся автоматически.

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

Если сначала вы изменили сетевые настройки приватной подсети (DNS-серверы, шлюз по умолчанию, статические маршруты), а затем создали in ней кластер облачных баз данных, все настройки on кластере пропишутся автоматически.

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 ProductsManaged Databases → in the cluster row, click ;
    • Project ID. You can copy it in the control panel: in the top menu, click ProductsManaged Databases → open the projects menu (the name of the current project) → in the project row, click ;
    • пул, in котором находится подсеть;
    • the new network settings that need to be applied;
  • or пересоздайте кластер облачных баз данных, например восстановите его из резервной копии. Подробнее in подразделе Восстановить кластер (пример для PostgreSQL).

Update network settings on a cloud load balancer

Если сначала вы изменили сетевые настройки приватной подсети (DNS-серверы, шлюз по умолчанию, статические маршруты), а затем создали in ней облачный балансировщик нагрузки, все настройки on балансировщике пропишутся автоматически.

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

Update network settings on file storage

Если сначала вы изменили сетевые настройки приватной подсети (DNS-серверы, шлюз по умолчанию, статические маршруты), а затем создали in ней файловое хранилище, все настройки on хранилище пропишутся автоматически.

If you first create file storage and then change the subnet network settings, apply the changes.

  1. In the control panel, in the top menu, click Products and select File Storage.
  2. Откройте страницу файлового хранилища → вкладка Настройки.
  3. Click Update network settings.