SSH from Virtualbox Guest to DynDNS address

I have Windows 10 as host with a Manjaro installation as Guest on Virtualbox. I have set a Debian server on another house with ssh installed. I have setup a dyndns on Debian's network so I can access it remotely.

For example..

From address 12.34.56.78 I ssh to foo.dyndns.org:1234. This port redirects me to 192.168.1.5:22 always as this is my Debian machine and the connection is established. I am able to do this from Windows 10 as well as my android and any other device in 12.34.56.78 or by 3G.

But..

When I try to do this

$ ssh foo.dyndns.org:1234

from the Manjaro Guest in Virtualbox I get the following error:

ssh: Could not resolve hostname foo.dyndns.org:1234: Name or service not known

So I did ifconfig and I saw my inet address was 10.0.2.15. I changed virtualbox's network adapter from NAT to Bridged so I can get a lan ip and I got the host's ip, 192.168.2.4. So I gave it another try and still didn't work.

Also, if i try to connect from vm to server while I'm in the same network

$ ssh [email protected]:22

it works. In this case virtualbox's network adapter was NAT.

This command works if I try from my android (connectbot).

I can connect the same way from PuTTY from Windows.

So my questions are:

Is there any more information I should provide?

I have searched for a couple of days in here and on google and all I found where solutions on how someone can ssh INTO a vm. No one (from what I saw) asked the opposite.

Upvotes: 1

Views: 269

Answers (1)

Jakuje
Jakuje

Reputation: 26006

Checking manual page for ssh reveals the format of command-line options:

ssh [...] [-p port] [...] [user@]hostnamessh

This simply describes, that you need to change

ssh foo.dyndns.org:1234

to

ssh -p 1234 foo.dyndns.org

if the domain resolves correctly to the ip address.

Upvotes: 1

Related Questions