0

I'm practicing to use the ssh command with two computer on a local network. From the 192.168.102.77 machine to 10.0.2.15 machine, SSH worked well. However, the inverse is not true, i.e., from the 10.0.2.15 machine to 192.168.102.77 machine, SSH didn't work well. Honestly, I don't know how to fix this problem. Could anyone be able to tell me how to enable this access with the ssh command?

P.S. 10.0.2.15 is a VM on a MBP and 192.168.102.77 is ip address of another MBP with Ubuntu OS.

[jeremie@my_account] ~ ❯ ssh -vvv 10.0.2.15                         
OpenSSH_7.3p1 Ubuntu-1, OpenSSL 1.0.2g  1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "10.0.2.15" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 10.0.2.15 [10.0.2.15] port 22.
debug1: connect to address 10.0.2.15 port 22:
Connection timed out ssh: connect to host 10.0.2.15 port 22:
Connection timed out

For the sudo lsof -inP, I got the following picture :

enter image description here

Interesting question : Do I have modify the network from VirtualBox of my VM of a certain way?

2 Answers2

1

Given the IP, I would suspect the issue is the host machine doesnt know how to route traffic to 10.0.2.15? When initiating a SSH session from 10.0.2.15, the traffic is directed (routed) to the 192.168.102.x network by default.You can test this theory by trying to ping the 10.x.x.x machine from the 192.x.x.x machine, if it says something like network unreachable you have your answer.

In this instance a potential solution would be to amend the VM to have an address on the 192.x.x.x network, you should then be able to perform SSH from either machine.

1

I got the same problem earlier this week. The right way for you to use the ssh command on a virtual machine is to configure your virtual machine's network from VirtualBox as follows:

enter image description here

In fact, as @RichardRose and @TAtakaiWasumi pointed out, using ssh command on a VM needs to have an ip address similar to 192.168.x.x. I'm not an expert, but I read something related to this at a given time.

Hope it'll work!