Hyper-V VM cannot ping host and vice-versa [Fix]
You may have noticed that sometimes, you cannot ping the IP of this Hyper-V Server or the virtual machine from the host computer. This can be due to various reasons, such as the state of your VM, the configuration of the virtual switch, security policies, and more. In this post, we will see what can be done if Hyper-V cannot ping the host device or the host cannot ping the Hyper-V VM.
Fix Hyper-V VM cannot ping host or host cannot ping the VM
If the Hyper-V VM can not ping the host or the host is unable to ping the Hyper-V VM, go through the solutions, tips, and workarounds mentioned below.
- Alter firewall to allow ICMP inbound
- Switch to Private Network
- Use Internal or External Switch instead of a Private
- Restart services related to Hyper
- Reset all network protocols
Let us discuss them in detail.
1] Alter firewall to allow ICMP inbound
Usually, firewalls tend to allow both TCP and UDP connection protocols. These protocols allow the client to form a connection with the server whether it requires the protocol to be connection-orient or connectionless. However, PING is neither TCP nor UDP, therefore, we need to configure the firewall settings to allow ICMP inbound. To do the same, follow the steps mentioned below.
- Open “Windows Settings” by searching it out of the Start Menu.
- Now, go to Firewall & network protection > Advanced settings.
- Click on Inbound settings, look for File and Printer Sharing (Echo Request – ICMPv4-In), and check if it’s allowed. If the Allow column says “Blocked”, right-click on the option File and Printer Sharing (Echo Request – ICMPv4-In), and select Enable Rule.
You will see various File and Printer Sharing options, enable all of them, and check if the issue persists. Make sure to check these settings not just on your host computer but also inside the operating system installed on your Hyper-V.
2] Switch to the Private Network
Devices on private networks might not be able to ping public IP addresses due to router limitations on pinging ports across subnets. We recommend you go ahead and switch to the Private Network on both host and VM. To do the same, follow the steps mentioned below.
- Open Settings by Win + I.
- Go to Network & internet > WiFi (or Ethernet if you are connected to one).
- Then, click on the network you are connected to and then click on Private Network.
Do this on both environments and check if the issue is resolved.
3] Use Internal or External Switch instead of Private
A Virtual Switch (vSwitch) allows a virtual machine (VM) to communicate with another or the host. If you are using the Private Switch, communication between the host and virtual machines is not possible. Hence, we recommend you switch to External or Internal Switch. To create one, you can follow the steps given below.
- Open Hyper-V Manager.
- Click on Virtual Switch Manager.
- Go to New Virtual Network Switch, select either External or Internal, and click Ok.
- Do keep in mind that “Enable virtual LAN indentification for management OS” option is unchecked in the VLAN ID section.
- Once you have created the switch, add it to your VM and check if the issue is resolved.
If you don’t want to create a new switch, you can alter an existing one, from the Virtual Switch Manager. Instead of going to the New Virtual Network Switch tab, select the switch you want to configure and do the needful.
4] Restart services related to Hyper-V
Occasionally, this issue is caused due to a glitch and because of that, your VM is unable to register the change it’s being subjected to. In order to resolve it, we are supposed to restart Hyper-V services. To do the same, follow the below steps.
- Open Services by searching it out of the Start Menu.
- Now, look for Hyper-V.
- Right-click on it and select Restart if it is running, but if it’s in a Stopped state, you need to start it.
There will be multiple services related to Hyper-V, so, restart/start them all and then reboot your computer. Once your computer starts up, check if the issue is resolved.
5] Reset all the network protocols
To resolve the issue, we need to reset all the network protocols. Although these protocols may not be corrupted, network issues may still persist due to glitches. To reset the protocols, please follow these steps:
- Launch Command Prompt as an administrator.
- Execute the following commands one by one.
ipconfig /release ipconfig /renew ipconfig /flushdns ipconfig /registerdns netsh winsock reset
- Now, reboot your computer.
Once your computer starts back up, check if the issue is resolved.
That’s it!
Read: How to enable or disable Nested Virtualization for VMs in Hyper-V?
How do I connect my Hyper-V virtual machine to my host?
With the help of VM Connect, you can use local resources on your virtual machine. To do the same, open VMConnect, select a VM, and click on Show options > Local resources > More. Then, tick the drive that you want to use on the virtual machine and click Ok. Now, check the box associated with Save my settings for future connections to this virtual machine and click Ok. Finally, click on Connect.
Read: How to enable Hyper-V on Windows 365 Cloud PC
How do I enable network connection in Hyper-V?
If you want to enable network connection in Hyper-V, go with External Switch. It’s the only type of Switch that allows your VM to connect to a network card. We have mentioned the steps to create and configure it earlier in this post.
Also Read: Hyper-V Virtual Machine stuck in Starting State.