Results 1 to 5 of 5

Thread: Incorrect DNS nameserver

  1. #1
    Join Date
    Jan 2013
    Beans
    2

    Incorrect DNS nameserver

    Running Ubuntu 12.04.1 LTS.

    On the local ethernet is a DSL modem/router which acts as a DHCP server and DNS server. It recently worked just fine. I somewhat frequently update the Ubuntu packages, but I may have also switched some setting on the modem a while back. The modem IP is 192.168.1.1, on a 192.168.1.* network.

    When I boot up the Ubuntu box, the ethernet interface appears to be properly configured:

    Code:
    $ ifconfig eth0
    ...
    inet addr:192.168.1.47  Bcast:192.168.1.255  Mask:255.255.255.0
    But the resolvconf DNS information is bad:

    Code:
    $ ls -l /etc/resolv.conf
    lrwxrwxrwx 1 root root 29 Sep  7 22:17 /etc/resolv.conf -> ../run/resolvconf/resolv.conf
    $ cat /etc/resolv.conf 
    # 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.0.1
    search homelinux.net
    Using lo as a DNS server doesn't work at all. I ought to be using the modem 192.168.1.1 instead.

    (I've been able to work around this one boot at a time by manually running "cat bettersettings > sudo resolvconf -a NetworkManager".)

    I tried adding "supersede domain-name-servers 192.168.1.1;" in /etc/dhcp/dhclient.conf , but after reboot there was no apparent effect and I'm still getting only "nameserver 127.0.0.1".

    Somebody on irc.freenode.net #ubuntu suggested putting a nameserver line in /etc/resolvconf/resolv.conf.d/base (which was previously empty). So I tried that, but again no apparent effect.

    Any other ideas? If nothing else, I could try to add a local upstart step that fiddles resolvconf right after eth0 comes up, but I'm hoping for something simpler that makes more sense.

  2. #2
    Join Date
    Jan 2013
    Beans
    18

    Re: Incorrect DNS nameserver

    you can try editing your /etc/network/interfaces to include this:

    Code:
    auto eth0
    iface eth0 inet dhcp
    dns-nameservers 208.67.222.222 208.67.220.220
    then save, and restart the system (there's probably a better way, but I've not found a clean one).

    Now, I'm using the openDNS nameservers because I can't stand my ISP's 404 redirect page, and they're not nice with "seriously, lemme shut it off!"

  3. #3
    Join Date
    Jan 2013
    Beans
    2

    Re: Incorrect DNS nameserver

    That did the trick. Thanks.

  4. #4
    Join Date
    Mar 2005
    Beans
    211

    Re: Incorrect DNS nameserver

    Quote Originally Posted by dpurgert View Post
    You can try editing your /etc/network/interfaces to include this:

    Code:
    auto eth0
    iface eth0 inet dhcp
    dns-nameservers 208.67.222.222 208.67.220.220
    then save, and restart the system (there's probably a better way, but I've not found a clean one).
    A way to activate this change without rebooting is to do "ifdown eth0 ; ifup eth0".

  5. #5
    Join Date
    Mar 2005
    Beans
    211

    Re: Incorrect DNS nameserver

    Quote Originally Posted by aschepler View Post
    But the resolvconf DNS information is bad:

    Code:
    $ ls -l /etc/resolv.conf
    lrwxrwxrwx 1 root root 29 Sep  7 22:17 /etc/resolv.conf -> ../run/resolvconf/resolv.conf
    $ cat /etc/resolv.conf 
    # 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.0.1
    search homelinux.net
    Using lo as a DNS server doesn't work at all. I ought to be using the modem 192.168.1.1 instead.
    Your /etc/resolv.conf appears to be correct: it directs the glibc resolver to connect to a locally running, forwarding nameserver that listens on the loopback IP address 127.0.0.1.

    (I've been able to work around this one boot at a time by manually running "cat bettersettings > sudo resolvconf -a NetworkManager".)
    That should be "cat bettersettings | sudo resolvconf -a NetworkManager".

    I tried adding "supersede domain-name-servers 192.168.1.1;" in /etc/dhcp/dhclient.conf , but after reboot there was no apparent effect and I'm still getting only "nameserver 127.0.0.1".
    That was the wrong approach. Make sure you have reverted all your experimental changes.

    Somebody on irc.freenode.net #ubuntu suggested putting a nameserver line in /etc/resolvconf/resolv.conf.d/base (which was previously empty). So I tried that, but again no apparent effect.
    There is lots of bad advice out there on the 'net. It is almost never correct to put "nameserver" lines into files in /etc/resolvconf/resolv.conf.d/. Make sure you revert those changes too.

    You say that adding a stanza to /etc/network/interfaces fixed the problem. Were you using NetworkManager to configure the interface previously? If so then you should know that there is also a way to tell NetworkManager about static nameserver addresses.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •