---
title: "Change network settings on a dedicated server"
sidebar_label: "Change network settings on a server"
sidebar_position: 3
description: "How to change network settings on a server in Rescue and WinPE recovery and diagnostic modes"
---

import Formbricks from '@theme/MDXComponents/Formbricks'
import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'
import EditIcon from '@selectel/docux/icons/edit'
import {TabItemLabel} from '@selectel/docux/components'

# Change network settings on a dedicated server

## Change network settings via Rescue \{#change-network-settings-via-rescue}

<Tabs queryString="change-network-settings-via-rescue">
  <TabItem value="ubuntu" default>
    <TabItemLabel>
      Ubuntu
    </TabItemLabel>

    1. [Boot the server in Rescue recovery and diagnostic mode](/dedicated/troubleshooting/boot-to-recovery.mdx).

    2. [Mount the OS file system](/dedicated/troubleshooting/mount-file-system.mdx).

    3. Open the `netplan` utility configuration file with the `vi`` text editor`:

       ```bash
       vi /etc/netplan/<netcfg>
       ```

       Specify `<netcfg>` — the name of the `netplan` utility configuration file, for example `50-cloud-init.yaml` or `01-netcfg.yaml`.

    4. For the required interface, change the `addresses` and `gateway4` values to the new IP address and gateway.

       The configuration file is written in YAML, which is sensitive to indentation and spaces. Fill it out by following the pattern used previously.

       <details>
         <summary>Configuration file example</summary>

         ```bash
         network:
             version: 2
             renderer: networkd
             ethernets:
                 eth0:
                     dhcp4: no
                     addresses: [178.132.202.35/28]
                     gateway4: 178.132.202.33
                     nameservers:
                         addresses: [188.93.16.19, 188.93.17.19]
         ```

         Where:

         * `eth0` — name of the network interface;
         * `addresses: [178.132.202.35/28]` — server IP address with subnet mask;
         * `gateway4: 178.132.202.33` — subnet gateway.
       </details>

    5. Press **ESC**.

    6. Exit the `vi` text editor with your changes saved:

       ```bash
       :wq
       ```

    7. Check the configuration file for errors and apply the configuration:

       ```bash
       netplan --debug generate
       netplan apply
       ```

    8. In the [control panel](https://my.selectel.ru/servers/), on the top menu, click **Products** and select **Dedicated Servers**.

    9. In the **Servers** section, open the server page → **Ports** tab.

    10. In the Internet portal line, click <EditIcon />.

    11. In the **VLAN** field, replace the **General** value with the dedicated VLAN value. You can view the dedicated subnet VLAN in the [control panel](https://my.selectel.ru/servers/network/networks/): in the top menu click **Products** → **Dedicated Servers** → **Network** → **Subnets \*\*\*\* tab**.

    12. Click **Configure**.

    13. [Restore the previous server boot template](/dedicated/troubleshooting/boot-to-recovery.mdx#restore-server-boot-template) or reboot the server from the OS. When rebooting the server from the OS, the boot template will automatically change to the one set before [changing the server boot template](/dedicated/troubleshooting/boot-to-recovery.mdx#change-server-boot-template).
  </TabItem>

  <TabItem value="debian">
    <TabItemLabel>
      Debian
    </TabItemLabel>

    1. [Boot the server in Rescue recovery and diagnostic mode](/dedicated/troubleshooting/boot-to-recovery.mdx).

    2. [Mount the OS file system](/dedicated/troubleshooting/mount-file-system.mdx).

    3. Open the network interfaces configuration file with the `vi`:

       ```bash
       vi /etc/network/interfaces.d/50-cloud-init
       ```

    4. For the required interface, change the `address` and `gateway` values to the new IP address and gateway.

       <details>
         <summary>Configuration file example</summary>

         ```bash
         source /etc/network/interfaces.d/*
         auto lo
         iface lo inet loopback

         auto eth0
         iface eth0 inet static
           address 178.132.202.35
           netmask 255.255.255.0
           gateway 178.132.202.33
           dns-nameserver 188.93.16.19 188.93.17.19
         ```

         Where:

         * `eth0` — network interface name;
         * `address 178.132.202.35` — server IP address;
         * `gateway 178.132.202.33` — subnet gateway.
       </details>

    5. Press **ESC**.

    6. Exit the `vi` text editor and save your changes:

       ```bash
       :wq
       ```

    7. Clear all network addresses assigned to the network interface:

       ```bash
       ip addr flush <eth_name>
       ```

       Specify `<eth_name>` — the name of the network interface for which you changed settings in step 4.

    8. Restart the network:

       ```bash
       service networking restart
       ```

    9. In the [control panel](https://my.selectel.ru/servers), on the top menu, click **Products** and select **Dedicated Servers**.

    10. In the **Servers** section, open the server page → **Ports \*\*\*\* tab**.

    11. In the Internet portal line, click <EditIcon />.

    12. In the **VLAN** field, replace the **General** value with the dedicated VLAN value. You can view the dedicated subnet VLAN in the [control panel](https://my.selectel.ru/servers/network/networks/): in the top menu click **Products** → **Dedicated Servers** → **Network** → **Subnets \*\*\*\* tab**.

    13. Click **Configure**.

    14. [Restore the previous server boot template](/dedicated/troubleshooting/boot-to-recovery.mdx#restore-server-boot-template) or reboot the server from the OS. When rebooting the server from the OS, the boot template will automatically change to the one set before [changing the server boot template](/dedicated/troubleshooting/boot-to-recovery.mdx#change-server-boot-template).
  </TabItem>

  <TabItem value="centos">
    <TabItemLabel>
      CentOS
    </TabItemLabel>

    1. [Boot the server in Rescue recovery and diagnostic mode](/dedicated/troubleshooting/boot-to-recovery.mdx).

    2. [Mount the OS file system](/dedicated/troubleshooting/mount-file-system.mdx).

    3. Output information about the network interfaces:

       ```bash
       ip a
       ```

    4. Open the configuration file with the `vi`:

       ```bash
       vi /etc/sysconfig/network-scripts/ifcfg-<eth_name>
       ```

       Specify `<eth_name>` — the name of the network interface for which you need to change settings.

    5. Change the `IPADDR` and `GATEWAY` values to the new IP address and gateway.

       <details>
         <summary>Configuration file example</summary>

         ```bash
         NAME="eth0"
         ONBOOT=yes
         NETBOOT=yes
         BOOTPROTO=static
         HWADDR="00:25:90:7a:d3:df"
         IPADDR="178.132.202.35"
         NETMASK="255.255.255.0"
         GATEWAY="178.132.202.33"
         TYPE=Ethernet
         NMCONTROLED=yes
         ```

         Where:

         * `eth0` — network interface name;
         * `IPADDR="178.132.202.35"` — server IP address;
         * `GATEWAY="178.132.202.33"` — subnet gateway.
       </details>

    6. Press **ESC**.

    7. Exit the `vi` text editor and save your changes:

       ```bash
       :wq
       ```

    8. Restart the network:

       ```bash
       systemctl restart network
       ```

    9. In the [control panel](https://my.selectel.ru/servers/), on the top menu, click **Products** and select **Dedicated Servers**.

    10. In the **Servers** section, open the server page → **Ports \*\*\*\* tab**.

    11. In the Internet portal line, click <EditIcon />.

    12. In the **VLAN** field, replace the **General** value with the dedicated VLAN value. You can view the dedicated subnet VLAN in the [control panel](https://my.selectel.ru/servers/network/networks/): in the top menu click **Products** → **Dedicated Servers** → **Network** → **Subnets \*\*\*\* tab**.

    13. Click **Configure**.

    14. [Restore the previous server boot template](/dedicated/troubleshooting/boot-to-recovery.mdx#restore-server-boot-template) or reboot the server from the OS. When rebooting the server from the OS, the boot template will automatically change to the one set before [changing the server boot template](/dedicated/troubleshooting/boot-to-recovery.mdx#change-server-boot-template).
  </TabItem>
</Tabs>

## Change network settings via WinPE \{#change-network-settings-via-winpe}

Network settings can be recovered if you did the following in the network interface settings:

* clicked to obtain an address via DHCP;
* configured an incorrect IP address.

Network settings for Windows Server access are restored via the registry. Before making changes, access the registry from WinPE and back up the partition where the system and registry files are located, usually `C:\Windows\System32\config\SYSTEM`.

1. [Boot the server in WinPE recovery and diagnostic mode](/dedicated/troubleshooting/boot-to-recovery.mdx).

2. Open `cmd`.

3. Output information about the network interface settings:

   ```bash
   ipconfig /all
   ```

4. Remember or copy the **description** field value for the required interface.

5. Open **Registry Editor**:

   ```bash
   regedit
   ```

6. Mount the branch with the system and registry files to the `HKEY_LOCAL_MACHINE` section:

   6.1. Select the `HKEY_LOCAL_MACHINE` section.

   6.2. In the **File** menu, select **Load hive**.

   6.3. In the dialog box, select the directory where the system and registry files are located, usually `C:\Windows\system32\config\SYSTEM`.

   6.4. Enter the name of the hive under which it will be mounted to the `HKEY_LOCAL_MACHINE` section, for example, `MountedSYSTEM`. The hive name must not coincide with existing hives in `HKEY_LOCAL_MACHINE`.

   6.5. Click **Open**. The registry hive will appear in the section.

7. In the mounted branch, find the required network interface:

   7.1. Expand the network interfaces registry key:

   ```bash
   HKEY_LOCAL_MACHINE\\\<branch_name>\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}
   ```

   Specify `<branch_name>` — the hive name you entered in step 6.4.

   The list will contain network interfaces from address **0000** to **0013**.

   7.2. Find the interface whose **Driver Desc** parameter matches the **description** from step 4.

   7.3. Save the value of the **NetCfgInstanceId** field.

8. Change the interface parameter values:

   8.1. Go to the registry key of the network interface you selected in step 7:

   ```bash
   HKEY_LOCAL_MACHINE\\\<branch_name>\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\\\<net_cfg_instance_id>
   ```

   Specify:

   * `<branch_name>` — the hive name you entered in step 6.4;
   * `<net_cfg_instance_id>` — the **NetCfgInstanceId** field value you obtained in step 7.3.

   8.2. Edit the parameter values. You can view the correct values in the [control panel](https://my.selectel.ru/servers/): in the top menu click **Products** → **Dedicated Servers** → server page → **Network** tab → click the required subnet.

   * `DefaultGateway` — default gateway;
   * `IPAddress` — network interface IP address;
   * `NameServer` — comma-separated DNS server IP addresses, for example, `8.8.8.8`, `8.8.4.4`;
   * `SubnetMask` — subnet mask;
   * `EnableDHCP` — IP address acquisition mode; enter the value:
     * `0` — if you are not using DHCP;
     * `1` — if you are using DHCP.

9. Unload the hive; to do this, select it and in the **File** menu, select **Unload hive**.

10. [Restore the previous server boot template](/dedicated/troubleshooting/boot-to-recovery.mdx#restore-server-boot-template) or reboot the server from the OS. When rebooting the server from the OS, the boot template will automatically change to the one set before [changing the server boot template](/dedicated/troubleshooting/boot-to-recovery.mdx#change-server-boot-template).

<Formbricks />
