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


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


How to ignore obtained DNS from DHCP server?


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

supersede domain-name-servers,;

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.
  • 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
  • @Alex I've noticed that some devices respond with options you didn't ask for. While you would think it would be ignored if not requested, the opposite appears true in practice: options returned unasked for are actually processed. Something to remember when configuring security sensitive devices... (e.g. send CIDR routes and bypasses traffic from the gateway.) – gertvdijk Aug 3 '19 at 20:13

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.