UpUbuntu 20.04.2 LTS Wifi Network / Ethernet connected but no internet

I recently installed Ubuntu 20.04 LTS being a previous windows user. However, now I have the issue that neither Ethernet nor other WiFi connections let me access the internet. Other devices around me connect with no troubles. I have followed several other suggestions like this one but without success.

ping 8.8.8.8 yields PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data

and

ping www.google.com yields Temporary failure in name resolution

I am not sure what other information to provide and would appreciate any suggestions.

Update: I came across this forum, where it was suggested to run the following commands:

sudo rm /etc/resolv.conf

sudo echo 'nameserver 8.8.8.8' | sudo tee /etc/resolv.conf

After running this, the internet connection begins to work. However, if I reboot the computer then I have to do it all over again.

As requested by @chili555, the output of ls -al /etc/resolv.conf is :

-rw-r--r-- 1 root root 19 Jul 7 17:36 /etc/resolv.conf


The file resolv.conf is incorrect. Please do:

sudo rm -f /etc/resolv.conf
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf

Now check:

ping -c3 www.ubuntu.com

If you get ping returns, you're all set.