Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
add comment

4 Answers 4

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
add comment

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
add comment

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
add comment

All leases here:

/var/lib/dhcp
share|improve this answer
add comment

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.