Change network settings on the server
Change network settings via Rescue
Ubuntu
Debian
CentOS
-
Open the utility configuration file
netplan
word processorvi
:vi /etc/netplan/01-netcfg.yaml
or
vi /etc/netplan/50-cloud-init.yaml
-
For the desired interface, change the values
addresses
andgateway4
to a new IP address and gateway.The configuration file is written in tab- and space-sensitive YAML. Fill it in similarly to how it was filled in earlier.
Example configuration file
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]Here:
eth0
— network interface name;addresses: [178.132.202.35/28]
— IP address of the server with subnet mask;gateway4: 178.132.202.33
— subnet gateway.
-
Press the key
ESC
. -
Exit the text editor
vi
with the changes intact::wq
-
Check the configuration file for errors and apply the configuration:
netplan --debug generate
netplan apply -
In control panel go to Servers and hardware → Servers.
-
Open the server page → tab Ports.
-
In the Internet port bar, click .
-
In the field VLAN replace the value General to the value of the allocated VLAN. You can view the VLAN of the allocated subnet in the control panel under Servers and hardware → Network → tab Subnetworks.
-
Click Configure.
-
Bring back the old server loading template or reboot the server from the OS. When you reboot the server from the OS, the boot template will automatically change to the one that was set before changes to the server load pattern.
-
Open the network interfaces configuration file with a text editor
vi
:vi /etc/network/interfaces
-
For the desired interface, change the values
address
andgateway
to a new IP address and gateway.Example configuration file
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.19Here:
eth0
— network interface name;address 178.132.202.35
— Server IP address;gateway 178.132.202.33
— subnet gateway.
-
Press the key
ESC
. -
Exit the text editor
vi
with the changes intact::wq
-
Clear all network addresses assigned to the network interface:
ip addr flush <eth_name>
Specify
<eth_name>
— the name of the network interface whose settings you changed in step 4. -
Restart the network:
service networking restart
-
In control panel go to Servers and hardware → Servers.
-
Open the server page → tab Ports.
-
In the Internet port bar, click .
-
In the field VLAN replace the value General to the value of the allocated VLAN. You can view the VLAN of the allocated subnet in the control panel under Servers and hardware → Network → tab Subnetworks.
-
Click Configure.
-
Bring back the old server loading template or reboot the server from the OS. When you reboot the server from the OS, the boot template will automatically change to the one that was set before changes to the server load pattern.
-
Output information about the network interfaces:
ip a
-
Open the configuration file with a text editor
vi
:vi /etc/sysconfig/network-scripts/ifcfg-<eth_name>
Specify
<eth_name>
— the name of the network interface whose settings you want to change. -
Change the values
IPADDR
andGATEWAY
to a new IP address and gateway.Example configuration file
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=yesHere:
eth0
— network interface name;IPADDR="178.132.202.35"
— Server IP address;GATEWAY="178.132.202.33"
— subnet gateway.
-
Press the key
ESC
. -
Exit the text editor
vi
with the changes intact::wq
-
Restart the network:
systemctl restart network
-
In control panel go to Servers and hardware → Servers.
-
Open the server page → tab Ports.
-
In the Internet port bar, click .
-
In the field VLAN replace the value General to the value of the allocated VLAN. You can view the VLAN of the allocated subnet in the control panel under Servers and hardware → Network → tab Subnetworks.
-
Click Configure.
-
Bring back the old server loading template or reboot the server from the OS. When you reboot the server from the OS, the boot template will automatically change to the one that was set before changes to the server load pattern.
Change network settings via WinPE
Network settings can be restored if you in the network interface settings:
- clicked on DHCP address acquisition;
- configured the wrong IP address.
Restoring network settings to access Windows Server is done through the registry. Before making any changes, access the registry from WinPE and back up the partition where the system and registry files reside, typically the following C:\Windows\System32\config\SYSTEM
-
Open it up
cmd
. -
Display information about the settings of the network interfaces:
ipconfig /all
-
Memorize or copy the value of the field description for the right interface.
-
Open the program Registry Editor:
regedit
-
Mount to a partition HKEY_LOCAL_MACHINE the branch with the system and registry files:
- highlight a section HKEY_LOCAL_MACHINE;
- on the menu File select Load hive;
- in the dialog box, select the directory where the system and registry files are located, usually it is
C:\Windows\system32\config\SYSTEM
; - enter the name with which the downloaded branch will be mounted to the partition HKEY_LOCAL_MACHINE, and press Open.
-
In the mounted branch, find the desired interface:
- expand the registry section:
HKEY_LOCAL_MACHINE\имя_ветки\ControlSet001\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}
- the list will contain a list of network interfaces from the address 0000 before 0013, find the interface that has in the value of the parameter Driver Desc specified description from step 4;
- save the field value NetCfgInstanceId of the interface we found.
-
Change the values of the interface parameters:
- go to the registry section:
HKEY_LOCAL_MACHINE\имя_ветки\ControlSet001\Services\Tcpip\Parameters\Interfaces\значение_поля_NetCfgInstanceId
- edit the parameter values:
DefaultGateway
;IPAddress
;NameServer
;SubnetMask
. If you're not using DHCP —EnableDHCP
in the sense of0
if you use it, it means1
. The correct values can be viewed in control panel: under Servers and hardware → server page → tab Network → click the desired subnet.
-
Unload the branch, to do this, select it and in the menu File select Unload hive.
-
Bring back the old server loading template or reboot the server from the OS. When you reboot the server from the OS, the boot template will automatically change to the one that was set before changes to the server load pattern.