How to fix resolv.conf on Ubuntu or Debian

If you are having wget: unable to resolve host address issues with your Ubuntu machine, you are in the right place.

It is simple to set up DNS on a Linux machine. Just add a couple of entries to /etc/resolv.conf and you’re done.

# Use Google's public DNS servers.
nameserver 8.8.4.4
nameserver 8.8.8.8

But things change and now it’s not that simple. If you now edit /etc/resolv.conf on Ubuntu you’ll find that the edits are ephemeral. If you restart (or even hibernate) your machine then they’ll be overwritten by default content.

nameserver 127.0.0.53
search Home

This is pretty simple to fix though.

  1. Install the resolvconf package.

    sudo apt install resolvconf
  2. Edit /etc/resolvconf/resolv.conf.d/head and add the following:

    # Make edits to /etc/resolvconf/resolv.conf.d/head.
    nameserver 8.8.4.4
    nameserver 8.8.8.8
  3. Restart the resolvconf service.

    sudo service resolvconf restart

Fix should be permanent.

  • /etc/resolv.conf, resolv.conf, Ubuntu, unable to resolve host address, Debian
  • 36 Users Found This Useful
Was this answer helpful?

Related Articles

How to Set Up a Mac for Your Kids

Providing children with access to a computer and the internet is increasingly important, but so...

How to Get Help With a Command from the Linux Terminal

Whether you’re an inexperienced terminal user or a grizzled veteran, you won’t always know the...

How to change the ssh port on Linux

To Change the SSH Port for Linux Server Connect to your server via SSH Switch to the root...

How To Install screenFetch in Linux

If you've browsed Linux groups on social media, you've probably seen a lot of screenshots that...

Static IP vs. Dynamic IP Address

A static IP address is one that remains fixed and never changes. The PC always sees the same...

Powered by WHMCompleteSolution