Change network settings on the server
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
иgateway4
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