Symptoms:
At customers I have noticed that sometimes problems occur with network interfaces in Windows, either physical or virtual network interfaces. Having one or more of the following symptoms:
- A static IP Address cannot be used because (accoring to Windows) it is already in use. But there is no sign of a NIC with that specific IP Address.
- A static Default Gateway on the TCP/IP properties of your NIC is lost after reboot or directly after you apply the TCP/IP settings.
- The label “Local Area Network 2” or “Ethernet 2” cannot be renamed to “Local Area Network” or “Ethernet” because (according to Windows) that name already exists.
- A network interface is detected and shown in Device Manager as <interface-name> #2, whereas it is the only interface.
These symptoms occur when settings are left behind in the registry. Which is often caused by human error, incorrectly removing a NIC (Network Interface Card) interface, or using an OS image on another machine. Of course there is no one to blame, what seems so simple is sometimes overlooked. Troubleshooting these symptoms can take a lot of time. But in fact they are quit easy to solve. With this blog I hope to make you aware about what you should (not) do when removing or re-adding a NIC. And if you encounter such symptoms, how to solve it.
What you should not do:
Keep in mind that the following rules apply:
- Never remove a physical NIC without first de-installing it within Device Manager.
- Never remove a vmNIC from a Virtual Machine on a VMware or Hyper-V host before de-installing the network interface on the guest OS within Device Manager.
- Never de-install a NIC without first disabling teaming or aggregation.
- Never re-order physical NICs in PCI slots before de-installing the NIC within Device Manager.
What you should do (correct procedure):
Actually it is quite simple. A NIC has a lot of references in the registry. You have to remove those registry settings before removing a physical or virtual NIC. This can be achieved very easily with the following steps:
- Go to Device Manager.
- Right-click on the NIC that you want to remove and select Uninstall.
Optionally: Select Delete driver software for this device. - Click OK.
- Shutdown your computer.
And finally do your thing. It is as simpel as that, and it can spare you a lot of annoyance.
How to solve it:
Suppose you have a NIC that is not removed correctly and you encounter one or more symptoms as described ealier. Depending on your problem there are many ways to solve it. But from my experience, 9 out of 10 cases, with the following steps you should be able to solve it:
WARNING: Use the following steps at your own risk! I am not not responsible for any problems that might occur by using this information.
- Open an elevated command-prompt (Run as Administrator).
- Run the command “SET DEVMGR_SHOW_NONPRESENT_DEVICES=1”.
- Run the command “START DEVMGMT.MSC”.
- In the Device Manager menu select View > Show hidden devices.
- Right-click on the NIC you want to remove and select Uninstall.
Optionally: Select Delete driver software for this device. - Click OK.
Your problem should now be solved. To be certain, it is best to restart your computer. When the steps above did not solve your problem, there is still another option available. A last case scenerio; by resetting the TCP/IP protocol stack, using the following steps:
WARNING: Use the following steps at your own risk! I am not not responsible for any problems that might occur by using this information.
NOTE: Before you continue; make sure you write down the TCP/IP settings of the existing NIC. Because the TCP/IP settings from all NICs are going to reset.
- Open an elevated command-prompt (Run as Administrator).
- Enter the command “netsh int IP reset c:\resetlog.txt”.
- Restart your computer.
The above syntax is based on a Microsoft solution. Refer to the following link for more information:
How to reset Internet Protocol (TCP/IP)
http://support.microsoft.com/kb/299357/en-us
What about NIC Teaming:
For NIC Teaming the same rules apply. But if you use have an issue with a NIC Team (NICt) or Team NIC (tNIC) configured with LBFO (Load Balancing and Fail-Over) in Windows Server 2012 and later, use the following command from the command-line to reset the entire NIC Teaming (LBFO) configuration:
WARNING: The following command will remove all NIC Teams! Use the following steps at your own risk! I am not not responsible for any problems that might occur by using this information.
- Open an elevated command-prompt (Run as Administrator).
- Enter the command “LbfoAdmin /ResetConfig”.
I hope this information was informative to you. If this blog helped you solve a problem, please be so kind to leave a comment behind.
I recently noticed that the latest Azure VM image with Windows Server 2016 Datacenter has a NIC left behind in the registry. Thats why the NIC in the OS is named “Ethernet 2”. Not a showstopper, but ain’t pretty.
Yes, it ain’t pretty at all. I think the person who create the Master VM image did not uninstall that “Ethernet” then it left as Ghost interface.
Can we do this?
Rename-NetAdapter -Name “Ethernet” -NewName “Ethernet X” -IncludeHidden
Then rename “Ethernet 2” Back to “Ethernet”
Rename-NetAdapter -Name “Ethernet 2” -NewName “Ethernet”
You can. But its better to just remove the hidden device. Then you are able to rename it. Anyway that’s the way I do it.
Thanks Boudewijn! In place upgrade (couldn’t be helped) killed my teaming;
netsh int IP reset c:\resetlog.txt helped me out!