–Ubuntu now uses a .yaml file and netplan to direct connections. The name of your .yaml file may be slightly different. Find your filename.
cd /etc/netplan
ls
–use nano to change file
sudo nano your.yaml
–your file will look similar to this, keep attention to indents and indent only by spaces
network:
version: 2
renderer: networkd
ethernets:
ens3:
dhcp4: no
addresses:
- 192.168.121.221/24
gateway4: 192.168.121.1
nameservers:
addresses: [8.8.8.8, 1.1.1.1]
–save file and apply changes
sudo netplan apply
–check
ip addr show