How to clear previously leased IP address from network adapter?

cqb_driver

Junior Member
Jul 6, 2015
3
0
0
Background:
Windows 7 Ultimate x64. My primary network adapter is configured to use a static IP address. I am using OpenVPN to connect to my VPN service. OpenVPN utilizes the virtual Tap32 adapter - Seen as Local Area Connection 2 in my network settings.

Problem:
Every time I connect to the VPN an Error 1002 is logged in Windows event viewer. The error reads as follows:

"The IP address lease x.x.x.x for the Network Card with network address 0x00FF2395D30C has been denied by the DHCP server x.x.x.x (The DHCP Server sent a DHCPNACK message)."

Note that the MAC address in the Error (FF2395D30C) is the MAC address of the Tap32 adapter.

What appears is happening is that after a successful connection to the VPN the IP address leased to the Tap32 adapter for that session is cached somewhere and then upon reconnecting at a later time, the Tap32 adapter requests that same IP address from the VPN providers' DHCP server which is then denied and a new IP address is leased to the adapter.

There doesn't appear to be any internet access or network problems other than perhaps taking a little longer to connect to the VPN but I am looking for a way to keep the error from being logged.

Is there a way to remove a network adapter's cached IP address upon disconnecting from the VPN so that the virtual adapter is not requesting that old IP address when I reconnect? Any other suggestions?
 

JackMDS

Elite Member
Super Moderator
Oct 25, 1999
29,539
418
126
Use Static IP (Or IP reservation in the Router) for the devices that need continuity in usage.




:cool:
 

cqb_driver

Junior Member
Jul 6, 2015
3
0
0
Tried it for the hell of it but it doesn't work. OpenVPN reconfigures the virtual adapter to obtain IP address automatically and it needs to be that way or else I will run into a conflict with the IP addresses available for lease from from the VPN service provider.

Physical adapter and router are already configured for static IP addresses.
 

azazel1024

Senior member
Jan 6, 2014
901
2
76
Always on disconnect? I don't know of a way, but you can do ipconfig /release from a command prompt.

You could setup a batch file on your desktop to run to release your IP address whenever you disconnect. You could conceivably setup a batch file to launch OpenVPN and have it trigger the ipconfig /release upon closing OpenVPN, but that is trickier.
 

cqb_driver

Junior Member
Jul 6, 2015
3
0
0
I thought about that. I didn't think it would work because that command can only be ran while the adapter is still connected. I'll play around with it and see what I get.


ETA: Executing ipconfig /release just before manually disconnecting from the VPN does work and the error is not logged upon reconnecting. Reconnecting is faster as well. I was able to automate the command with a batch file, however, it only works when disconnecting manually. If I am connected to the VPN and restart my computer before manually disconnecting it looks like Windows is closing the connection or maybe signaling OpenVPN to do it internally; either way my batch file is bypassed in this scenario so now I am looking for a solution to that.
 
Last edited: