0

Using Ubuntu 14.04LTS and having a problem with changing DNS. I can change servers in the /etc/resoolvconf/resolv.conf.d/base and head files and restart resolvconf using sudo resolvconf -u and it will update /etc/resolv.conf with the changes I made. I can then dig for a hostname and it tells me its using the servers I just specified. However, when I run nm-tool it still shows some DNS servers that I do not know where they are coming from. This system is not using DHCP, everything is statically configured, but just in case I went into /etc/dhcp/dhclient.conf and added "prepend domain-name-servers 8.8.8.8" thinking this would manually add 8.8.8.8 on top of the DNS servers I see in nm-tool. After all of these changes I restarted networking and still no luck. How can I force nm-tool to use what I specifiy and how do I find out where these other entries are coming from. ?

4
  • Update - System is using DHCP, sorry, so that is where its getting the config. So what I want to do is override DHCP's DNS and force nm-tool to use what I specify and return the servers I specify? I also need to do this from command line. Thanks!
    – user53029
    Apr 14, 2015 at 14:19
  • you could use supersede-domain-nameservers line from /etc/dhcp/dhclient.conf file. Pesonally i use that, 14.04 as well Apr 14, 2015 at 14:20
  • So , I'm gonna post part of my dhclient.conf into the answer section. Compare that with yours. Also, you know you can change dns for each particular network connection right ? You can find it though the Edit Connection option in the drop down menu of that nm-applet icon. Apr 14, 2015 at 14:52
  • I don't think I have my syntax right in the file. Its not working after a reboot. The DHCP supplied servers are still there.
    – user53029
    Apr 14, 2015 at 14:54

1 Answer 1

1

My /etc/dhcp/dhclient.conf file uses the following configuration, notice the supercede line

 # Configuration file for /sbin/dhclient, which is included in Debian's
#   dhcp3-client package.
#
# This is a sample configuration file for dhclient. See dhclient.conf's
#   man page for more information about the syntax of this file
#   and a more comprehensive list of the parameters understood by
#   dhclient.
#
# Normally, if the DHCP server provides reasonable information and does
#   not leave anything out (like the domain name, for example), then
#   few changes must be made to this file, if any.
#

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;

#send host-name "andare.fugue.com";
send host-name = gethostname();
#send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
#send dhcp-lease-time 3600;
supersede domain-name-servers 208.67.222.222,208.67.220.220,8.8.8.8;
# prepend domain-name-servers 208.67.222.222,208.67.220.220;
request subnet-mask, broadcast-address, time-offset, routers,
    domain-name, domain-name-servers, domain-search, host-name,
    dhcp6.name-servers, dhcp6.domain-search,
    netbios-name-servers, netbios-scope, interface-mtu,
    rfc3442-classless-static-routes, ntp-servers,
    dhcp6.fqdn, dhcp6.sntp-servers;

And here is the output of nm-tool which confirms my dns servers

$ nm-tool | awk '/DNS/ {print $2}'                                                                                      
208.67.222.222
208.67.220.220
8.8.8.8

Perhaps what also helps is that in my /etc/NetworkManager/NetworkManager.conf , I have line dns=dnsmasq commented out, so that Network Manager doesn't use the dnsmasq plug-in

In addition to this method, I've also wrote a script to automate updating dns for each and every connection, which is something that can be used as an alternative, but the idea is still the same - ignore dns provided by dhcp, use your own. Details here: https://unix.stackexchange.com/a/164728/85039

3
  • Ok, I have edited my file like you have, restarted the PC, and its still using the DHCP supplied servers.
    – user53029
    Apr 14, 2015 at 15:20
  • Weird. I don't know what to tell you. Apr 14, 2015 at 15:29
  • yea, it s is. Thank you for the help though..
    – user53029
    Apr 14, 2015 at 16:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .