0

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 ssh 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

4
  • Are you sure sshd on Linux is actually listening on this address? (Check with ss -l sport = :22 or netstat -ltn.) Are you sure the Linux firewall isn't rejecting the connection? "Connection refused" is a pretty specific indication that the server explicitly replied with a RST to the connection attempt. Commented May 16, 2021 at 10:08
  • sshd is listening on 0.0.0.0:22. ssh is possible from 192.168.1.7 ("test") while it is not possible from 192.168.1.204 ("host"). also, there is no firewall active on linux.
    – I grok it
    Commented May 16, 2021 at 10:40
  • Does the Linux system receive the connection attempt packets? (Do you see them in tcpdump?) Commented May 16, 2021 at 11:24
  • No, tcpdump (running on linux) does not see the ssh connection attempts from host to linux. tcpdump shows the ssh traffice from any other machine on the net 192.168.1.0/24 to linux, though. That is why I think it's rather a hyper-v/vswitch issue, than a problem with the linux configuration.
    – I grok it
    Commented May 16, 2021 at 17:39

0

You must log in to answer this question.

Browse other questions tagged .