Ubuntu 20.04 temporary failure in name resolution for wired
I am getting the following error from ubuntu 20.04 terminal, connected via wired ethernet connection: When I type the following command which I am using in a bash script:
ping -c 1 google.com
for a health check to ensure it has access, I get the following error:
ping: google.com: Temporary failure in name resolution
Some background
I overwrote my older gaming rig to be a ubuntu multi purpose server (including smart home automation) in my home network. It used to be windows 10, but I formatted the drive and installed ubuntu on it.
I have not yet been able to access the internet with ubuntu, however, I do know that the equipment works because I left the internet wired in, I actually downloaded ubuntu via that machine onto the usb before installing.
Now I cannot see or connect to the ubuntu server from other devices and cannot reach the internet to download even basic tools like netstat.
At this point, I feel like I've bashed my head against a wall and scoured the internet (and lots of other stack overflow threads) and tried a bunch of things that didn't work.
Any help would be greatly appreciated!
Edit: As requested in comments, I am attaching a screenshot, since I am not able access the computer via any network. Only via hdmi.
Edit 2: Second screenshot as requested.
It's likely your default DNS server is pointing to an IP address that is not capable of resolving DNS queries. You should check the DNS settings in the file that /etc/resolv.conf is pointing to. When you go to that file (/var/run/systemd/resolve/resolve.conf), look at the IP that is right next to the keyword namespace. You should set it to your router's IP address (which can be found with the command route -n
. Look for the gateway column and take the one that's not 0.0.0.0) or you can also set it to a public DNS server such as 1.1.1.1, 8.8.8.8 etc.
EDIT: Please follow these instructions:
Execute sudo rm /etc/resolv.conf
Execute sudo touch /etc/resolv.conf
Edit the file with sudo nano /etc/resolv.conf
Add this line to the file: nameserver 1.1.1.1
Press ctrl + s
to save and ctrl + x
to exit
Then try to access the internet again. If it still doesn't work, reboot the system and try again. That should solve your problem.
Firstly, I have to give a shout out to @chili555 for spending literally hours last night helping me troubleshoot.
After many hours of troubleshooting, the simplest answer was the solution. Something must have gone wrong during installation, because after a reinstall from the same usb flash drive, my computer is on the network and accessing the internet.
I still don't know the true cause, but my server is up and running.
Thanks @chili555!