Forum Discussion

DanHuber's avatar
DanHuber
Iron Contributor
May 16, 2021

ssh from hyper-v host to linux guest not working. Works perfectly from other machines. How to fix?

 

I have a linux guest with ssh enabled on a hyper-v host.

 

Depending on the assigned vSwitch (Default or External), I can ssh into linux from hyper-v host but not from other systems, or I cannot ssh into linux from hyper-v host but I can from other systems. In both cases, linux can access the internet.

 

host's IP address is 192.168.1.204. Other test machine's IP address is 192.168.1.7.

 

Case 1: Linux on Default vSwitch, assigned address 172.23.174.5

  • ping from host to linux - works
  • ssh from host to linux - works (as the network 172.23.160/20 is directly connected to host by the Hyper-V setup)
  • ping from test to linux - will not work, since it is on another subnet
  • ssh from test to linux - will not work, since it is on another subnet
  • ping from linux to 8.8.8.8 - works

Case 2: Linux on External vSwitch, assigned address 192.168.1.214

  • ping from host to linux - works!!
  • ssh from host to linux - "Connection refused" <<<--- this is the culprit
  • ping from test to linux - works
  • ssh from test to linux - works
  • ping from linux to 8.8.8.8 - works

Obviously, I could go with Case 1 (NAT) and use port forwarding (netsh interface portproxy..) on the host. But I'd rather like to understand why Case 2 does not work. 

Especially why ping from host to linux works, but ssh does not.

 

Any idea why this does not work and how to fix this?

 

Dan

No RepliesBe the first to reply

Resources