Tuesday 23 June 2020

Ghost NIC on AZURE VM **


Hello again, for this post i would like to share on solution if anyone of you ever encounter ghost NIC in azure vm. i encounter this while trying to clone my VM by creating a snapshot. after the vm has been created from the snapshot, you cant ping or rdp in.

if you would like to read more about ghost nic, please refer to this link1 and link2.

Ghost NIC or Hidden network card sometimes can be happen when changes on the infrastructure (hypervisor) level does not update with the OS . OS will still use the same setting on previous network driver attach while at a moment, a new network has been attach and old network is gone. if you are running vm in hyper v or vm, its easier to solve as you have the access to the hypervisor, what if the vm is running on the Azure or other cloud. let begin our "ghostbustering"journey.


1. Identify the network

     option 1- ping from neighbor vm or vm in the same network but it does not work
     option 2- use azure serial console to check


for option 2, this is straight forward way to confirm it.
        step 1. click serial console , under support and troubleshooting
        step 2. type in CMD
        step 3 . type in "ch -si 0001"
        step 4, login using local credential *leave the domain part as blank if you want to use .\ or        workgroup

        step 5. type in this command "netsh interface show interface"


* if you are having a ghost nic, by right the result should be blank.

There are two options on resolving this,
1. Download the vhd , boot in hyper v, remove the hidden nic, sysprep, upload back to azure and use poweshell to create the VM from the VHD.
2. Create a nested vm in azure that run hyper v. Add disk with ghost nic as Data Disk. Create a vm in hyper v and use pass-through disk or physical disk for that VM.
 
Assume you are fully using cloud organization and your organization does not have hyper V running in your environment, that when solution 2 is chosen.


1.Create a VM and make as nested VM - refer to this link 
2. clone the OS disk of the VM or delete just the VM . -i name it as OS01 for easier explanation
3. Attach the OS01 to nested vm.

4. Create a VM(Gen1) in hyper v and use pass-through disk. make sure to change the boot priority.




5. Start the vm and one it ready, access the OS and open device manager. * also choose show hidden


6. You will notice there is few hidden network card and its time to uninstall it.

7. once all the hidden network card has been remove, you can shutdown the vm. detach the pass-through disk and detach os01 from nested vm data disk.

8. Use back the manage disk and recreate back your vm either using back the old vm name or new name. after it created, ping and rdp should work fine and its now will get the IP setting from new azure network card.



fell free to drop a comment or ask question. i will try to answer as soon as possible. see ya

Kubecost on AKS Part 02