How to automatically get a DHCP nameserver after installing resolvconf on Ubuntu 18.04

From steamWiki
Revision as of 12:57, 21 June 2021 by Sean (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

I like to use resolvconf to allow me to make persistent modification to my resolv.conf file to do things like allow OpenVPN to resolve local DNS hostnames. In the past (mostly on Linux Mint machines I've simply installed resolvconf, and after doing so, no issues were induced related to how my machine connects to the internet, resolves hostnames, etc. Well on Ubuntu 18.04 after installing resolvconf my machine could no longer resolve hostnames (that is to say I could ping IP address but I couldn't ping host names or visit websites using their standard text based web address). The problem appears to be that the resolv.conf file was no longer getting a DNS nameserver from the DHCP server upon connecting to a network.

This thread helped me find the solution, which is fairly simple. Apparently the issue is unique to Ubuntu and was implemented by the Ubuntu team to fix some problems with multiple name servers present when using VPN and LAN connections simultaneously. Regardless, you can "fix" the issue caused by installing resolvconf on Ubuntu 18.04 (and likely other versions) by doing the following.

  1. Edit NetworkManager.conf by running
    sudo nano /etc/NetworkManager/NetworkManager.conf
  1. Comment out the line that reads dns=dnsmasq or dns=default (or probably dns=<anything> by prepending it with a pound character (#). Your file should look something like this when it's done
  1. Restart your computer and you should now be automatically getting a DNS nameserver from the DHCP server when you connect to a network. This means you should be able to ping hostnames and browse the internet as expected even with resolvconf installed.