A computer loses its DHCP IP address when no DHCP server is available in Windows 7 or Windows Vista.
Given the occasion, I would like to pass this information on to all administrators who are currently working with Windows 7 or have rolled it out.
You may have noticed that the Windows 7 computers suddenly have no or the wrong IP if the connection to the DHCP server was briefly lost. Normally, this should be corrected with the lease time, but unfortunately this is a small bug in Windows 7, which can be switched off simply by changing a RegKey and the normal behavior can be restored.
Editor’s note: The following description of the solution is largely based on a corresponding article on the Microsoft support pages, which is currently only available in English and in machine German translation and which we are therefore making available to you here in an edited German version. The link to the original entry can be found at the end of this blog entry.
Scenario:
- You have a Dynamic Host Configuration Protocol (DHCP) client computer running Windows Vista or later operating system.
- The DHCP server service is not available.
- The client computer will restart.
It can now happen that a Windows 7 client does not maintain its valid lease. As a result, you cannot reach some network resources.
Cause:
In this scenario, the computer loses the IP address that was assigned to it by the DHCP server. This occurs even if the default gateway is still available. Instead, the client computer is assigned an address using Automatic Private IP Addressing (APIPA) or the adapter uses the IP address given to it via the tab Alternative configuration was assigned separately.
Solution:
To resolve this issue, add a registry value to the registry that forces the client to keep its DHCP IP address even when no DHCP server is available. To do this, follow these steps:
- Start Registry Editor. To do this, click on Startgive regedit in the field start search and then press the Enter key.
- To enable this setting for all adapters, locate the following registry key (registry subkey):HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters(For Windows Vista only:) To enable this setting for only a specific adapter, locate the specific adapter registry key:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\
- Do you click in the menu To edit on NI and then click DWORD value.
- Give DontPingGateway and then press the Enter key.
- Do you click in the menu To edit on To change.
- Type in the box value “1” and then click OK.
- Exit Registry Editor.
- Restart the computer.
This technique forces the client to keep its DHCP IP address even if no DHCP server is available. If you tab Alternative configuration used to change the IP address of an adapter, the IP address assigned here will be assigned to this adapter.
Please note: In Windows 7 the new registry value will not be honored if you try to set it only for a specific adapter in the following subkey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\
Link to the English KB article in Microsoft Support: http://support.microsoft.com/kb/958336/en-us
This script or this procedure has been successfully tested by the author on the platforms described here under the specified framework conditions. If you have your own experiences or questions about the application, we look forward to your comments. Disclaimer: The scripts and procedures described herein are provided “as is” and without warranty of any kind. All risks arising from the use or execution of the scripts and procedures described herein are entirely your responsibility. In no event shall CONET, our authors, or anyone else involved in providing the Content provide any support in connection with the scripts and practices described herein, nor shall they be liable for any damages (including without limitation any damages for loss of business, business failure, the loss of business information or other financial loss) arising from the use or inability to use the scripts and procedures described herein.
About the author
Dirk Machnitzke worked as an IT consultant at CONET and supported the planning, consulting, implementation and management of IT architecture solutions based on Microsoft products in the Microsoft operating environment.
Source: https://www.conet.de/blog/ip-verlust-bei-windows-7-rechnern/