Difference between revisions of "How to automatically get a DHCP nameserver after installing resolvconf on Ubuntu 18.04"

From steamWiki
Jump to: navigation, search
(Created page with "I like to use ''[https://wiki.debian.org/resolv.conf resolvconf]'' to allow me to make persistent modification to my ''resolv.conf'' file to do things like [https://steamforge...")
 
Line 1: Line 1:
 
I like to use ''[https://wiki.debian.org/resolv.conf resolvconf]'' to allow me to make persistent modification to my ''resolv.conf'' file to do things like [https://steamforge.net/wiki/index.php/How_to_configure_OpenVPN_to_resolve_local_DNS_%26_hostnames#OpenVPN_Client_Setup allow OpenVPN to resolve local DNS hostnames].  In the past (mostly on [https://linuxmint.com/ 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 [https://releases.ubuntu.com/18.04/ 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.
 
I like to use ''[https://wiki.debian.org/resolv.conf resolvconf]'' to allow me to make persistent modification to my ''resolv.conf'' file to do things like [https://steamforge.net/wiki/index.php/How_to_configure_OpenVPN_to_resolve_local_DNS_%26_hostnames#OpenVPN_Client_Setup allow OpenVPN to resolve local DNS hostnames].  In the past (mostly on [https://linuxmint.com/ 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 [https://releases.ubuntu.com/18.04/ 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.
  
[https://forums.linuxmint.com/viewtopic.php?t=131369 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 editing
+
[https://forums.linuxmint.com/viewtopic.php?t=131369 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.
 +
 
 +
#Edit ''NetworkManager.conf'' by running <pre>sudo nano /etc/NetworkManager/NetworkManager.conf</pre>
 +
 
 +
#Comment out the line that reads ''dns=dnsmasq'' or ''dns=default'' (or probably ''dns=<anything>'' by prepending it with a '''#'''.  Your file should look something like this when it's done<pre>[main]
 +
#dns=default
 +
plugins=ifupdown,keyfile
 +
 
 +
[ifupdown]
 +
managed=false
 +
 
 +
[device]
 +
wifi.scan-rand-mac-address=no</pre>
 +
 
 +
#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.

Revision as of 12:54, 21 June 2021

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 #. Your file should look something like this when it's done
    [main]
  2. dns=default

plugins=ifupdown,keyfile

[ifupdown] managed=false

[device]

wifi.scan-rand-mac-address=no
  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.