I'm using Debian jessie and I don't have network-manager or resolvconf installed and I'm using DHCP.

DHCP with static DNS
First of all I tried editing:


And adding this:


So now interfaces file looks like this:

allow-hotplug eth0
iface eth0 inet dhcp

To have DHCP and static DNS at the same time but after restarting networking.service nothing will changes.

when using DHCP:

ps aux | grep dhcp
dhclient -v -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases eth0

Manually editing
If I manually edit /etc/resolv.conf and put nameserver there, after restarting networking.service, system DNS server changes to but after doing a ifup:

sudo ifup eth0

Again /etc/resolv.conf automatically changes to

Then I decide to use network-manger, I installed network-manager and after setting DNS server IP in default connection and reconnecting it, it works but after rebooting the system, network-manager creates a new connection with default DNS server ( and automatically connects to this one.

I also checked automatically connect to this network when it is available in correct connection but after reboot network-manager again connects to the other one.

Reseting after 10 Hour
I somehow managed to fix this issue by changing the new connection configs, now it does not create a new connection in every boot and connects to correct connection however now after something around 10 Hours DNS server automatically changes to and I should reconnect the connection or restart NetworkManager.service to get DNS back into

So it's not network-manager which overrides /etc/resolv.cof

Static config
After facing all these I decide to go with static configuration.
First I unistalled network-manager then I added static configuration to:


something like this:

iface eth0 inet static

After restaring networking.service these setting will not apply to system and interface has no IP so network is unreachable too.

Turning router DHCP off Now that I turned my router's DHCP off, static config works fine but I need DHCP to be on for other devices.

I can edit /etc/resolv.conf and change it's permission so nobody can edit it...

But I'm looking for a reason. I want to know why these are not working, which program overrides /etc/resolv.conf and what is the right way to set DNS server.

Is tehre anything that i'm missing here?

  • Do you still by chance have the dhcp daemon running? ps ax | grep dhcp – Rui F Ribeiro Jun 28 '16 at 9:29
  • Now that the router's DHCP is off and my interface config is static there is no dhcp daemon running. the output of the ps command is one line (the grep itself). is there any way to have dhcp and static dns at the same time? – Ravexina Jun 28 '16 at 9:40
  • There would be a way if the daemon was still running. As the output does not show none, we can assume it is not in a standard setup. Would you please add to the question a link to the full output of ps ax when you are having the problem? – Rui F Ribeiro Jun 28 '16 at 9:43
  • I think i got it, is this because having network-manager and dhclient at the same time? I suppose it is. – Ravexina Jun 28 '16 at 10:52

Because the By default jessie network configured via DHCP

you have multi solution

sol 1:
sudo update-rc.d dhcpcd remove

sol 2:
sudo nano /etc/dhcpcd.conf or /etc/dhcp/dhclient.conf

adding the following command


and in file /etc/network/interfaces must change the lines in the following way:

iface lo inet loopback
auto eth0
any config .......

normal config for jessie

edit dhcpcd.conf file

sudo nano  /etc/dhcpcd.conf

and add at the end of the file

interface eth0
static ip_address=

static routers= 

static domain_name_servers=
  • No such a file, my dhcp client config file is here: /etc/dhcp/dhclient.conf and i can manage it to get problem solve, but im curious why dhcp client ignores my config at /etc/network/interfaces – Ravexina Jun 28 '16 at 10:30
  • Because the By default jessie network configured via DHCP – qasem Jun 28 '16 at 12:08

If the resolvconf program is installed, you should not edit the resolv.conf configuration file manually on Debian or Ubuntu based system as it will be dynamically changed by programs in the system. If you need to manually define the nameservers (as with a static interface), add a line something like the following to the interfaces configuration file at /etc/network/interfaces file:

#Place the line indented within an iface stanza, e.g., right after the gateway line.
  • thanks, but I don't have resolvconf installed and as I mentioned that, I tested this dns-nameserver solution, It's not working for me . – Ravexina Jun 28 '16 at 9:55
  • What are your settings in /etc/dhclient.conf or /etc/dhcp/dhclient.conf ? You can turn on or off DNS update and other options for specific interface or all interface using this file. – Ivan P Jun 28 '16 at 10:02
  • I edited my question, please look at dhcp section. interface file content is there. – Ravexina Jun 28 '16 at 10:11
  • I was asking about /etc/dhclient.conf or /etc/dhcp/dhclient.conf . Try to add: prepend domain-name-servers,; in one of them and then restart. – Ivan P Jun 28 '16 at 10:17
  • 1
    Prepend in dhcp config file works, I want to know why dhcp client ignores my /etc/netwrok/interfaces configs. :( – Ravexina Jun 28 '16 at 10:27

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.