I have a remote host 123.456.789
that I am able to SSH into. From within the SSH host, a private database host can be accessed.
I would like to forward my local port on my computer TO the private database host via the remote host (using it as a bastion - if this is the correct terminology).
I'm trying to do:
ssh 3306:my-private-host-database.example:3306 [email protected]
ssh: Could not resolve hostname 3306:my-private-host-database.example:3306: Name or service not known
So the issue seems to be that my-private-host-database.example
resolves correctly only on the internal dns of the bastion 123.456.789
host.
Is this possible to be done?
3306:my-private-host-database.example:3306
seems the argument to a-L
or-R
options. Without one of them, it is probably just parsed ashostname
in a simplessh hostname
(the whole expression, including the two 3306 and the colons). Are you trying to set up some port forwarding? Or to simply connect to a private host through a bastion?-L
in there.123.456.789
, it doesn't immediately try to also establish a connection to the-L
's argument. You shouldn't get any error. In other words,ssh port:unreachable_host:port working_user@working_host
gives no error (then, trying to connect to the localport
would time out). Are those really the commands you are running and the error you are seeing?-L
argument. Thank you! Feel free to post this as an answer.