for permanent static IP: https://linuxize.com/post/how-to-configure-static-ip-address-on-ubuntu-20-04/
For Temporary:
First of all, open Terminal. Enter “ip addr show” command to see the available network adapter whom you want to change the IP address and press execute.
ip addr show
Use sudo ifconfig eth0 X.X.X.X netmask 255.255.255.0
command to change the IP address. You can verify by using “ip addr show” command.
Change DNS Resolver in /etc/resolv.conf
first backup
// Remove old configs -- better backup it with mv /etc/resolv.conf /etc/resolv.orig
sudo rm /etc/resolv.conf
to gain the root privileges. run
sudo bash
then run
sudo echo "nameserver 8.8.8.8" > /etc/resolv.conf
where 8.8.8.8 is the address of DNS server.
sudo route add default gw X.X.X.X network_device_name