/etc/resolv.conf (which is actually a symbolic link to /run/resolvconf/resolv.conf) is written by the resolvconf utility based on information coming from various possible sources.
127.0.1.1 is the loopback IP address on which the NetworkManager-controlled instance of dnsmasq listens. Dnsmasq runs locally and accepts DNS queries at 127.0.1.1 and forwards these queries to an external nameserver whose address is furnished by NetworkManager. This scheme does not always work well and if you have any problem with it (as you do) then it is advisable to disable NetworkManager-controlled dnsmasq. To disable it, edit
sudo gedit /etc/NetworkManager/NetworkManager.conf
and comment out the line
so that it looks like the following.
Then restart network-manager.
sudo restart network-manager
After this you should have a
nameserver line in resolv.conf with a non-loopback IP address. If this is not the case then try the following command.
sudo dpkg-reconfigure resolvconf
If you still don't have a
nameserver line in resolv.conf with a non-loopback IP address or if you still have no DNS service, try rebooting.
If you still have no good DNS service then start investigating the nameserver at the external IP address (18.104.22.168 in the example below). Does it correctly resolve domain names when approached using the
host www.ford.com 22.214.171.124
dig @126.96.36.199 www.gm.com
Do Google's nameservers work?
host www.ford.com 188.8.131.52
dig @184.108.40.206 www.gm.com
If you find that your external nameserver isn't working properly then you should configure your connection to use a well behaved nameserver such as Google's. To do this, right click on the network indicator and go to Edit Connections | | Edit... | IPv4 Settings. Assuming that the current Method is
Automatic (DHCP), set Method to
Automatic (DHCP) addresses only and fill in good nameserver addresses in the field entitled
Additional DNS servers.