When troubleshooting networking issues, you might have come across different guides that suggest releasing and renewing your Internet Protocol (IP). In most cases, this can resolve IP conflicts and communication issues with the DHCP server.
While renewing IP is originally done to get a new address from the DHCP pool, you’re not guaranteed to receive a new one every time. This is because the DHCP server can assign the same IP to the client device (only renewing its lease period).
In fact, if you have reserved its MAC address via router settings, you’ll get the same IP every time you reconnect to the network. Here, I shall guide you with the technical details of IP renewal and how to use it on Windows.
Step 1: Open Command-Line Utility
Let’s begin by entering the command line interface of the Windows operating system. You can launch either of the built-in programs—Command Prompt or Powershell and use the same command (discussed in steps 3 and 4). In this section, I’ll be demonstrating using CMD.
- Press Windows + R. This will open the Run dialogue box.
- Now, type
cmd
and hit Enter to open Command Prompt. To provide elevated privilege, you may press Ctrl + Shift + Enter. - The User Account Control prompt should pop up if you opted to open it as an administrator. Hit Yes to continue.
Note: You can release and renew IP with or without administrative privilege.
Step 2: Check Your Current IP Configuration
Before moving on with the dedicated release and renew commands, I recommend checking your present IP configuration first. All you have to do is run the ipconfig /all
command. This should list the detailed information of all your network adapters (unless disabled).
Here are the necessary fields you need to check:
- DHCP Enabled: This field displays “Yes” only if you’re using a dynamic IP. If you’re using a static IP, renewing your address isn’t relevant as you can reconfigure this anytime you like.
- IPv6 Address: This shows your current IPv6 address. You can check this if you’re not planning to renew both (IPv4 and IPv6).
Usually, you’ll see ‘Preferred’ next to your address, which means it will ask for the same IP the next time you send a DHCP renewal request.
You may find both temporary and link-local IPv6 addresses. In case there’s only one, this is your IPv6 address. But in most adapters, you’ll find a single IPv6 field with the link-local and temporary right below them. - IPv4 Address: This is the field that displays your IPv4 address. As with the IPv6 address, it should also show ‘Preferred’ next to it.
- Lease Obtained: It displays the day, date, and time when the DHCP server leased an IP to your device. The field is essential as, most of the time, the server renews your lease time instead of leasing a new IP.
- Lease Expires: This displays when the DHCP-leased IP address expires. Just like the Lease Obtained field, it shows the day, date, and time.
Step 3: Execute Release IP Command
The Dynamic Host Configuration Protocol (DHCP) client-server protocol is responsible for managing unique IP addresses for every device.
Whenever a client releases the leased IP, a DHCP release notification reaches the server and clears the configuration in the selected interface. This IP can now be allocated to any other available device in the network. However, if you renew it or have already reserved your MAC address (via router settings), the same address gets leased.
In Windows, you get two different options, each for IPv4 and IPv6. Execute any one of the following commands based on what you need:
ipconfig /release
: This command forces your adapter to release the leased IPv4 address.ipconfig /release6
: This command forces your adapter to release the leased IPv6 address.
Step 4: Execute Renew IP Command
The client starts the renewal when the lease reaches 50% of its validity time (also called the renewal period). During this process, it sends a REQUEST message to the DHCP server.
If the server accepts the request packet, it sends an acknowledge message (ACK) to the client, and the lease is renewed. However, if NAK (No Acknowledge) message is received, the client has to stop using the lease and start the negotiation process (by sending a DISCOVER message).
In case the DHCP server doesn’t respond at all, the client continues using the same IP until the rebinding period (which is 87.5% of its validity time). Here, the client sends a REQUEST message to the DHCP server again and waits for an ACK message to renew the lease.
While at 50%, the message was unicast (traveling to the specific server), the message at 87.5% is broadcast (traveling to all the available DHCP servers in the network). So, at this point, the device can even obtain a new IP from another DHCP server.
However, if there’s no reply or any DHCP server sends a NAK message, the lease expires. Now, the client has to restart the DORA (Discover-Offer-Request-Acknowledge) process to obtain another IP.
While the above process happens automatically, you may also choose to forcefully renew the IP address. Here are the following commands you need to execute:
ipconfig /renew
(for IPv4)ipconfig /renew6
(for IPv6)
After executing these commands, the IP addresses are relisted. Do note that no operation is performed on adapters whose media is disconnected.
Additional Tip
If you’ve opted for Windows Powershell, here’s a script that should help you release and renew your IP in no time:
$releaserenew = Get-WmiObject -Class Win32_NetworkAdapterConfiguration | where { $_.IpEnabled -eq $true -and $_.DhcpEnabled -eq $true}
foreach ($lan in $releaserenew) {
Write-Host "Releasing IP address"
Sleep 2
$lan.ReleaseDHCPLease() | out-Null
Write-Host "Renewing IP Address"
$lan.RenewDHCPLease() | out-Null
Write-Host “Your new IP address is "$lan.IPAddress" with Subnet "$lan.IPSubnet""
}
Step 5: Verify IP & DHCP Lease Time
Finally, you need to execute the ipconfig /all
command to check whether a new IP is leased or simply the old one’s lease time got renewed. To do so, compare the current address with the one that was displayed in Step 1.
The “Preferred” in the IPv4 or IPv6 field indicates what your client asks the DHCP server during the renewal.
In such a case, the only thing that changes is the Lease time—the Lease Obtained field is updated to when you renewed the IP, and the Lease Expires contains the time when this lease expires.