Super User is a question and answer site for computer enthusiasts and power users. 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 statically set my ip in Linux using:

sudo ifconfig eth0 192.168.blah.blah

Now I want it to go back to using DHCP to assign the IP. How do I do that?

This is what I see when I run dhclient

Internet Systems Consortium DHCP Client V3.1.2
Copyright 2004-2008 Internet Systems Consortium.
All rights reserved.
For info, please visit

Listening on LPF/eth0/08:00:27:9b:43:09
Sending on   LPF/eth0/08:00:27:9b:43:09
Sending on   Socket/fallback
DHCPREQUEST of on eth0 to port 67
share|improve this question

migrated from May 15 '10 at 10:05

This question came from our site for professional and enthusiast programmers.

Regarding your own answer to this question: Are you using a VMWare Linux VM (on a Windows XP host)? That should be stated in the question as well then. I found that not few people have this problem, too, but I could not find a general solution to it yet. – foraidt May 15 '10 at 10:25

Take a look at pump or dhclient

share|improve this answer
I've been trying dhclient but to no avail. When I restart it still tries to keep the ip address I had given it :/ – Markus Orreilly May 15 '10 at 9:35

DHCP will ask for the same address as before as it's first preference, and if the DHCP server hasn't assigned it to someone else, then it will be happy to confirm that address.

Have you tried editing or erasing /var/lib/dhcp3/dhclient.leases? Then DHCP won't have a preference, and the server will allocate a new address.

share|improve this answer

Depending on your distribution, the DHCP client is run with dhclient, dhcpcd, pump or maybe other commands.

The command you wrote is temporary: it does not write anything in any configuration file. This means that after rebooting the system, it will use the same configuration it used before.

It's very improbable to me that the system after reboot will keep using that static IP instead of DHCP. Are you sure it is not using DHCP? And are you sure it used DHCP before?

Specifying your linux distribution would definitely help us.

share|improve this answer
I'm using ubuntu 9.10 as a VirtualBox guest on a Windows 7 host. I had assigned the ip address when using the HostOnly network adapter. I switched it over to Bridged, and ran dhclient, but it keeps requesting the ip address I had assigned to it. Yeah, I thought it should go away on a restart as well. – Markus Orreilly May 15 '10 at 9:53
(had pasted some code here, but it doesn't like that in comments) – Markus Orreilly May 15 '10 at 9:54
Mmh sorry I can't help you.. I have little experience with virtual box. Anyway ask this on . That is the proper place – Dom De Felice May 15 '10 at 9:57

I hate answering my own question, but a "somewhat" fix was to run it with the NAT network adapter instead of bridged. For some reason that one worked, while Bridged didn't :/ - still not quite what I want, but closer.

share|improve this answer

You must log in to answer this question.