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 had installed Ubuntu server and had the router setup to assign the same IP Address ( every time the machine powered on. Recently, I did a clean install of Ubuntu Server and now my machine won't connect to the Internet. I think this is because I mistakenly set it up with a static IP Address in the install process. How can I configure Ubuntu to always ask for an IP Address from the router?

While researching this, it seems like I need to configure my machine to use DHCP. My /etc/networking/interfaces file has this:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static # This is why I think it's setup as a static IP
  # I'm pretty sure I typed these in during setup; they have nothing to do with a DNS

I tried to change the static to dhcp and restart the networking script (like this question suggested), but that didn't work.

share|improve this question
up vote 5 down vote accepted
  1. Make sure all dhclient processes are killed:

    sudo killall dhclient

    See below for why I think this is needed on your system in the state it's in.

  2. Leave the interfaces file alone for the moment.

  3. Bring the interface down.

    sudo ifdown eth0
  4. Reconfigure the interfaces file to this:

    auto lo
    iface lo inet loopback
    auto eth0
    iface eth0 inet dhcp
  5. Bring the interface up again:

    sudo ifup eth0


The networking "service" seems to be an outdated way to reconfigure the network. It's important not to change the order of doing the above when changing the configuration for an interface. One of the issues that can occur is that a dhclient process is started when bringing the interface with dhcp up, but when you change the configuration to static or something else, that process will not be taken down anymore, ever! The result is that your interface configuration is being managed by a split brain. So, please: ifdown, edit, ifup.

share|improve this answer
Thank you. This was a great answer that helped me find my problem (in the end I realized that I was actually plugged in to eth1 instead of eth0; DOH!) – RustyTheBoyRobot Feb 5 '13 at 1:58
'sudo killall dhclient' was the missing piece that solved my problem. – richj May 5 '14 at 22:41

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.