I'm using Debian 9.1 with KDE and I noticed that resolv.conf gets cleared every time I disconnect or connect to the Internet. Why is that? Why doesn't it keep its contents?
If its contents (at least partly?) depend on the connection-settings or the network or router connected to then shouldn't it keep the contents and only change them if necessary?

Shouldn't all changes to it be authorized explicitly by the user? Another reason for why that is problematic is that it's hard to keep track and log changes to the file otherwise.

1 Answer 1


Network Manager is managing your resolv.conf. This is the default but there are many ways to change it.

  1. Add dns=no to the [main] section of /etc/NetworkManager/NetworkManager.conf`

  2. Use the Gui: See Below

From Debian Wiki: https://wiki.debian.org/NetworkConfiguration#DNS_configuration_for_NetworkManager

DNS configuration for NetworkManager:

NetworkManager will override dhcp settings, overwriting resolv.conf even if you've configured DNS in /etc/dhcp/dhclient.conf, e.g. causing DNS to first search the local domain, which may have to time out before DNS resolution continues causing lengthy DNS resolution times. You can get an idea of what NetworkManager thinks the settings should be by executing nm-tool at the command line.

You may configure these settings using a GUI by launching nm-connection-editor which currently (13.11.23) isn't to be found in System Tools → Administration menu, rather it must be launched by hand from the command line. After launching:

  • Choose a connection (from the Wired or Wireless tab) and click Edit.
  • Click on the IPv4 Settings tab
  • Choose 'Automatic (DHCP) addresses only' instead of just 'Automatic (DHCP)'.
  • Enter the DNS servers in the “DNS servers” field, separated by spaces (e.g. for OpenDNS).
  • Click “Apply.”

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.