Ubuntu replaced the configuration file /etc/network/interfaces with netplan, which uses configuration files in YAML syntax /etc/netplan/01-netcfg.yaml .
Open the YAML configuration file with your text editor :
sudo nano /etc/netplan/01-netcfg.yaml
/etc/netplan/01-netcfg.yamlnetwork:
version: 2
renderer: networkd
ethernets:
ens3:
dhcp4: yes
ens4:
dhcp4: no
addresses:
- 192.168.121.99/24
gateway4: 192.168.121.1
nameservers:
addresses: [8.8.8.8, 1.1.1.1]
Once done save and close the file and apply the changes with:
sudo netplan apply
Verify the changes by typing:
ip addr show dev ens3