[Fixed] Temporary failure in name resolution – Ubuntu 18.04 – 19.10


I came across this error “Temporary failure in name resolution” and as always Google was very helpful, not as fast as I would have liked though but I was able to finally put the pieces together and come up with a working and most importantly permanent solution.

The Error “Temporary failure in name resolution” Ubuntu 18.04 – 19.10

  • Save

This error could present itself in many forms and sometimes it’s not even noticeable until you come across a website that won’t accept your current Networking configuration.

It is a DNS configuration issue with the default network service configuration, which is configured to work as Dynamic and what worked on my case at least was to change it to Static. More on this later.

But first, let me tell you a bit more about this error it could help you figure out your issue in case my solution below doesn’t work out for you, it has happened to me before.

For some reason, I was able to ping most of the top websites out there such as google, yahoo and such but I couldn’t access the site I wanted Minergate.com which as some of you know it is a site for mining Cryptocurrency.

Check out my other post where I go a little deeper on the Temporary failure in name resolution in ubuntu focused on CPU cryptocurrency miners.

In fact, if it wasn’t because I started playing around with cryptocurrency mining I would have never found out about this error in ubuntu, some sites were unreachable and some sites weren’t. I could ping some sites but I couldn’t ping others.

My miner cpuminer-multi was able to access some pools but not others it would give me some weird messages like: connection error, refused connection or stratum couldn’t connect and similar errors (I go more in detail about no connectivity for stratum here).

Could My Setup be the Result of The “Temporary failure in name resolution” Error?

I currently am working via SSH on a VPS running Ubuntu 19.10 and I have no physical access to the machine in question that has the problem so all my work is done remotely and through the console.

That being said, I thought it was worth mentioning since the error Temporary failure in name resolution has to be addressed differently whether you are in the same position as me working with a VPS remotely or if you have physical access to the machine, both of which will be discussed below,

Ubuntu 18.04 /etc/network/interfaces

As most of us might be aware of ubuntu has switched the way we normally used for configuring network interfaces /etc/network/interfaces starting from ubuntu version 18.04, it is now called Neteplan which runs on YAML base configuration system.

Similar if not the same as the format used in Minecraft yml files.

The location for this new interface is located at: /etc/netplan/*.yaml

Read more about Netplan the new network interface for ubuntu 18.04 and above here.

Fixing “Temporary failure in name resolution” on VPS

Alright so like I mentioned before this is a DNS problem with the default network configuration in Ubuntu 18.04 and above., not as much as an error or problem but some sites don’t seem to like such configuration which I have no idea why maybe someone could shade some light in the comments.

Anyhow, here are the steps to fix it on your VPS

Editing 10-ens3.yaml in Ubuntu 18.04 – 19.10

Alright so at this point I’m going to assume that you are connected through your server via SSH and that you know how to edit a file either with nano, vim or directly via FTP.

Head over to /etc/netplan inside that folder there should be a file named 10-ens3.yaml or a very similar name but with the yaml extension, the default structure will be displayed as follows:

network:
    version: 2
    renderer: networkd
    ethernets:
      ens3:
          dhcp4: no

Which is configured to get IP addressing from the DHCP server Dynamically and we need to change that to Static

Static Netplan Configuration

The following structure denotes the configuration of a static IP address in Netplan using google’s DNS nameservers which seems to have fixed the problem.
Please make note of all the spaces and everything must be lowercase.

network:
    version: 2
    renderer: networkd
    ethernets:
      ens3:
          dhcp4: no
          addresses:
          - 149.28.47.230/23
          gateway: 149.28.46.1
          nameservers:
             addresses: [8.8.8.8, 8.8.4.4]

 

Where:
addresses is your VPS ip address as shown after executing the command ip a:

 

[email protected]:~# ip a
1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens3: mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 56:00:02:87:2c:19 brd ff:ff:ff:ff:ff:ff
inet 149.28.47.230/23 brd 149.28.47.255 scope global dynamic ens3
valid_lft 77817sec preferred_lft 77817sec
inet6 fe80::5400:2ff:fe87:2c19/64 scope link
valid_lft forever preferred_lft forever

and gateway is the default gateway for your VPS server displayed in your vps provider dashboard or like I prefer to do it via console with the command: route -n

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 149.28.46.1 0.0.0.0 UG 10000ens3
149.28.46.0 0.0.0.0 255.255.254.0 U 000ens3
169.254.169.254149.28.46.1255.255.255.255UGH10000ens3

Lastly, we have the nameservers displayed in the following format:

nameservers:
addresses: [8.8.8.8, 8.8.4.4]

Where 8.8.8.8, 8.8.4.4 are the google dns nameservers
remember that for this setting dhcp4 must be set to no dhcp4: no

And Voila:

  • Save

It works now no more “Temporary failure in name resolution” error on ubuntu 19.10 and pinging normally.

Saving changes and avoiding crashes and more errors

Save all your network settings with: netplan try make sure you have connection and that you haven’t broken anything.

Careful with the dhcp4: yes if you set this to no without all the rest of the static configuration you will totally lose internet connection. Trust me I know, I got locked out of my VPS server and had to do a full reinstall of the operating system to get back in losing everything I had, luckily it was my test server so nothing was lost.

Fixing Error “Temporary failure in name resolution” on Phisical Computer

Fixing the error “Temporary failure in name resolution” on ubuntu physical computer which means on a computer that you actually have physical access to and not a VPS, is pretty much the same steps as above for VPS with the only difference being in acquiring your IP and gateway addresses.

Well not as much as a difference but in case you can’t access your gateway address just connect to your internet through another device and check your connection details that way.

I’m not sure if the IP address is local or public but feel free to play with both.

Conclusion

Hopefully, I have helped you out fixing this error “Temporary failure in name resolution” and now you can ping and access all websites without exception. Don’t forget to share this post.





0 Shares
Share via
Copy link