[solved] Nadia - resolvconf not using DNS server from DHCP

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post please read how to get help
Post Reply
User avatar
captainmorgan
Level 1
Level 1
Posts: 20
Joined: Thu May 03, 2012 9:28 am

[solved] Nadia - resolvconf not using DNS server from DHCP

Post by captainmorgan »

I can see in my NetworkManager status window that DHCP has correctly sent my pc a DNS server address, in this case 192.168.1.1. The problem is resolveconf isn't putting that into my /etc/resolv.conf for some reason. Even after running `sudo dpkg-reconfigure resolvconf` then rebooting as suggested in some google search results, it only contains this:

Code: Select all

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1

# OpenDNS Fallback (configured by Linux Mint in /etc/resolvconf/resolv.conf.d/tail).
nameserver 208.67.222.222
nameserver 208.67.220.220
How can I get resolvconf to use the DHCP-provided DNS server?
Last edited by captainmorgan on Tue Apr 16, 2013 2:52 pm, edited 1 time in total.
User avatar
Angtagapagligt
Level 4
Level 4
Posts: 223
Joined: Sat Jul 10, 2010 3:14 am

Re: Nadia x86_64 - resolvconf not using DNS server from DHCP

Post by Angtagapagligt »

Hello,

just write

Code: Select all

nameserver 192.168.1.1
into your resolv.conf.

The problem is, that Linux saves a DHCP or even a manually configured IP address temporary. If you want a permanent config you have to add your parameters (like the nameserver) to the appropriated configuration files.

You can find some information here.

So long
Angta
"Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect."
  • - Linus Torvalds Interview with David Diamond, September the 28th 2003
User avatar
captainmorgan
Level 1
Level 1
Posts: 20
Joined: Thu May 03, 2012 9:28 am

Re: Nadia x86_64 - resolvconf not using DNS server from DHCP

Post by captainmorgan »

Thanks, but I'm still wondering why the DNS server provided by DHCP is not automatically entered into /etc/resolv.conf the way it used to be. The link you gave described setting up a static IP address on a PC formally configured for DHCP, which is not what I'm doing here.
User avatar
Angtagapagligt
Level 4
Level 4
Posts: 223
Joined: Sat Jul 10, 2010 3:14 am

Re: Nadia x86_64 - resolvconf not using DNS server from DHCP

Post by Angtagapagligt »

I'm wondering how to explain this scenario....
If you give Linux a IP via ifconfig manually or via DHCP everything is stored temporary anywhere in /proc/net/... . The prober path doesn't matter. What matters is that every configuration of your interface is temporary stored there. If you gain an address via DHCP the complete configuration is stored. If you configure your interface manually via ifconfig the configuration is temporary stored there, too.
To add a permanent configuration like your nameserver you have to change this in the conifguration files like resolv.conf.
If you configure the nameserver via DHCP configured with ifconfig it's stored in a temporary file.
You can follow the following steps to get what I try to explain:
- Set a IP-address with ifconfig like this

Code: Select all

ifconfig eth0 192.168.99.14 netmask 255.255.255.0 up
This is an example! Make sure that it doesn't impact your network!
- Check the output from

Code: Select all

ifconfig
- You'll see that your IP is 192.168.99.14
- Now reboot
- Check the output from

Code: Select all

ifconfig
again
- Crazy, hm? :P

- Now backup your /etc/network/interfaces ! IMPORTANT
- Open /etc/network/interfaces in a texteditor, delete every entry and add:

Code: Select all

iface eth0 inet static
     address 192.168.99.14
     network 192.168.99.0
     netmask 255.255.255.0
     broadcast 192.168.99.255
     gateway 192.168.99.254
- Reboot your machine
- Check the ouput of ifconfig again
- This is LINUX!!!
- DON'T FORGET TO DELETE YOUR /etc/network/interfaces FILE AND RESTORE YOUR BACKUP-FILE!

The way this works is the same with a DHCP configured NIC.
The first thing we see is a temporary configured NIC via ifconfig like it is with DHCP. It doesn't matter if this configuration comes from a DHCP-server or from a manual configuration.
The second thing we see is a static configured NIC. This ist what we do when we add "nameserver 1.1.1.1" to resolv.conf!

I hope you understand what I mean...

Angta
"Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect."
  • - Linus Torvalds Interview with David Diamond, September the 28th 2003
User avatar
captainmorgan
Level 1
Level 1
Posts: 20
Joined: Thu May 03, 2012 9:28 am

Re: Nadia x86_64 - resolvconf not using DNS server from DHCP

Post by captainmorgan »

I understand that things must be saved to a config file to be perisisted. The difference I'm seeing is that in past versions of Ubuntu/Mint, when getting a DNS address from DHCP I'd see this in /etc/resolv.conf (this is copied verbatim from a Linux Mint 12 system)

Code: Select all

# Generated by NetworkManager
nameserver 192.168.1.1
Now I have to manually enter it. Why doesn't NetworkManager do this automatically anymore?
User avatar
Angtagapagligt
Level 4
Level 4
Posts: 223
Joined: Sat Jul 10, 2010 3:14 am

Re: Nadia x86_64 - resolvconf not using DNS server from DHCP

Post by Angtagapagligt »

This was changed in any realease. Don't know why.
On Ubuntu 12.04 (tested a few moments ago ;)) the configuration of the ifconfig is saved in the resolv.conf.
"Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect."
  • - Linus Torvalds Interview with David Diamond, September the 28th 2003
User avatar
captainmorgan
Level 1
Level 1
Posts: 20
Joined: Thu May 03, 2012 9:28 am

Re: Nadia x86_64 - resolvconf not using DNS server from DHCP

Post by captainmorgan »

I did some manual digging and found out that things aren't quite what they seem on the surface. I'd noticed that dnsmasq was enabled on localhost by default and was the default DNS server. A bit weird, I thought, but whatever. Well, it turns out that this dnsmasq local-dns server is actually relaying to the DNS server provided by DHCP. I verified this by enabling "local dns" in my router and using nslookup to query a hostname on the LAN like so:

Code: Select all

lytithwyn@lithbook ~ $ nslookup
> judy-pc
Server:		127.0.1.1
Address:	127.0.1.1#53

Name:	judy-pc
Address: 192.168.1.129
This change might seem odd, but was implemented to help automatically take care of the hairy mess that can be caused when a PC has the need to query some hostnames over LAN and some over a VPN connection. Here's a link with a nice explanation: https://www.stgraber.org/2012/02/24/dns ... ntu-12-04/.

Note: As explained in the link, you should NOT make manual changes in /etc/resolv.conf on Nadia and other systems using resolvconf because the changes will be overwritten on reboot! I have manually verified this myself.
doktornotor
Level 4
Level 4
Posts: 203
Joined: Mon Jan 23, 2012 6:28 pm

Re: [solved] Nadia - resolvconf not using DNS server from DH

Post by doktornotor »

What a piece of buggy, poorly tested *buntu junk. Horrible change... :x :roll: :evil:

For people fighting with this non-working nonsense:

- /etc/NetworkManager/NetworkManager.conf - comment out the "dns=dnsmasq" line (put # before this)
- /etc/resolvconf/resolv.conf.d/tail - make the file empty
- reboot (no, restarting NM is not enough)

After reboot, do

Code: Select all

cat /etc/resolv.conf 

should now contain sane entries populated by your DHCP server.

Note: /etc/resolv.conf MUST be a symlink to /run/resolvconf/resolv.conf for the above to work, not a regular file. :!:

Ref: https://bugs.launchpad.net/ubuntu/+sour ... mments=all
User avatar
Angtagapagligt
Level 4
Level 4
Posts: 223
Joined: Sat Jul 10, 2010 3:14 am

Re: [solved] Nadia - resolvconf not using DNS server from DH

Post by Angtagapagligt »

Sticky maybe?
"Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect."
  • - Linus Torvalds Interview with David Diamond, September the 28th 2003
Post Reply