I am trying to setup dnsmasq on my machine, however I am having an issue with setting the order or nameservers correctly.

My interface is assigned DNS servers via NetworkManager and DHCP, and those will, seemingly, take priority no matter what I do; I need to completely ignore the nameserver I am sent via DHCP and use localhost only.

I have tried modifying /etc/sysconfig/network-scripts/ifcfg-*, adding DNS1=, however I am then presented with the fowwloing warning message on restart of NetworkManager

dnsmasq[24391]: ignoring nameserver - local interface

I have also tried different configurations with

dns=dnsmasq # both on and off

All with no avail.

I am running CentOS7, and my question is this:

What do I need to configure to ensure that my system always uses as the default, and only nameserver?


if your interface is configured using dhcp, then you should use the dhcp client settings. The setting you probably want to try is supersede domain-name-servers as seen here: https://unix.stackexchange.com/questions/136117/ignore-dns-from-dhcp-server-in-ubuntu but I have never tried it in centos, so not really sure which file you need to edit

  • woohoo, that was not exactly what I was looking for, but lead me to prepend, which adds an additional entry before, instead of overwriting the ones from dhclient. Thanks! – Matt Clark Sep 12 '16 at 17:36

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.