2

TL;DR - the short question:
Can a host be configured to be able connect to a VM being hosted by the host itself, when the VM is set to use an External Virtual Switch with the Allow management operating system to share this network adapter enabled?

If so, how?

The details:
I'm trying to run a VM on a Windows 10 (1903) PC using Hyper-V (i.e. the host itself).

I have three overarching goals:
1.) Connect to the VM from the host itself - e.g. http, ssh etc.
2.) Connect to the VM from other PC's on the LAN - e.g. http, ssh etc.
3.) Connect to the LAN and internet from the VM.

The VM is configured in Hyper-V to use an External Virtual Switch. The Allow management operating system to share this network adapter option is enabled. If I disable it, the host loses it's network connectivity.

I have only one NIC on the PC.

So far 2.) and 3.) works fine:

  • The VM gets it's own ip address (from the DHCP server on the LAN or statically).

  • I can ping the VM from another PC on the network.

  • I can also ssh into the VM from another PC on the network etc.

However, 1.) does not work. I am unable to ping, ssh or otherwise access the VM from the host itself. I can only do this from remote PC's on the LAN.

How do I fix this? Can it be done?

I've been pulling my hair, reading posts and trying differnt solutions for the past days, but so far no luck.

Note: Some seem to point in the direction of using Internal Virtual Switch and maybe adding a NAT. I've tried that too, however this just leads to the VM being unable to connect to network. Nor is the host or remote PC's able to connect to the VM. So all in all, this approach currently misses on all 3 goals. Not sure why, as the NAT configuration seems rather straight forward, but maybe related to the OS I'm using in the VM (ESXi 6.0).

Update:
I haven't solved the core issue, but I've found a work-around:

I added a #2 NIC to the host and moved the External Virtual Switch to this 2nd NIC. I also disabled Allow management operating system to share this network adapter on the External Virtual Switch.

With this work-around I can now access the VM from both the host and from other devices on the LAN.

I made no other changes.

1

Simple answer is yes. You just need to make sure they can talk to each other the same way you need to make sure computers on a network can talk to each other (i.e. compatible network settings).

Re your point 1 - there are a TON of settings that can be wrong, starting with firewall settings. The host talking to the VM is a VERY normal totally standard scenario, just make sure you acutally go throug the settings with a fine comb and that they are what you think they should be. You can also adjust your question here WITH THE NETWORK CONFIGS. No idea in what universe you think we can tell you waht is wrong without knowing what it is.

But to answer the question - yes, it is a totally normal stancard setup. Every connection problem I ever encountered was a bad setting in one of the machines.

  • The host and the VM both gets their ip from the same DHCP server. Hence the basic ip config settings are the same. The host has ip 192.168.0.2/24 the VM has ip 192.168.0.3/24. They both use same ip gateway, dns etc. Yet, the issue is that the host is unable to connect to the VM, while other PC on the same LAN that also get their config som the same DHCP are. I've tried to poke hole on the firewall for all all port and protocols related to the ip of the VM. Made no difference. I'm only using the standard Windows 10 firewall. – Jasper H Bojsen Sep 14 '19 at 17:20
  • BTW. I agree with your overall statement, that this should work. This is also why it not working is so frustrating. – Jasper H Bojsen Sep 14 '19 at 17:33
  • What does the ARP cache on the switch - not in hyper-v - say? what about the MAC addresses? – TomTom Sep 14 '19 at 17:34
  • On the host machine there is are no entries of the VM ip address in the arp cache. In the arp cache of a remote PC on the same LAN, there is. Seems like the host is not able to resolve the ip/mac at all. – Jasper H Bojsen Sep 15 '19 at 8:32
  • And that is why I ask about tne external switch. Are you sure it is an external switch? – TomTom Sep 15 '19 at 8:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.