I set static DNS in /etc/resolvconf/resolv.conf.d/base file:

nameserver 8.8.8.8
nameserver 8.8.4.4

But my PC still obtains DNS from DHCP, this is my /etc/resolv.conf:

nameserver 192.168.100.2 
nameserver 8.8.8.8
nameserver 8.8.4.4

How to ignore obtained DNS from DHCP server?

share|improve this question
up vote 17 down vote accepted

You can add this line to your /etc/dhcp/dhclient.conf:

supersede domain-name-servers 8.8.8.8, 8.8.4.4;

Then restart network or run dhclient to make changes.

From man dhclient.conf:

The supersede statement

       supersede [ option declaration ];

       If for some option the client should always  use  a  locally-configured
       value  or  values rather than whatever is supplied by the server, these
       values can be defined in the supersede statement.
share|improve this answer
4  
Also you can comment out in /etc/dhcp/dhclient.conf in request parameters that you don't want to request, for DNS it can be domain-name, domain-name-servers, domain-search. – Alex Nov 8 '16 at 10:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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