Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I (think) that I've configured a static IP address in /etc/network/interfaces:

# The primary network interface 
auto eth0 
iface eth0 inet static

And I change the file /etc/resolv.conf to include the desired nameservers.

Then I restart networking sudo /etc/init.d/networking restart

But after some hours resolv.conf always reverts back to the DHCP nameserver.

I should also say that this is Ubuntu Server with only l0 and eth0 interfaces.

share|improve this question
Is the resolvconf package installed? – Gilles Sep 26 '11 at 23:14
Are you trying to use dhclient on another network interface (maybe a wifi or dial up interface), or is dhclient incorrectly running on eth0 even though it's supposed to be static? – poolie Sep 26 '11 at 23:34
There is only eth0 and lo0, the IP I manually set is the same as the DHCP IP I will get (the DHCP server will always serve the same static IP). But I don't want to use the nameserver given by the DHCP server, so I thought I would set the IP myself and there would not be any DHCP, but I don't understand why the resolv.conf keeps being updated. – David Parks Sep 26 '11 at 23:54
Gilles - no, I ran: dpkg -L resolvconf, and get: Package `resolvconf' is not installed. – David Parks Sep 26 '11 at 23:56
up vote 24 down vote accepted

If you want to override or append to the name servers suggested by the DHCP server, you can configure this in /etc/dhcp/dhclient.conf, eg:

interface "eth0" {
    prepend domain-name-servers;

You can also do this from the "Edit Connections" control in the network indicator in Unity or GNOME.

share|improve this answer
This was the best solution, I posted another option, but realized that setting a static IP was not a good idea in an AWS EC2 environment. :) – David Parks Sep 28 '11 at 20:09

I found a reference to removing the dhcp client, I think that was the main culprit. I've done this and haven't seen the problem yet. Will wait 'till morning to confirm, but it appears that the dhcp client was still running and had to be stopped and uninstalled.

apt-get remove isc-dhcp-client dhcp3-client dhcpcd
share|improve this answer
I'm slightly confused if the solution was the prepend command or if it was actually removing the DHCP client. – Eugene van der Merwe Mar 27 '12 at 8:24
@EugenevanderMerwe It's the prepend command. The poster said "This was the best solution, I posted another option, but realized that setting a static IP was not a good idea in an AWS EC2 environment. :) " – Grammargeek Jan 22 at 21:38

As a rule of thumb, you should always uninstall all network services using apt-get --purge remove <package-name>. In this way, all configuration files will be removed as well.

In this case the command would be:

apt-get --purge remove isc-dhcp-client isc-dhcp-common

This command will completely remove the isc-dhcp-client.

share|improve this answer
How is this relevant, and why do you think it's a good general rule? He doesn't want to stop using DHCP? – poolie Oct 11 '13 at 22:22

Your Answer


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.