Hyper-V VM – Cannot Access Internet with DHCP but Can With Static

hyper-vipvirtual-machineswindows-server-2016

EDIT: I dropped the default gateway from the DHCP server during a configuration change.

I have a 2016 TP5 VM on a 2016 TP5 Hyper-V host connected to a internal virtual switch, the VM acquires a IPv4 address via DHCP and can resolve and ping internal addresses and hostnames however any attempt to ping an external resource I get the error "PING: transmit failed. General failure." and by extension cannot reach any outside resource but I can access internal ones.

If I set the network interface with the exact same settings that are acquired by DHCP I have no issues, this is the only VM I am currently having the issue on.

I have tried removing and then adding the vNIC and rebooting the VM with no change to the issue.

What is going on?

Best Answer

There is not so much moving parts here: type of your network adapter, connectivity type assigned for VM and IP configuration are the main parts.

  • Are you sure static IP config is valid and complete (default gateway etc.)?
  • Are you sure there is no duplicate IPs in your network?
  • Are you sure that your VM adapater has default gateway specified?
  • Have you tried explicitly ping using IPv4 or IPv6?
  • Does ping 127.0.0.1 / ::1 works fine?

See very similar question: https://superuser.com/questions/662105/no-internet-access-when-using-static-ip There root cause was missing default gateway.

If I were you I would try to read VM's NIC and then try the same static IP config (providing it is valid one) - may well fix your issue too.

Beyond that it could be something more obscure with more difficult fix. Example: https://thommck.wordpress.com/2010/11/04/fixing-a-failed-hyper-v-guest-network-adapter/

General troubleshooting approach to "PING: Transmit failed. General Failure - Reasons and Solution" error: http://www.corenetworkz.com/2011/08/ping-transmit-failed-general-failure.html