54

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.

5
  • Is this on your own home network? If so, assigning a static IP may work fine. Sep 5, 2012 at 23:54
  • 7
    Yes, 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
    Sep 6, 2012 at 0:04
  • You could wait for the lease to expire, or try shortening the lease time to expedite the expiration.
    – Iszi
    Sep 6, 2012 at 0:09
  • 3
    @Iszi: it doesn't help. Windows will propose the same IP when renewing the lease.
    – haimg
    Sep 6, 2012 at 0:15
  • 1
    Fire 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
    Sep 6, 2012 at 0:16

8 Answers 8

16

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.

2
  • 2
    A cold reboot worked for me. Oct 31, 2014 at 22:07
  • 1
    Those idiots at Microsoft still haven't figured out that when you change a router's LAN IP address from e.g. 192.168.1.1 do 192.168.10.1, then you need to obtain another IP from the router so you can continue configuring it. It is a COMPLETELY FUCKING REGULAR NON-EXOTIC USE CASE. Oct 8, 2023 at 16:19
33

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

5
  • 4
    Just checked. Does not work.
    – Basilevs
    Sep 7, 2014 at 16:31
  • 5
    Work 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
    Mar 12, 2015 at 21:22
  • 1
    ipconfig /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
    Jun 24, 2015 at 19:24
  • 1
    this worked for me, but i also cleared out the dhcp leases and dns forward/reverse lookups
    – Pete
    Jul 30, 2015 at 0:46
  • 1
    This also worked for me using an admin cmd prompt.
    – Bibz
    Aug 5, 2015 at 13:23
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

1
  • This was as painless as it was fast. Aug 25, 2015 at 22:05
7

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

1
  • Only one that worked
    – Aki
    Jun 2, 2016 at 7:19
5

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.

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.

2
  • Duplicates Joachim Sauer's answer.
    – Basilevs
    Sep 7, 2014 at 16:32
  • 2
    No, Joachim's didn't mentioned an 2nd computer to hold the undesired address while issuing the commands on the first computer. Mar 6, 2018 at 18:24
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
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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .