Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

What I'm trying to achieve is to get cold-start, zero-state DHCP lease which means forcing dhclient through the full discovery and configuration process (DHCPDISCOVER–DHCPOFFER–DHCPREQUEST–DHCPACK as opposed to the shortcutted DHCPREQUEST–DHCPACK cycle which uses a remembered address). I need this to debug a network configuration problem.

I have tried:

  • flushing current lease with dhclient -r, disconnecting the current Network Manager connection;
  • killing any leftover dhclient and dnsmasq processes;
  • cleaning /var/lib/dhcp/ directory, which supposedly contains the client lease database;
  • sudo restart network-manager.

But even after these steps I see in the logs DHCPDISCOVER immediately followed by DHCPREQUEST of somehow still remembered address.

Clearly, the OS is storing the address somehow else, and I've run out of ideas. Any help from the community?

share|improve this question
    
Did you figure it out. I am also running into the same problem. There are lease files under NetworkManager as well. I deleted them as well. For some reason it still picks up the old address. – gudge Feb 26 at 18:38

Normally, dhclient -r should do the trick; but if that doesn't work for you, I found a solution here:

+ Renew an IP address one time :

Note: In this example we will be using the interface eth0. The interface must be configured for DHCP as up and running.

  • Open a terminal and do sudo su to root.
  • Type ifconfig to show the current IP address that you received from DHCP.
  • Type dhcpcd -k to send the appropriate signals to dhcpcd (you might need to install dhcpcd by doing apt-get install dhcpcd).
  • Now bring the interface back up by typing ifup eth0.
  • Type ifconfig to show the new IP address.

There is also a section about renewing the IP address every-time, but the description was for RPM-based distros (in contrast to Debian-based distros like Ubuntu).

Hope it helps :)

share|improve this answer

DHCP Client program writes the lease to a file. Just delete the file and restart networkmanager.

/var/lib/dhcp/dhclient.leases

This is where the leases are stored, in my computer.

share|improve this answer

This did the trick for me(for eth0, run from sudo su):

dhclient -r -v eth0 && rm /var/lib/dhcp/dhclient.* ; dhclient -v eth0
share|improve this answer

What you are seeing is not your machine remembering the IP. In syslog you see DISCOVER REQUEST OFFER ACK however this is not in the order that it happened. It actually went DISCOVER OFFER REQUEST ACK to confirm this you can sniff the traffic between the PC and upstream DHCP server. You sent DISCOVER the server sent back OFFER and you got the IP from the OFFER for your REQUEST

You did everything right however, when you did "dhclient -r" dhclient will send a unicast RELEASE and some ISPs only accept multicast packets to their DHCP server, so the RELEASE never got there, as far as the server is concerned your lease is still valid, so it gave you back the same IP in the OFFER.

share|improve this answer

Your Answer

 
discard

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.