Here's the summary of my fight to connect to a port on the hypervisor host from a VM hosted on the same machine:
Set up in the Hyper-V Manager:
- Virtual Switch Settings
- Internal
- 'Enable virtual LAN identification for management operating system'
- VLAN number 2
Set up the Virtual Machine (client-01)
- Network Adapter Settings
- 'Enable virtual LAN identification'
- VLAN number 2
Configured IP4 on adapter of host desktop01 (host): 192.168.5.1 255.255.255.0
Configured IP4 on adapter of host client-01 (vm): 192.168.5.10 255.255.255.0
The client can successfully navigate to 'http://desktop01' port 80 running on the host (there's a small website running on the host)
Ping 192.168.5.1 from client is OK
Ping 192.168.5.10 from host is OK
Added 10000 as OK for incoming in Windows Firewall on host
Opened a listener on 10000 on the host, but on the client:
PS C:\Users\user-01> test-netconnection -ComputerName 192.168.5.1 -Port 10000
WARNING: TCP connect to 192.168.5.1:10000 failed
ComputerName : 192.168.5.1
RemoteAddress : 192.168.5.1
RemotePort : 10000
InterfaceAlias : Ethernet
SourceAddress : 192.168.5.10
PingSucceeded : True
PingReplyDetails (RTT) : 0 ms
TcpTestSucceeded : False
The listener is a C# programme I wrote. You may suspect an issue with it, but PowerShell has no problem establishing a connection to it from the same machine. So.. it smells like a firewall thing, but I already made an entry there and there's nothing in the log file. What gives?