大网数据广告活动
服务器运维问答

Hyper-V Connecting to host to VM w/ External Switch

· 52CE 我爱测

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 networ…

问题原文

原帖链接 · 1iveowl · CC BY-SA 4.0

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.

已采纳解答

原帖链接 · TomTom · CC BY-SA 4.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-09-14)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。