To list network configurations:
sudo netplan list
or
ip a
Next, edit the network configuration file:
sudo nano /etc/netplan/filename.yaml
Add the following content to filename.yaml:
network:
version: 2
ethernets:
enp0s25: # Replace enp0s25 with your interface name
dhcp4: no
addresses: [192.168.1.2/24]
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
apply changes
sudo netplan apply