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.
-
Click 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 -
В control panels 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 panels 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
иgateway
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.
-
Click 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
-
В control panels 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 panels 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.
-
Display 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
иGATEWAY
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.
-
Click ESC.
-
Exit the text editor
vi
with the changes intact::wq
-
Restart the network:
systemctl restart network
-
В control panels 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 panels 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
. -
Output information about the settings of the network interfaces:
ipconfig /all
-
Memorize or copy the value of the field description for the right interface.
-
Open it up Registry Editor:
regedit
-
Mount to a partition
HKEY\_LOCAL\_MACHINE
the branch with the system and registry files:6.1 Highlight a section
HKEY\_LOCAL\_MACHINE
.6.2 In the menu File select Load hive.
6.3. In the dialog box, select the directory where the system and registry files are located, usually it is
C:\Windows\system32\config\SYSTEM
.6.4 Enter the name with which the loaded branch will be mounted to the partition
HKEY\_LOCAL\_MACHINE
, and press Open. -
In the mounted branch, locate the desired interface:
7.1 Expand the registry section:
HKEY_LOCAL_MACHINE\\\<branch_name>\ControlSet001\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}
Specify
<branch_name>
— the branch name you entered in step 6.4.The list will list the network interfaces from address 0000 before 0013.
7.2 Find an interface that has a parameter value of Driver Desc specified description from step 4. Save the field value NetCfgInstanceId.
-
Change the values of the interface parameters:
8.1. Go to the registry section:
HKEY_LOCAL_MACHINE\\\<branch_name>\ControlSet001\Services\Tcpip\Parameters\Interfaces\\\<net_cfg_instance_id>
Specify:
<branch_name>
— the branch name you entered in step 6.4;<net_cfg_instance_id>
— field value NetCfgInstanceIdthat you obtained in step 7.2.
8.2 Edit the parameter values:
DefaultGateway
;IPAddress
;NameServer
;SubnetMask
.EnableDHCP
— enter a value0
If you're not using DHCP, if you are.1
.
The correct values can be viewed in control panels: 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.