How to force Windows 7 to ask for a "fresh" IP address from DHCP server?

47

10

I'm troubleshooting a certain issue with my DHCP configuration, and need my Windows machine to ask for a "fresh" IP address, so I can see which address DHCP server gives by default.

When I do ipconfig /release followed by ipconfig /renew, Windows "proposes" its old IP address to the DHCP server (just checked with Wireshark, initial "DHCP Discover" message has Option-50 (requested IP address) with Windows machine's old IP).

Tried disabling/enabling network adapter. Same behavior.

Question: How can I force Windows to just ask for a new IP address, without proposing its old IP address.

haimg

Posted 2012-09-05T23:51:34.320

Reputation: 19 503

Is this on your own home network? If so, assigning a static IP may work fine. – Simon Sheehan – 2012-09-05T23:54:01.607

5Yes, static IP will work... However, I've specifically stated that I'm debugging a problem with DHCP, so I need an answer to my question, not a workaround. – haimg – 2012-09-06T00:04:03.420

You could wait for the lease to expire, or try shortening the lease time to expedite the expiration. – Iszi – 2012-09-06T00:09:38.110

2@Iszi: it doesn't help. Windows will propose the same IP when renewing the lease. – haimg – 2012-09-06T00:15:46.510

1Fire up a VM or another box and set that to statically take over that IP? It might be more helpful if you could describe the issue you're really troubleshooting. – Iszi – 2012-09-06T00:16:42.997

Answers

15

There is no procedure worth the effort. It's stored in a registry key, but that portion of the registry is cached while the network subsystem is running. So you'd have to shut the system down, boot another OS installation, mount the registry, delete the key, and then reboot into the original OS installation. The key is DhcpIPAddress but it is only used across reboots, so you can't modify it.

Uninstalling and re-installing the network adapter might work.

David Schwartz

Posted 2012-09-05T23:51:34.320

Reputation: 58 310

2A cold reboot worked for me. – Ray Woodcock – 2014-10-31T22:07:13.790

30

Running net stop dhcp and then net start dhcp appears to work on my Windows 7 test system. The resulting DHCP discover packet does not include Option 50.

I guess it's your choice if you want run ipconfig /release first in order to signal to the DHCP server that the IP address is available (it should remove the existing lease on the DHCP server).

So, to summarize, the whole process would be (in an Administrator cmd window):

ipconfig /release
net stop dhcp
net start dhcp
ipconfig /renew

If you wanted to indicate only a connection matching Local* (for example, Local Area Connection), then you could do:

ipconfig /release Local*
net stop dhcp
net start dhcp
ipconfig /renew Local*

Screenshot

Michael

Posted 2012-09-05T23:51:34.320

Reputation: 317

4Just checked. Does not work. – Basilevs – 2014-09-07T16:31:19.587

4Work for me. I did (in administrator cmd window): ipconfig/release then net stop dhcp then net start dhcp then ipconfig/renew and I got a new address. – Gregor – 2015-03-12T21:22:23.620

1ipconfig /renew Local* just prints the interface info, as if I typed ipconfig with no arguments. Edit: nope! It prints the info (for all interfaces, not just ones matching Local*) and renews the lease. – Kaz – 2015-06-24T19:24:09.733

this worked for me, but i also cleared out the dhcp leases and dns forward/reverse lookups – Pete – 2015-07-30T00:46:34.633

This also worked for me using an admin cmd prompt. – Bibz – 2015-08-05T13:23:07.840

17

This will work:

If your Ethernet driver supports it, you could change the MAC address on the NIC. It's usually a relatively painless procedure. Then ipconfig /renew should give you a new IP address.

Enter image description here

Keltari

Posted 2012-09-05T23:51:34.320

Reputation: 57 019

This was as painless as it was fast. – Joe Johnston – 2015-08-25T22:05:32.657

6

I found this solution here.

  1. Reset WinSock and TCP/IP Stack
    a. Open a Command Prompt as administrator
    b. Reset WINSOCK entries: netsh winsock reset catalog
    c. Reset TCP/IP stack: netsh int ip reset reset.log
    d. Reboot the machine (you can run both commands first, I tend to put multiple commands in notepad and then copy and paste into the command window).

  2. Renew your IP
    Configure your IP settings, whether static or dynamic, and we’re done

j8048188

Posted 2012-09-05T23:51:34.320

Reputation: 73

Only one that worked – Aki – 2016-06-02T07:19:05.930

4

You could try configuring the DHCP server to give out addresses in a range that excludes the old address. Eg, if the old address is x.x.x.101, set the range to be x.x.x.120 to 130. I know you're interested in determining some default behavior of the server, so this may not be helpful if it alters the very thing you want to determine.

maxw

Posted 2012-09-05T23:51:34.320

Reputation: 41

3

Step 1. Write down the IP address that you want to get rid of on the client:

ipconfig /release
run net stop dhcp

Step 2. On the second computer, temporarily assign a manual IP address you wrote down in step 1. On the first computer where you are trying to change the DHCP reservation:

net start dhcp
ipconfig /renew

Step 3. The first computer will now get the next IP address that DHCP will offer. Remove the static address on the secondary machine by switching back to the DHCP setting.

Dmitry

Posted 2012-09-05T23:51:34.320

Reputation: 31

Duplicates Joachim Sauer's answer. – Basilevs – 2014-09-07T16:32:28.600

No, Joachim's didn't mentioned an 2nd computer to hold the undesired address while issuing the commands on the first computer. – Fabricio Araujo – 2018-03-06T18:24:20.583

2

I've just found a workaround. It does require changing the DHCP server configuration however:

  • Shut down the offending system (or just disable the network adapter)
  • Delete the lease on the DHCP server (optional, depending on server)
  • Configure a registration for the original IP address (using any random MAC address)
  • Boot up the client (or re-enable the network adapter)
  • Delete the dummy registration

Joachim Sauer

Posted 2012-09-05T23:51:34.320

Reputation: 935

1

The easiest way I found to force resting the IP, is to assign same DHCP IP to another PC as static IP, below are the steps:

  1. Note your DHCP IP
  2. Shutdown your PC
  3. Assign the IP to another PC as static IP
  4. Start your PC
  5. IP will be changed automatically.

It can be done by using Ethernet and WIFI adapters as well instead of using two PCs.

Wael Dalloul

Posted 2012-09-05T23:51:34.320

Reputation: 443