$ sudo nano /etc/netplan/50-cloud-init.yaml
Then replace your configuration, for example, the following lines:
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
ens160:
dhcp4: no
addresses: [192.168.1.137/24]
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8,8.8.4.4]
Apply changes:
$ sudo netplan apply
In case you run into some issues execute:
$ sudo netplan --debug apply
[NOTE]:
/24is equivalent with255.255.255.0ens160is your ethernet name, you can get it using$ ifconfig- Ubuntu 16.04 and 14.04 network-interface configuration have a different method.
- The file is in YAML format: Use spaces, no tabs.