Ubuntu 18.04 uses now Netplan to configure the network interfaces, so the configuration must be done in the file /etc/netplan/50-cloud-init.yaml
sudo vi /etc/netplan/50-cloud-init.yaml
DHCP address:
network:
version: 2
renderer: networkd
ethernets:
enp3s0:
dhcp4: true
Static address:
network:
version: 2
renderer: networkd
ethernets:
enp3s0:
addresses:
- 10.10.10.2/24
gateway4: 10.10.10.1
nameservers:
addresses: [10.10.10.1, 1.1.1.1]
You can find more example here: https://netplan.io/examples#using-dhcp-and-static-addressing
NOTE:
- It’s using yaml format, you should use space rather than tab.