Every 6 months or so I cannot access the DNS on whatever router I'm using. usually have to add the nameserver by hand to the /etc/resolv.conf file. I've tried adding Google free DNS to the file and it changes nothing. What can I do to not have to manually change the file each time I go to different coffee shop?

  • Which dhcp client do you use? There should be a configuration option to ignore the DNS provided by dhcp.
    – casey
    Jul 25, 2014 at 1:18
  • I'm using Network-Manager not ifup.
    – John Coder
    Jul 25, 2014 at 1:25

2 Answers 2


You can add the following line to /etc/dhcp/dhclient.conf:

prepend domain-name-servers <working DNS IP(s) here>;

This adds the DNS IP address(es) you specify before that/those provided by the DHCP. If you would like to add it/them after the address(es) provided by the DHCP, just use

append domain-name-servers <working DNS IP(s) here>;

If, instead you would like to ignore the DNS address(es) provided by the DHCP altogether, use

supersede domain-name-servers <working DNS IP(s) here>;
  • not sure I had to do this from my windoze box since I don't have DNS capabilities at all. I can ping the quad-notation just no nameserver recognition
    – John Coder
    Jul 25, 2014 at 1:28
  • @JohnCoder I'm not sure I understand what you're saying. Please clarify...
    – Joseph R.
    Jul 25, 2014 at 1:29
  • 1
    I can ping for instance the google dns but I cannot ping goggle.com on the Linux box but I'm posting this from my windows box since I cannot access the nameserver from my Linux box. I'll reboot and see.
    – John Coder
    Jul 25, 2014 at 1:33
  • @JohnCoder What do you get with host google.com
    – Joseph R.
    Jul 25, 2014 at 1:39
  • 1
    Probably worth noting that this only works if the user is using ISC dhcp client.
    – Sam Morris
    Jan 6 at 14:55

You can tell NetworkManager to ignore the DHCP provided DNS servers, by putting this in the network's config file (/etc/NetworkManager/system-connections/my-essid if saved to the system).

The important bit is ignore-auto-dns=true

  • 3
    Is there any way to enforce this setting on all connections? I mean, can I set this as a default, so when I connect to another wifi, it will automatically ignore its DHCP's DNS? Apr 29, 2020 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.